Skip to content
Snippets Groups Projects
Commit 520530b0 authored by pabois's avatar pabois
Browse files

close #239

parent 031a8e4b
No related branches found
No related tags found
No related merge requests found
...@@ -4,7 +4,12 @@ class Admin::Communication::Website::IndexPagesController < Admin::Communication ...@@ -4,7 +4,12 @@ class Admin::Communication::Website::IndexPagesController < Admin::Communication
def index def index
breadcrumb 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 end
def edit def edit
......
...@@ -54,6 +54,18 @@ class Communication::Website::IndexPage < ApplicationRecord ...@@ -54,6 +54,18 @@ class Communication::Website::IndexPage < ApplicationRecord
validates :title, presence: true validates :title, presence: true
validates :path, presence: true, unless: Proc.new { |p| p.home? } 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 def to_s
"#{title}" "#{title}"
end end
......
...@@ -3,22 +3,22 @@ ...@@ -3,22 +3,22 @@
<%= render 'admin/communication/websites/sidebar' do %> <%= render 'admin/communication/websites/sidebar' do %>
<div class="row"> <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="col-md-6 col-lg-4 col-xl-3">
<div class="card"> <div class="card">
<div class="card-body"> <div class="card-body">
<h2 class="card-title"><%= t("communication.website.index_pages.default.#{key}.title") %></h2> <h2 class="card-title"><%= t("communication.website.index_pages.default.#{kind}.title") %></h2>
<% if t("communication.website.index_pages.default.#{key}.title") != @website.index_for(key).title %> <% if t("communication.website.index_pages.default.#{kind}.title") != @website.index_for(kind).title %>
<p class="text-muted mb-0 fst-italic"> <p class="text-muted mb-0 fst-italic">
<%= @website.index_for(key).title %> <%= @website.index_for(kind).title %>
</p> </p>
<% end %> <% end %>
<p class="text-muted small"> <p class="text-muted small">
<%= @website.index_for(key).description %>&nbsp; <%= @website.index_for(kind).description %>&nbsp;
</p> </p>
<div class="text-end"> <div class="text-end">
<%= link_to t("edit"), <%= 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') %> class: button_classes('stretched-link') %>
</div> </div>
</div> </div>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment