app/views/admin/communication/websites/posts/_list.html.erb
<%
small ||= false
hide_buttons ||= false
hide_pinned ||= false
selectable ||= false
if small
hide_buttons = true
end
%>
<% if posts.none? %>
<p><%= t('communication.website.posts.none') %></p>
<% else %>
<% if selectable %>
<input type="hidden" name="ids[]" value="">
<% end %>
<div class="table-responsive <%= 'table-selectable' if selectable %>">
<table class="table table-borderless table-sm">
<thead>
<tr>
<% if selectable %>
<th class="border-0">
<%= check_box_tag nil,
nil,
false,
class: 'form-check-input',
data: { batch_selectable_role: "select-all" } if selectable %>
</th>
<% end %>
</tr>
</thead>
<tbody>
<% posts.each do |post| %>
<tr>
<% if selectable %>
<td class="border-0">
<%= check_box_tag "ids[]",
post.id,
false,
class: 'form-check-input',
data: { batch_selectable_role: "select-single" } %>
</td>
<% end %>
<td>
<div class="<%= osuny_card_classes(horizontal: true) %>">
<%= osuny_thumbnail_localized post %>
<div class="card-body">
<%= osuny_published_localized post unless small %>
<%= osuny_link_localized post,
admin_communication_website_post_path(
website_id: post.website.id,
id: post.id
),
classes: 'stretched-link' %>
</div>
<div class="card-footer d-none d-lg-block">
<% if !hide_buttons && post.pinned_in?(current_language) %>
<span class="badge border border-subtle text-dark">
<%= Communication::Website::Post::Localization.human_attribute_name('pinned') %>
</span>
<% end %>
<% if published_at = post.published_at_in(current_language) %>
<span class="ms-3">
<%= small ? l(published_at.to_date, format: :short)
: l(published_at, format: :date_with_explicit_month) %>
</span>
<% end %>
</div>
</div>
</td>
</tr>
<% end %>
</tbody>
</table>
</div>
<% end %>