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

Merge pull request #1598 from noesya/screenshots

Captures d'écrans des sites Web
parents 49b0bbbc 5d85e63d
No related branches found
No related tags found
No related merge requests found
......@@ -3,7 +3,7 @@ class Admin::Communication::WebsitesController < Admin::Communication::Websites:
has_scope :for_about_type
def index
@websites = apply_scopes(@websites).ordered.page(params[:page])
@websites = apply_scopes(@websites).ordered.page(params[:page]).per(24)
breadcrumb
end
......@@ -59,6 +59,8 @@ class Admin::Communication::WebsitesController < Admin::Communication::Websites:
def update
if @website.update_and_sync(website_params)
# TODO better place, background job once w week?
@website.screenshot!
redirect_to [:admin, @website], notice: t('admin.successfully_updated_html', model: @website.to_s)
else
breadcrumb
......
......@@ -2,39 +2,21 @@
<%= render 'filters', current_path: admin_communication_websites_path, filters: @filters if @filters.any? %>
<div class="table-responsive">
<table class="<%= table_classes %>">
<thead>
<tr>
<th><%= Communication::Website.human_attribute_name('name') %></th>
<th><%= Communication::Website.human_attribute_name('url') %></th>
<th><%= Communication::Website.human_attribute_name('about_type') %></th>
<th><%= Communication::Website.human_attribute_name('about') %></th>
<th></th>
</tr>
</thead>
<tbody>
<% @websites.each do |website| %>
<tr>
<td><%= link_to website, [:admin, website] %></td>
<td><%= link_to website.url, website.url, target: :_blank unless website.url.blank? %></td>
<td><%= I18n.t("activerecord.attributes.communication/website.about_#{website.about_type}") %></td>
<td><%= link_to_if can?(:read, website.about), website.about, [:admin, website.about] if website.about %></td>
<td class="text-end">
<div class="btn-group" role="group">
<%= edit_link website %>
<%= destroy_link website %>
</div>
</td>
</tr>
<% end %>
</tbody>
</table>
<div class="row pt-5">
<% @websites.each do |website| %>
<div class="col-lg-4 col-xl-3">
<div class=" position-relative mb-5">
<div class="ratio bg-light" style="--bs-aspect-ratio: 62.5%">
<%= kamifusen_tag website.screenshot, width: 500, class:'img-fluid rounded' if website.screenshot.attached? %>
</div>
<h2 class="p strong mt-2 mb-0"><%= website %></h2>
<%= link_to t('show'), [:admin, website], class: 'stretched-link pull-end' %>
</div>
</div>
<% end %>
</div>
<%= paginate @websites, theme: 'bootstrap-5' %>
<% content_for :action_bar_right do %>
<%= create_link Communication::Website %>
<% end %>
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