diff --git a/app/helpers/admin/application_helper.rb b/app/helpers/admin/application_helper.rb index 8b213f3fe0b60082881b34c6762a5a6a7bef92f5..4ecd3416cb65e5531acd9fa4fc63320da5254f19 100644 --- a/app/helpers/admin/application_helper.rb +++ b/app/helpers/admin/application_helper.rb @@ -131,6 +131,7 @@ module Admin::ApplicationHelper 'communication.website.menu.item.kind.research_volumes' => 'fas fa-flask', 'communication.website.menu.item.kind.research_volume' => 'fas fa-flask', 'communication.website.menu.item.kind.researchers' => 'fas fa-user', + 'communication.website.menu.item.kind.organizations' => 'fas fa-building', 'communication.website.menu.item.kind.staff' => 'fas fa-user', 'communication.website.menu.item.kind.teachers' => 'fas fa-user', 'communication.website.menu.item.kind.url' => 'fas fa-globe', diff --git a/app/models/communication/website/menu/item.rb b/app/models/communication/website/menu/item.rb index 4f84f3ebddf63b8241b907e2b7ff9f5028ae8bd2..cc4355371cf5b0138b3ccaa49798e84dcd783d81 100644 --- a/app/models/communication/website/menu/item.rb +++ b/app/models/communication/website/menu/item.rb @@ -58,6 +58,7 @@ class Communication::Website::Menu::Item < ApplicationRecord news: 40, news_category: 41, news_article: 42, + organizations: 45, staff: 50, administrators: 51, authors: 52, diff --git a/app/models/communication/website/menu/item/with_targets.rb b/app/models/communication/website/menu/item/with_targets.rb index 2e83c12458be98cd70bc7e7ee4db2f6480f7b2db..f93175d2f0a2c701b4f5eb9aa98939d0612e1447 100644 --- a/app/models/communication/website/menu/item/with_targets.rb +++ b/app/models/communication/website/menu/item/with_targets.rb @@ -35,6 +35,10 @@ module Communication::Website::Menu::Item::WithTargets "#{website.special_page(:communication_posts).path}#{about.path}".gsub("//", '/') if about end + def target_for_organizations + "#{website.special_page(:organizations).path}" + end + def target_for_staff "#{website.special_page(:persons).path}" end diff --git a/app/models/communication/website/page.rb b/app/models/communication/website/page.rb index a940b3508bb240434c14b4a76e3a1d7ea9448e13..e1ac06ce261a3f4b7ae60d0f93d801aeb34325e6 100644 --- a/app/models/communication/website/page.rb +++ b/app/models/communication/website/page.rb @@ -82,6 +82,7 @@ class Communication::Website::Page < ApplicationRecord after_save :update_children_paths, if: :saved_change_to_path? scope :recent, -> { order(updated_at: :desc).limit(5) } + scope :published, -> { where(published: true) } def generated_path "#{parent&.path}#{slug}/".gsub(/\/+/, '/') @@ -106,6 +107,7 @@ class Communication::Website::Page < ApplicationRecord siblings + git_block_dependencies dependencies += website.education_programs if kind_education_programs? + dependencies += [parent] if has_parent? dependencies end diff --git a/app/models/communication/website/with_menu_items.rb b/app/models/communication/website/with_menu_items.rb index 51818072c81d59137a0d1f35bc47f1c359479524..3221927e0af25cf732b530ccf8edc6b3c347083c 100644 --- a/app/models/communication/website/with_menu_items.rb +++ b/app/models/communication/website/with_menu_items.rb @@ -40,6 +40,10 @@ module Communication::Website::WithMenuItems has_communication_posts? end + def menu_item_kind_organizations? + has_organizations? + end + def menu_item_kind_staff? has_persons? end diff --git a/app/views/admin/communication/website/pages/static.html.erb b/app/views/admin/communication/website/pages/static.html.erb index 305f406207362ad68d420b4111e466a8fa50cab9..4d2c9f2f194ee2dce4bd7c91a775615558f3a377 100644 --- a/app/views/admin/communication/website/pages/static.html.erb +++ b/app/views/admin/communication/website/pages/static.html.erb @@ -9,6 +9,12 @@ bodyclass: <%= @about.best_bodyclass %> image: "<%= @about.best_featured_image.blob.id %>" image_alt: "<%= @about.featured_image_alt %>" <% end %> +<% if @about.children.published.any? %> +children: +<% @about.children.published.ordered.each do |child| %> + - <%= child.path %> +<% end %> +<% end %> <% if @about.related_category %> category: "<%= @about.related_category.path %>" <% end %> diff --git a/config/locales/communication/en.yml b/config/locales/communication/en.yml index 89aeb220220eef89e1e0fb652426c0f8bea28d28..d6b31a56cfad5a3508d7586ef604407b3336d3fe 100644 --- a/config/locales/communication/en.yml +++ b/config/locales/communication/en.yml @@ -325,6 +325,7 @@ en: news: News index news_article: Specific news news_category: News category + organizations: Third parties index page: Specific Page program: Specific program programs: Programs index diff --git a/config/locales/communication/fr.yml b/config/locales/communication/fr.yml index 8710f04282fbde74eb6a0357b3b4f70ae7616bcc..54f6c1d5d4bf97479dd0f5d04abd0e20456364b2 100644 --- a/config/locales/communication/fr.yml +++ b/config/locales/communication/fr.yml @@ -327,6 +327,7 @@ fr: news: Liste des actualités news_article: Actualité spécifique news_category: Catégorie d'actualités + organizations: Liste des tierces parties page: Page spécifique program: Formation spécifique programs: Liste des formations