Skip to content
Snippets Groups Projects
Unverified Commit a4c5a4fc authored by Arnaud Levy's avatar Arnaud Levy Committed by GitHub
Browse files

Better (#2485)

parent 52d6c0df
No related branches found
No related tags found
No related merge requests found
class Showcase::HomeController < Showcase::ApplicationController
class Showcase::WebsitesController < Showcase::ApplicationController
def index
@tags = Communication::Website::Showcase::Tag.all.ordered
@features = Communication::Website::Showcase.features
......@@ -6,6 +6,11 @@ class Showcase::HomeController < Showcase::ApplicationController
.page(params[:page])
end
def show
@website = Communication::Website.find(params[:id])
raise_404_unless(@website.in_showcase && @website.in_production)
end
def tag
@tag = Communication::Website::Showcase::Tag.find_by!(slug: params[:tag])
@websites = @tag.websites.in_showcase
......
<% content_for :title, 'Showcase' %>
<h1>Showcase</h1>
<div class="my-5">
<p class="small text-uppercase">Thèmes</p>
<% @tags.each do |tag| %>
<% next if tag.websites.none? %>
<%= link_to "#{tag} <span class=\"badge bg-light text-dark rounded-pill\">#{tag.websites.in_production.count}</span>".html_safe,
showcase_tag_path(tag.slug),
class: 'btn btn-outline-light text-dark rounded-pill mb-2 me-2 px-4 py-3' %>
<% end %>
</div>
<div class="my-5">
<p class="small text-uppercase">Fonctionnalités</p>
<% @features.each do |feature| %>
<% next if feature[:websites].none? %>
<%= link_to "#{feature[:name]} <span class=\"badge bg-light text-dark rounded-pill\">#{feature[:websites].count}</span>".html_safe,
feature[:path],
class: 'btn btn-outline-light text-dark rounded-pill mb-2 me-2 px-4 py-3' %>
<% end %>
</div>
<%= render 'list' %>
<%
current_year = nil
%>
<p class="text-end">
<%= @websites.total_count %>
<%= Communication::Website.model_name.human(count: @websites.total_count).downcase %>
......@@ -5,17 +8,27 @@
<div class="row">
<% @websites.each do |website| %>
<%
year = website.created_at.year
if current_year != year
current_year = year
%>
<div class="col-12">
<h2><%= year %></h2>
<hr>
</div>
<% end %>
<div class="col-lg-6">
<article class="mb-5 pb-5">
<% if website.screenshot.attached? %>
<%= link_to website.url, target: :_blank, class: 'no-icon' do %>
<%= link_to showcase_website_path(website) do %>
<%= kamifusen_tag website.screenshot,
class: 'img-fluid rounded mb-3' %>
<% end %>
<% end %>
<div class="row">
<div class="col-lg-10">
<h2 class="h4"><%= website.original_localization.to_s %></h2>
<h3 class="h4"><%= link_to website.original_localization.to_s, showcase_website_path(website) %></h3>
<div class="small mb-1">
<i class="bi bi-compass-fill me-1"></i>
<%= contact_link website.url, :website %>
......
<% content_for :title, 'Showcase' %>
<h1>Showcase</h1>
<% unless params.has_key?(:page) %>
<div class="my-5">
<p class="small text-uppercase">Thèmes</p>
<% @tags.each do |tag| %>
<% next if tag.websites.none? %>
<%= link_to "#{tag} <span class=\"badge bg-light text-dark rounded-pill\">#{tag.websites.in_production.count}</span>".html_safe,
showcase_tag_path(tag.slug),
class: 'btn btn-outline-light text-dark rounded-pill mb-1 me-1 px-lg-3 py-lg-2' %>
<% end %>
</div>
<div class="my-5">
<p class="small text-uppercase">Fonctionnalités</p>
<% @features.each do |feature| %>
<% next if feature[:websites].none? %>
<%= link_to "#{feature[:name]} <span class=\"badge bg-light text-dark rounded-pill\">#{feature[:websites].count}</span>".html_safe,
feature[:path],
class: 'btn btn-outline-light text-dark rounded-pill mb-1 me-1 px-lg-3 py-lg-2' %>
<% end %>
</div>
<% end %>
<%= render 'list' %>
<% content_for :title, @website %>
<h1><%= @website %></h1>
<div class="row mt-5">
<div class="col-lg-6">
<% if @website.screenshot.attached? %>
<%= kamifusen_tag @website.screenshot,
class: 'img-fluid rounded mb-3' %>
<% end %>
</div>
<div class="col-lg-6">
<div class="mb-4">
<i class="bi bi-compass-fill me-1"></i>
<%= contact_link @website.url, :website %>
</div>
<div class="mb-4">
<i class="bi bi-github me-1"></i>
<%= contact_link @website.repository_url, :github %>
</div>
<div class="mb-4">
<% @website.showcase_tags.each do |tag| %>
<%= link_to tag,
showcase_tag_path(tag.slug),
class: 'btn btn-sm btn-outline-light text-dark rounded-pill' %>
<% end %>
</div>
<% if @website.university.logo.attached? %>
<%= image_tag @website.university.logo,
width: 200,
class: 'img-fluid p-3' %>
<% end %>
</div>
</div>
\ No newline at end of file
Rails.application.routes.draw do
constraints host: ENV['OSUNY_SHOWCASE'] do
get ':feature' => 'showcase/home#feature',
get ':feature' => 'showcase/websites#feature',
as: :showcase_feature,
constraints: {
feature: /actualites|agenda|portfolio/
}
get ':tag' => 'showcase/home#tag', as: :showcase_tag
get '/' => 'showcase/home#index'
get ':tag' => 'showcase/websites#tag', as: :showcase_tag
get '/' => 'showcase/websites#index'
get 'websites/:id' => 'showcase/websites#show', as: :showcase_website
end
constraints host: ENV['OSUNY_TRANSPARENCY'] do
get '/' => 'transparency/home#index'
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment