diff --git a/app/models/communication/website/page.rb b/app/models/communication/website/page.rb index f6f132f8ce2f6d3a0033962e4f3381d58f54619b..7f2e3da5448cf75bab7511b9499578448b6114ba 100644 --- a/app/models/communication/website/page.rb +++ b/app/models/communication/website/page.rb @@ -76,6 +76,7 @@ class Communication::Website::Page < ApplicationRecord website.pages.where.not(id: id).root.ordered.each do |page| pages.concat(page.self_and_children(0)) end + pages.reject! { |p| p[:id] == id } pages end diff --git a/app/models/research/journal/article.rb b/app/models/research/journal/article.rb index 6dbbde9097d0ed07b5064f8c99de0e3102e20efe..b389b460a43c48f1e2bc0828b6ac870f261ca7a1 100644 --- a/app/models/research/journal/article.rb +++ b/app/models/research/journal/article.rb @@ -11,7 +11,7 @@ # text :text # title :string # created_at :datetime not null -# updated_at :date not null +# updated_at :datetime not null # research_journal_id :uuid not null # research_journal_volume_id :uuid # university_id :uuid not null diff --git a/app/views/admin/communication/website/pages/index.html.erb b/app/views/admin/communication/website/pages/index.html.erb index b664f0898f8605d96cdaa7a238c016d7e636b55f..ddd2e1f5d519c555a389e30c190ea858aa295c3b 100644 --- a/app/views/admin/communication/website/pages/index.html.erb +++ b/app/views/admin/communication/website/pages/index.html.erb @@ -1,4 +1,5 @@ -<% content_for :title, Communication::Website::Page.model_name.human(count: 2) %> +<% content_for :title, "#{Communication::Website::Page.model_name.human(count: 2)} (#{@website.pages.count})" %> + <ul class="list-unstyled treeview treeview--sortable js-treeview js-treeview-sortable js-treeview-sortable-container" data-id="" data-sort-url="<%= reorder_admin_communication_website_pages_path %>"> <%= render 'treebranch', pages: @root_pages %> diff --git a/app/views/admin/communication/website/posts/index.html.erb b/app/views/admin/communication/website/posts/index.html.erb index 760c743c07a5b8de9b2b1320a7515d8eba82b306..192c8fde23befce2e6a0232ec6d6e712f131d358 100644 --- a/app/views/admin/communication/website/posts/index.html.erb +++ b/app/views/admin/communication/website/posts/index.html.erb @@ -1,4 +1,4 @@ -<% content_for :title, Communication::Website::Post.model_name.human(count: 2) %> +<% content_for :title, "#{Communication::Website::Post.model_name.human(count: 2)} (#{@posts.total_count})" %> <%= render 'admin/communication/website/posts/list', posts: @posts %> <%= paginate @posts, theme: 'bootstrap-5' %> diff --git a/app/views/admin/communication/websites/show.html.erb b/app/views/admin/communication/websites/show.html.erb index b2cb2aaaec9cf6be179fb6e001f56785aa77955b..074e302de7c4299b43a6884f8130734542370f8c 100644 --- a/app/views/admin/communication/websites/show.html.erb +++ b/app/views/admin/communication/websites/show.html.erb @@ -13,13 +13,20 @@ <div class="card mt-5"> <div class="card-header"> <div class="float-end"> - <%= link_to t('create'), + <%= link_to_if can?(:create, Communication::Website::Post), + t('create'), new_admin_communication_website_post_path(website_id: @website), class: button_classes %> </div> <h2 class="card-title"> - <%= link_to Communication::Website::Post.model_name.human(count: 2), - admin_communication_website_posts_path(website_id: @website) %></h2> + <%= link_to admin_communication_website_posts_path(website_id: @website) do %> + <%= t('communication.website.last_posts') %> + <small> + - + <%= t('communication.website.see_all', number: @website.posts.count) %> + </small> + <% end %> + </h2> </div> <%= render 'admin/communication/website/posts/list', posts: @website.posts.recent %> </div> @@ -31,8 +38,13 @@ class: button_classes %> </div> <h2 class="card-title"> - <%= link_to Communication::Website::Page.model_name.human(count: 2), - admin_communication_website_pages_path(website_id: @website) %> + <%= link_to admin_communication_website_pages_path(website_id: @website) do %> + <%= t('communication.website.last_pages') %> + <small> + - + <%= t('communication.website.see_all', number: @website.pages.count) %> + </small> + <% end %> </h2> </div> <%= render 'admin/communication/website/pages/list', pages: @website.pages.recent %> diff --git a/config/locales/communication/en.yml b/config/locales/communication/en.yml index 2da1b9eb3a9343004625cda4c76603554e21d442..b04f9923b29609e13850955103ba4d13df13e90c 100644 --- a/config/locales/communication/en.yml +++ b/config/locales/communication/en.yml @@ -13,7 +13,10 @@ en: refresh: Refresh import show: Show import pending: Import in progress + last_pages: Last pages + last_posts: Last posts metadata: Metadata + see_all: See the full list (%{number} elements) activemodel: models: communication: Communication diff --git a/config/locales/communication/fr.yml b/config/locales/communication/fr.yml index a11914487a0fe859b014de08d8d4a285081f7eaa..cfd9c6d99e1541e7e60c3e08a574af44cedd0534 100644 --- a/config/locales/communication/fr.yml +++ b/config/locales/communication/fr.yml @@ -13,7 +13,10 @@ fr: refresh: Relancer l'import show: Voir l'import pending: Import en cours + last_pages: Dernières pages + last_posts: Dernières actualités metadata: Informations + see_all: Voir la liste complète (%{number} éléments) activemodel: models: communication: Communication diff --git a/db/schema.rb b/db/schema.rb index 8f3bd4863cddcb2750418eab2f6a88bc8c9f9410..6262c6ca38739b634b0192b330fde352168ba632 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -267,7 +267,7 @@ ActiveRecord::Schema.define(version: 2021_10_26_035253) do t.uuid "research_journal_id", null: false t.uuid "research_journal_volume_id" t.datetime "created_at", precision: 6, null: false - t.date "updated_at", null: false + t.datetime "updated_at", precision: 6, null: false t.uuid "updated_by_id" t.text "abstract" t.text "references"