diff --git a/app/views/admin/communication/websites/posts/_list.html.erb b/app/views/admin/communication/websites/posts/_list.html.erb index 8de554b6e4453990ff37542c1a4131977cf79906..46665f5ba46dd6381957b3e6cb05bd4a3fdcd89b 100644 --- a/app/views/admin/communication/websites/posts/_list.html.erb +++ b/app/views/admin/communication/websites/posts/_list.html.erb @@ -4,56 +4,60 @@ hide_category ||= false hide_buttons ||= false selectable ||= false %> -<% if selectable %> - <input type="hidden" name="ids[]" value=""> -<% end %> -<div class="table-responsive <%= 'table-selectable' if selectable %>"> - <table class="<%= table_classes %>"> - <thead> - <tr> - <% if selectable %> - <th class="border-0"> - <%= check_box_tag nil, nil, false, data: { batch_selectable_role: "select-all" } if selectable %> - </th> - <% end %> - <th class="ps-0" width="60%"><%= Communication::Website::Post.human_attribute_name('title') %></th> - <th class="ps-3"><%= Communication::Website::Post.human_attribute_name('meta') %></th> - <th><%= Communication::Website::Post.human_attribute_name('featured_image') %></th> - </tr> - </thead> - <tbody> - <% posts.each do |post| %> - <tr <% unless post.published? %>class="draft"<% 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_classes %>"> + <thead> + <tr> <% if selectable %> - <td class="border-0"><%= check_box_tag "ids[]", post.id, false, data: { batch_selectable_role: "select-single" } %></td> + <th class="border-0"> + <%= check_box_tag nil, nil, false, data: { batch_selectable_role: "select-all" } if selectable %> + </th> <% end %> - <td class="ps-0"> - <%= link_to post, - admin_communication_website_post_path(website_id: post.website.id, id: post.id), - class: "#{'draft' unless post.published?}" %> - </td> - <td class="ps-3 small"> - <% if post.published_at %> - <%= l post.published_at, format: :date_with_explicit_month %><br> - <% end %> - <% if !hide_author && post.author %> - <%= post.author %><br> - <% end %> - <% unless hide_category %> - <ul class="list-unstyled mb-0"> - <% post.categories.each do |category| %> - <li><%= category %></li> - <% end %> - </ul> - <% end %> - <% if post.pinned %> - <%= Communication::Website::Post.human_attribute_name('pinned') %> - <% end %> - </td> - <td><%= image_tag post.featured_image.representation(resize: '200x'), - width: 100 if post.featured_image.attached? && post.featured_image.representable? %></td> + <th class="ps-0" width="60%"><%= Communication::Website::Post.human_attribute_name('title') %></th> + <th class="ps-3"><%= Communication::Website::Post.human_attribute_name('meta') %></th> + <th><%= Communication::Website::Post.human_attribute_name('featured_image') %></th> </tr> - <% end %> - </tbody> - </table> -</div> + </thead> + <tbody> + <% posts.each do |post| %> + <tr <% unless post.published? %>class="draft"<% end %>> + <% if selectable %> + <td class="border-0"><%= check_box_tag "ids[]", post.id, false, data: { batch_selectable_role: "select-single" } %></td> + <% end %> + <td class="ps-0"> + <%= link_to post, + admin_communication_website_post_path(website_id: post.website.id, id: post.id), + class: "#{'draft' unless post.published?}" %> + </td> + <td class="ps-3 small"> + <% if post.published_at %> + <%= l post.published_at, format: :date_with_explicit_month %><br> + <% end %> + <% if !hide_author && post.author %> + <%= post.author %><br> + <% end %> + <% unless hide_category %> + <ul class="list-unstyled mb-0"> + <% post.categories.each do |category| %> + <li><%= category %></li> + <% end %> + </ul> + <% end %> + <% if post.pinned %> + <%= Communication::Website::Post.human_attribute_name('pinned') %> + <% end %> + </td> + <td><%= image_tag post.featured_image.representation(resize: '200x'), + width: 100 if post.featured_image.attached? && post.featured_image.representable? %></td> + </tr> + <% end %> + </tbody> + </table> + </div> +<% end %> \ No newline at end of file diff --git a/config/locales/communication/en.yml b/config/locales/communication/en.yml index d367f86beb6e42a846b2a39d391f87201d480a1a..5dffae2be6b8996f3658c04c733c1563625ccef9 100644 --- a/config/locales/communication/en.yml +++ b/config/locales/communication/en.yml @@ -782,6 +782,7 @@ en: title: Teachers posts: new_curation: New curation + none: No posts yet. published: Published successful_batch_update: Posts have been updated succesfully unpublished: Unpublished diff --git a/config/locales/communication/fr.yml b/config/locales/communication/fr.yml index cf157e7e98a3b4bf2a1d814aa94a3df60990d4ea..cd68c04b039497b5c25fb077333963af70790d65 100644 --- a/config/locales/communication/fr.yml +++ b/config/locales/communication/fr.yml @@ -779,6 +779,7 @@ fr: title: Équipe pédagogique posts: new_curation: Nouvelle curation + none: Il n'y a pas encore d'actualités. published: Publiée successful_batch_update: Les actualités ont bien été mises à jour unpublished: Non publiée