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
19 changes: 15 additions & 4 deletions app/controllers/showcase/websites_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,17 @@ def index
@websites = Communication::Website.in_showcase
.ordered_by_production_date
@title = "#{@websites.count } sites créés"
respond_to do |format|
format.html {
@highlighted_websites = @websites.highlighted_in_showcase
@websites = @websites.page(params[:page]).per(100)
}
format.json {
@websites = @websites.page(params[:page])
response.set_header('X-Total-Count', @websites.total_count.to_s)
response.set_header('X-Total-Pages', @websites.total_pages.to_s)
}
end
end

def show
Expand All @@ -16,16 +27,16 @@ def tag
@tag = Communication::Website::Showcase::Tag.find_by!(slug: params[:tag])
@websites = @tag.websites.in_showcase
.ordered_by_production_date
.page(params[:page])
.per(100)
@highlighted_websites = @websites.highlighted_in_showcase
@websites = @websites.page(params[:page]).per(100)
end

def feature
feature = params[:feature].to_sym
@title = Communication::Website::Showcase.title_for_feature(feature)
@websites = Communication::Website::Showcase.websites_for_feature(feature)
.in_showcase
.ordered_by_production_date
.page(params[:page])
@highlighted_websites = @websites.highlighted_in_showcase
@websites = @websites.page(params[:page]).per(100)
end
end
12 changes: 8 additions & 4 deletions app/views/layouts/public.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,19 @@
<nav class="navbar navbar-light">
<div class="container-fluid">
<a class="navbar-brand" href="/">
<%= image_tag 'logo.svg',
class: 'logo',
alt: 'Osuny',
width: 100 %>
<%= image_tag 'logo.svg', class: 'logo', alt: 'Osuny', height: 32 %>
</a>
</div>
</nav>
<main class="container-fluid">
<%= yield %>
</main>
<footer class="border-top mt-5">
<div class="container-fluid my-5">
<a href="https://www.osuny.org">
<%= image_tag 'logo.svg', class: 'logo', alt: 'Osuny', height: 48 %>
</a>
</div>
</footer>
</body>
</html>
16 changes: 9 additions & 7 deletions app/views/showcase/websites/_filters.html.erb
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
<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),
<% tag_websites_count = tag.websites.in_showcase.count %>
<% next if tag_websites_count.zero? %>
<%= link_to "#{tag} <span class=\"badge bg-light text-dark rounded-pill\">#{tag_websites_count}</span>".html_safe,
showcase_tag_path(tag.slug),
class: 'btn btn-light rounded-pill text-decoration-none mb-2 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],
<% feature_websites_count = feature[:websites].count %>
<% next if feature_websites_count.zero? %>
<%= link_to "#{feature[:name]} <span class=\"badge bg-light text-dark rounded-pill\">#{feature_websites_count}</span>".html_safe,
feature[:path],
class: 'btn btn-light rounded-pill text-decoration-none mb-2 me-1 px-lg-3 py-lg-2' %>
<% end %>
</div>
</div>
42 changes: 22 additions & 20 deletions app/views/showcase/websites/_highlight.html.erb
Original file line number Diff line number Diff line change
@@ -1,24 +1,26 @@
<h2>À découvrir</h2>
<div class="row websites--grid">
<% @websites.highlighted_in_showcase.each do |website| %>
<div class="col-md-6 col-xl-4">
<article class="position-relative">
<% if website.screenshot_full_page.attached? %>
<div class="media">
<%= kamifusen_tag website.screenshot_full_page,
width: 600,
class: 'img-fluid screenshot-full-page mb-3' %>
</div>
<% end %>
<p>
<%= link_to website.original_localization.to_s,
showcase_website_path(website),
class: 'stretched-link' %>
<span class="float-end">
<%= website.in_production_at.year %>
</span>
</p>
</article>
</div>
<% @highlighted_websites.each do |website| %>
<% cache website do %>
<div class="col-md-6 col-xl-4">
<article class="position-relative mb-4">
<% if website.screenshot_full_page.attached? %>
<div class="media">
<%= kamifusen_tag website.screenshot_full_page,
width: 600,
class: 'img-fluid screenshot-full-page mb-3' %>
</div>
<% end %>
<p>
<%= link_to website.original_localization.to_s,
showcase_website_path(website),
class: 'stretched-link' %>
<span class="float-end">
<%= website.in_production_at.year %>
</span>
</p>
</article>
</div>
<% end %>
<% end %>
</div>
39 changes: 20 additions & 19 deletions app/views/showcase/websites/_list.html.erb
Original file line number Diff line number Diff line change
@@ -1,28 +1,29 @@
<% @websites_paginated = @websites.page(params[:page]).per(100) %>
<h2>
Tous les sites
<span class="float-end">
<%= @websites.count %>
<%= Communication::Website.model_name.human(count: @websites.count).downcase %>
<%= @websites.total_count %>
<%= Communication::Website.model_name.human(count: @websites.total_count).downcase %>
</span>
</h2>
<section class="websites--list">
<% @websites_paginated.each do |website| %>
<article>
<div class="row position-relative ">
<div class="col-lg-4">
<%= link_to website.original_localization.to_s,
showcase_website_path(website),
class: 'stretched-link' %>
<%= kamifusen_tag website.screenshot,
width: 500,
class: 'floating-thumb' if website.screenshot.attached? %>
<% @websites.each do |website| %>
<% cache website do %>
<article>
<div class="row position-relative ">
<div class="col-lg-4">
<%= link_to website.original_localization.to_s,
showcase_website_path(website),
class: 'stretched-link' %>
<%= kamifusen_tag website.screenshot,
width: 500,
class: 'floating-thumb' if website.screenshot.attached? %>
</div>
<div class="col-lg-3 text-end text-lg-start"><%= website.university %></div>
<div class="col-lg-4 text-end text-lg-start"><%= website.showcase_tags.to_sentence %></div>
<div class="col-lg-1 text-end"><%= website.in_production_at.year %></div>
</div>
<div class="col-lg-3 text-end text-lg-start"><%= website.university %></div>
<div class="col-lg-4 text-end text-lg-start"><%= website.showcase_tags.to_sentence %></div>
<div class="col-lg-1 text-end"><%= website.in_production_at.year %></div>
</div>
</article>
</article>
<% end %>
<% end %>
</section>
<%= paginate @websites_paginated, theme: 'bootstrap-5' %>
<%= paginate @websites, theme: 'bootstrap-5' %>
4 changes: 2 additions & 2 deletions app/views/showcase/websites/feature.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@

<h1><%= @title %></h1>

<%= render 'highlight' %>
<%= render 'list' %>
<%= render 'highlight' if @highlighted_websites.any? %>
<%= render 'list' %>
2 changes: 1 addition & 1 deletion app/views/showcase/websites/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<h1><%= @title %></h1>

<% unless params.has_key?(:page) %>
<%= render 'highlight' %>
<%= render 'highlight' if @highlighted_websites.any? %>
<%= render 'filters' %>
<% end %>

Expand Down
4 changes: 2 additions & 2 deletions app/views/showcase/websites/tag.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@

<h1><%= @tag %></h1>

<%= render 'highlight' %>
<%= render 'list' %>
<%= render 'highlight' if @highlighted_websites.any? %>
<%= render 'list' %>
Loading