Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
227 changes: 114 additions & 113 deletions Gemfile.lock

Large diffs are not rendered by default.

48 changes: 48 additions & 0 deletions app/assets/stylesheets/application.tailwind.css
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,54 @@ body {
.dc-pill-sm { padding: 0.35rem 1rem; }
.dc-pill[aria-current="page"] { background: var(--dc-black); border-color: var(--dc-black); color: #fff; }

/* Browser-style tabs: the selected tab joins the panel below the rail. */
.dc-tabs-row {
display: flex;
flex-wrap: wrap;
align-items: flex-end;
justify-content: space-between;
gap: 0.5rem 1rem;
border-bottom: 2px solid var(--dc-black);
}
.dc-tabs {
display: flex;
align-items: flex-end;
gap: 0.25rem;
}
.dc-tab {
display: inline-flex;
align-items: center;
gap: 0.5rem;
min-height: 44px;
margin-bottom: -2px;
padding: 0.65rem 1.25rem;
border: 2px solid transparent;
border-bottom-color: var(--dc-black);
border-radius: 12px 12px 0 0;
color: var(--dc-text-mid);
font-size: 0.875rem;
font-weight: 600;
white-space: nowrap;
transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}
.dc-tab:hover {
background: var(--dc-yellow-bg);
border-color: var(--dc-black);
}
.dc-tab[aria-selected="true"] {
background: var(--dc-bg);
border-color: var(--dc-black);
border-bottom-color: var(--dc-bg);
color: var(--dc-black);
}
.dc-tab-count {
color: var(--dc-text-muted);
font-size: 0.75rem;
font-variant-numeric: tabular-nums;
}
.dc-tab[aria-selected="true"] .dc-tab-count { color: var(--dc-black); }
.dc-tabs-action { margin-left: auto; padding-bottom: 0.75rem; }

/* "Learn more →" style text link. */
.dc-link { color: var(--dc-pink); font-size: 0.875rem; font-weight: 600; transition: opacity 0.15s; }
.dc-link:hover { opacity: 0.7; }
Expand Down
1 change: 1 addition & 0 deletions app/controllers/site/companies_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ def show
end

@jobs = Hiring::JobPost.visible_to(current_user).where(company: @company).newest
@technologies = @company.technologies.order(:name)
end
end
end
10 changes: 10 additions & 0 deletions app/controllers/site/developers_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,16 @@ def index
@countries = scope.where.not(country: [nil, ""]).distinct.order(:country).pluck(:country)
@skills = Skill.joins(profile_skills: :profile).merge(scope).distinct.order(:name).to_a
@skills = (@skills << @selected_skill).compact.uniq(&:id).sort_by(&:name)
@companies_using_skill = @selected_skill&.companies&.organizations&.order(:name) || Company.none
@results_tab = (@selected_skill && params[:tab] == "companies") ? :companies : :developers
@company_job_counts = if @results_tab == :companies
Hiring::JobPost.visible_to(current_user)
.where(company_id: @companies_using_skill.select(:id))
.group(:company_id)
.count
else
{}
end

scope = Developers::DirectorySearch.call(
scope:,
Expand Down
7 changes: 7 additions & 0 deletions app/definitions/company_definition.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ class CompanyDefinition < ::ResourceDefinition
field :organization_type, condition: -> { !object.personal? }
field :industry, condition: -> { !object.personal? }
field :founded_year, label: "Year of establishment", condition: -> { !object.personal? }
field :technologies, label: "Technologies", condition: -> { !object.personal? }
field :github_url, as: :url, label: "GitHub", condition: -> { !object.personal? }
field :linkedin_url, as: :url, label: "LinkedIn", condition: -> { !object.personal? }
field :x_url, as: :url, label: "X (formerly Twitter)", condition: -> { !object.personal? }
Expand All @@ -23,6 +24,9 @@ class CompanyDefinition < ::ResourceDefinition
input :organization_type, as: :select, choices: Company::ORGANIZATION_TYPES.to_a, placeholder: "Choose a type"
input :industry, placeholder: "e.g. Financial services"
input :founded_year, placeholder: "e.g. 2018"
input :technologies, label: "Technologies",
hint: "Languages, frameworks, databases and tools your team uses.",
condition: -> { !object.personal? }, wrapper: {class: "col-span-full"}
input :website, placeholder: "https://"
input :github_url, placeholder: "https://github.com/your-company"
input :linkedin_url, placeholder: "https://linkedin.com/company/your-company"
Expand All @@ -39,10 +43,12 @@ class CompanyDefinition < ::ResourceDefinition
display attribute, wrapper: {class: "col-span-full"}
end
display :founded_year, formatter: ->(year) { year&.to_s }, wrapper: {class: "col-span-full"}
display :technologies, label: "Technologies", wrapper: {class: "col-span-full"}

form_layout do
section :company, :name, :tagline, :logo, :slug, label: "Company", columns: 1
section :about, :organization_type, :industry, :founded_year, :description, label: "About", columns: 2
section :technologies, :technologies, label: "Technologies"
section :location, :country, :city, label: "Location", columns: 2
section :links, :website, :github_url, :linkedin_url, :x_url, label: "Links", columns: 1
ungrouped label: "Other"
Expand All @@ -52,6 +58,7 @@ class CompanyDefinition < ::ResourceDefinition
section :company, :name, :tagline, :logo, :slug, label: "Company"
section :location, :country, :city, label: "Location"
section :about, :organization_type, :industry, :founded_year, :description, label: "About"
section :technologies, :technologies, label: "Technologies"
section :links, :website, :github_url, :linkedin_url, :x_url, label: "Links"
ungrouped label: "Other"
end
Expand Down
2 changes: 2 additions & 0 deletions app/models/company.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ class Company < ::ResourceRecord
# add has_one associations above.
has_many :company_users, dependent: :destroy
has_many :users, through: :company_users
has_many :company_technologies, dependent: :delete_all
has_many :technologies, through: :company_technologies, source: :skill
has_many :job_posts, class_name: "Hiring::JobPost", dependent: :destroy
has_many :company_user_invites, class_name: "Invites::CompanyUserInvite", dependent: :destroy

Expand Down
26 changes: 26 additions & 0 deletions app/models/company_technology.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# == Schema Information
#
# Table name: company_technologies
#
# id :integer not null, primary key
# created_at :datetime not null
# updated_at :datetime not null
# company_id :integer not null
# skill_id :integer not null
#
# Indexes
#
# index_company_technologies_on_company_id_and_skill_id (company_id,skill_id) UNIQUE
# index_company_technologies_on_skill_id (skill_id)
#
# Foreign Keys
#
# company_id (company_id => companies.id) ON DELETE => cascade
# skill_id (skill_id => skills.id)
#
class CompanyTechnology < ::ResourceRecord
belongs_to :company
belongs_to :skill

validates :skill, uniqueness: {scope: :company_id}
end
2 changes: 2 additions & 0 deletions app/models/skill.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ class Skill < ::ResourceRecord

has_many :profile_skills, class_name: "Developers::ProfileSkill", dependent: :restrict_with_error
has_many :project_skills, class_name: "Showcase::ProjectSkill", dependent: :restrict_with_error
has_many :company_technologies, dependent: :restrict_with_error
has_many :companies, through: :company_technologies
# add has_many associations above.

# add attachments above.
Expand Down
6 changes: 3 additions & 3 deletions app/models/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def opt_out!(category, via:)
def update_opt_outs!(categories, via:)
transaction do
notification_opt_outs.where(channel: via.to_s).where.not(category: categories).delete_all
categories.each { opt_out!(_1, via:) }
categories.each { opt_out!(it, via:) }
end
notification_opt_outs.reset
end
Expand All @@ -80,15 +80,15 @@ def slack_identity

# Slack DMs take over from email. People can turn email back on per category.
def slack_connected!
NotificationOptOut::CATEGORIES.each_key { opt_out!(_1, via: :email) }
NotificationOptOut::CATEGORIES.each_key { opt_out!(it, via: :email) }
end

# Email comes back for every category still on in Slack, so nobody stops
# hearing about something they wanted. Slack opt-outs stay in case they reconnect.
def disconnect_slack!
transaction do
slack_identity.destroy!
still_on = NotificationOptOut::CATEGORIES.keys.select { wants_notification?(_1, via: :slack) }
still_on = NotificationOptOut::CATEGORIES.keys.select { wants_notification?(it, via: :slack) }
notification_opt_outs.where(channel: "email", category: still_on).delete_all
end
end
Expand Down
4 changes: 2 additions & 2 deletions app/policies/company_policy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ def invite_user?

def permitted_attributes_for_create
[:name, :slug, :logo, :tagline, :organization_type, :industry, :founded_year,
:website, :github_url, :linkedin_url, :x_url, :description, :city, :country]
:technologies, :website, :github_url, :linkedin_url, :x_url, :description, :city, :country]
end

def permitted_attributes_for_read
[:name, :slug, :logo, :tagline, :organization_type, :industry, :founded_year,
:website, :github_url, :linkedin_url, :x_url, :description, :city, :country]
:technologies, :website, :github_url, :linkedin_url, :x_url, :description, :city, :country]
end

# Associations
Expand Down
1 change: 1 addition & 0 deletions app/structured_data/structured_data/company.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ def to_h
"slogan" => company.tagline,
"industry" => company.industry,
"foundingDate" => company.founded_year&.to_s,
"knowsAbout" => company.technologies.order(:name).pluck(:name),
"address" => address(city: company.city, country: company.country),
"logo" => logo_url(company),
"sameAs" => links.presence
Expand Down
11 changes: 11 additions & 0 deletions app/views/site/companies/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,17 @@
</section>
<% end %>

<% if @technologies.any? %>
<section class="mt-10">
<h2 class="dc-heading text-3xl">Technologies</h2>
<ul class="mt-4 flex flex-wrap gap-2" aria-label="Technologies used by <%= company.display_name %>">
<% @technologies.each do |technology| %>
<li><%= link_to technology.name, technical_skill_path(technology), class: "dc-pill dc-pill-sm" %></li>
<% end %>
</ul>
</section>
<% end %>

<section class="mt-10">
<h2 class="dc-heading text-3xl">Open jobs</h2>
<% if @jobs.any? %>
Expand Down
60 changes: 45 additions & 15 deletions app/views/site/developers/index.html.erb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<% page_title = @selected_skill ? "#{@selected_skill.name} developers" : "Developers" %>
<% page_title = @selected_skill ? "#{@selected_skill.name} developers and companies" : "Developers" %>
<% page_description = @selected_skill&.canonical_description || "Browse developers in the DevCongress community: skills, experience and availability." %>
<% content_for :title, page_title %>
<% content_for :description, page_description %>
Expand All @@ -13,7 +13,7 @@
<div class="dc-container py-16 sm:py-20">
<% if @selected_skill %>
<p class="dc-eyebrow">Technical skill<%= " · #{@selected_skill.category}" if @selected_skill.category.present? %></p>
<h1 class="dc-heading text-[clamp(2.5rem,6vw,4rem)]"><%= @selected_skill.name %> developers</h1>
<h1 class="dc-heading text-[clamp(2.5rem,6vw,4rem)]"><%= @selected_skill.name %></h1>
<p class="mt-4 max-w-3xl text-lg leading-8 text-[#444]"><%= @selected_skill.canonical_description %></p>
<p class="mt-3 max-w-3xl leading-7 text-[#555]">
<%= @selected_skill.canonical_why_description %>
Expand All @@ -34,7 +34,7 @@
</div>
<% end %>
<p class="mt-3 max-w-3xl text-sm text-[#666]">
<%= current_user ? "Browse members who list #{@selected_skill.name} among their skills." : "Browse public profiles that list #{@selected_skill.name}. Sign in to see members-only profiles too." %>
<%= current_user ? "Explore members who list #{@selected_skill.name} and companies using it." : "Explore public profiles that list #{@selected_skill.name} and companies using it. Sign in to see members-only profiles too." %>
</p>
<% else %>
<p class="dc-eyebrow">The community</p>
Expand Down Expand Up @@ -66,22 +66,52 @@
</section>

<section class="dc-container py-12">
<div class="mb-6 flex items-center justify-between gap-4 text-sm text-[#555]">
<p><%= pluralize(@total, "developer") %><%= " match" if filtered %></p>
<% if filtered %><%= link_to "Clear filters", developers_directory_path, class: "dc-link" %><% end %>
</div>
<% if @selected_skill %>
<% developers_tab_path = technical_skill_path(@selected_skill, **request.query_parameters.except("tab", "page")) %>
<% companies_tab_path = technical_skill_path(@selected_skill, **request.query_parameters.except("page").merge("tab" => "companies")) %>
<div class="dc-tabs-row mb-8">
<nav class="dc-tabs" role="tablist" aria-label="<%= @selected_skill.name %> results">
<%= link_to developers_tab_path, class: "dc-tab", role: "tab", aria: {selected: @results_tab == :developers, current: ("page" if @results_tab == :developers), controls: "developers-results"} do %>
Developers <span class="dc-tab-count"><%= @total %></span>
<% end %>
<%= link_to companies_tab_path, class: "dc-tab", role: "tab", aria: {selected: @results_tab == :companies, current: ("page" if @results_tab == :companies), controls: "companies-results"} do %>
Companies <span class="dc-tab-count"><%= @companies_using_skill.size %></span>
<% end %>
</nav>
<% if filtered %><%= link_to "Clear filters", developers_directory_path, class: "dc-link dc-tabs-action" %><% end %>
</div>
<% end %>

<% if @developers.any? %>
<div class="grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-3">
<% @developers.each do |developer| %>
<%= render "home/developer_card", developer: %>
<% if @results_tab == :companies %>
<div id="companies-results" role="tabpanel" aria-label="Companies">
<% if @companies_using_skill.any? %>
<div class="grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-3">
<% @companies_using_skill.each do |company| %>
<%= render "site/companies/company_card", company:, job_count: @company_job_counts.fetch(company.id, 0) %>
<% end %>
</div>
<% else %>
<div class="dc-empty p-12">
<p class="dc-heading text-3xl">No companies list <%= @selected_skill.name %> yet.</p>
<p class="mt-2 text-[#555]">Companies can add it to the technologies on their profile.</p>
</div>
<% end %>
</div>
<%= render "site/shared/pagination" %>
<% else %>
<div class="dc-empty p-12">
<p class="dc-heading text-3xl">No one matches that yet.</p>
<p class="mt-2 text-[#555]">Try fewer filters<%= ", or sign in to see members-only profiles" unless current_user %>.</p>
<div id="developers-results" role="tabpanel" aria-label="Developers">
<% if @developers.any? %>
<div class="grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-3">
<% @developers.each do |developer| %>
<%= render "home/developer_card", developer: %>
<% end %>
</div>
<%= render "site/shared/pagination" %>
<% else %>
<div class="dc-empty p-12">
<p class="dc-heading text-3xl">No one matches that yet.</p>
<p class="mt-2 text-[#555]">Try fewer filters<%= ", or sign in to see members-only profiles" unless current_user %>.</p>
</div>
<% end %>
</div>
<% end %>
</section>
12 changes: 12 additions & 0 deletions db/migrate/20261107100000_create_company_technologies.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
class CreateCompanyTechnologies < ActiveRecord::Migration[8.1]
def change
create_table :company_technologies do |t|
t.belongs_to :company, null: false, index: false, foreign_key: {on_delete: :cascade}
t.belongs_to :skill, null: false, foreign_key: true

t.timestamps
end

add_index :company_technologies, [:company_id, :skill_id], unique: true
end
end
13 changes: 12 additions & 1 deletion db/schema.rb

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion db/seeds.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Idempotent: safe to run on every deploy (bin/rails db:seed).

# Skills for profiles and project stacks. See db/seeds/skills.yml for where the
# Skills for profiles, project stacks and company technologies. See db/seeds/skills.yml for where the
# list comes from. The catalogue is the source of truth for names and categories;
# skill_descriptions.yml adds precise copy where category-level copy is too broad.
catalogue = SkillDescription.catalogue
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ def permitted_attributes_for_read
attributes = [:name, :website, :description, :country, :city]
return attributes if record.personal?

attributes + [:logo, :tagline, :organization_type, :industry, :founded_year, :github_url, :linkedin_url, :x_url]
attributes + [:logo, :tagline, :organization_type, :industry, :founded_year, :technologies,
:github_url, :linkedin_url, :x_url]
end

def permitted_attributes_for_update
Expand Down
Loading
Loading