Add project highlighting via config file

This commit is contained in:
Max Wofford 2025-05-27 12:35:17 -04:00
parent 986a103e1e
commit 7e257d5db3
3 changed files with 10 additions and 1 deletions

View file

@ -13,6 +13,14 @@ class Project
@content = attributes[:content]
end
def self.highlighted_projects
@highlighted_projects ||= YAML.load_file(Rails.root.join("config/highlighted_projects.yml"))
end
def is_highlighted?
self.class.highlighted_projects.include?(github_slug)
end
def name
title.presence || project_name.titleize
end

View file

@ -17,7 +17,7 @@
<div class="grid xl:grid-cols-3 gap-4 mt-4 md:grid-cols-2 grid-cols-1">
<% @projects.each do |project| %>
<div class="bg-[#2E2A54] border-2 border-[#403A88] hover:border-[#544FFF] rounded-lg text-white hover:bg-[#3A3A6D] transition duration-100 transition-transform hover:scale-102 p-8 h-full flex flex-col">
<div class="bg-[#2E2A54] border-2 <%= project.is_highlighted? ? "border-yellow-800" : "border-[#403A88]" %> hover:border-[#544FFF] rounded-lg text-white hover:bg-[#3A3A6D] transition duration-100 transition-transform hover:scale-102 p-8 h-full flex flex-col">
<% if project.has_journal? %>
<%= link_to project_path(user: project.user, project_name: project.project_name), class: "block mb-2" do %>
<h1 class="text-2xl font-bold"><%= project.name.truncate(25) %></h1>

View file

@ -0,0 +1 @@
- hackclub/awesome-project