diff --git a/app/controllers/admin/communication/website/index_pages_controller.rb b/app/controllers/admin/communication/website/index_pages_controller.rb index 1c0cd7f18a24b5fd804c8795503dc38ff1f33c8f..8395ed8d9e13f5d2669ca03290e4a6eaa336967f 100644 --- a/app/controllers/admin/communication/website/index_pages_controller.rb +++ b/app/controllers/admin/communication/website/index_pages_controller.rb @@ -4,7 +4,12 @@ class Admin::Communication::Website::IndexPagesController < Admin::Communication def index breadcrumb - @kinds = Communication::Website::IndexPage.kinds + @kinds = Communication::Website::IndexPage.kinds_global + if @website.about_school? + @kinds += Communication::Website::IndexPage.kinds_school + elsif @website.about_journal? + @kinds += Communication::Website::IndexPage.kinds_journal + end end def edit diff --git a/app/models/communication/website/index_page.rb b/app/models/communication/website/index_page.rb index 6dd9431ca4276f157590fc2fd910eaf9ef3a1537..aa62f6213fdf980d31f1a80779a281ede7eb922c 100644 --- a/app/models/communication/website/index_page.rb +++ b/app/models/communication/website/index_page.rb @@ -54,6 +54,18 @@ class Communication::Website::IndexPage < ApplicationRecord validates :title, presence: true validates :path, presence: true, unless: Proc.new { |p| p.home? } + def self.kinds_global + [:home, :communication_posts, :persons, :authors] + end + + def self.kinds_school + [:education_programs, :administrators, :teachers] + end + + def self.kinds_journal + [:research_articles, :research_volumes, :researchers] + end + def to_s "#{title}" end diff --git a/app/views/admin/communication/website/index_pages/index.html.erb b/app/views/admin/communication/website/index_pages/index.html.erb index 18e6614fcec2927b0b01fb6a1af6992620e8ecd9..8b5faee66f9adb59eb52a2b02318171126017915 100644 --- a/app/views/admin/communication/website/index_pages/index.html.erb +++ b/app/views/admin/communication/website/index_pages/index.html.erb @@ -3,22 +3,22 @@ <%= render 'admin/communication/websites/sidebar' do %> <div class="row"> - <% @kinds.each do |key, value| %> + <% @kinds.each do |kind| %> <div class="col-md-6 col-lg-4 col-xl-3"> <div class="card"> <div class="card-body"> - <h2 class="card-title"><%= t("communication.website.index_pages.default.#{key}.title") %></h2> - <% if t("communication.website.index_pages.default.#{key}.title") != @website.index_for(key).title %> + <h2 class="card-title"><%= t("communication.website.index_pages.default.#{kind}.title") %></h2> + <% if t("communication.website.index_pages.default.#{kind}.title") != @website.index_for(kind).title %> <p class="text-muted mb-0 fst-italic"> - <%= @website.index_for(key).title %> + <%= @website.index_for(kind).title %> </p> <% end %> <p class="text-muted small"> - <%= @website.index_for(key).description %> + <%= @website.index_for(kind).description %> </p> <div class="text-end"> <%= link_to t("edit"), - admin_communication_website_index_path(website_id: @website.id, kind: key), + admin_communication_website_index_path(website_id: @website.id, kind: kind), class: button_classes('stretched-link') %> </div> </div>