Skip to content
Snippets Groups Projects
Commit 77696198 authored by Arnaud Levy's avatar Arnaud Levy
Browse files

singular

parent c555ec6f
No related branches found
No related tags found
No related merge requests found
Showing
with 213 additions and 219 deletions
......@@ -39,6 +39,6 @@
# fk_rails_280107c62b (communication_website_id => communication_websites.id)
# fk_rails_d208d15a73 (university_id => universities.id)
#
class Communication::Website::Page::Organizations < Communication::Website::Page
class Communication::Website::Page::Administrator < Communication::Website::Page
end
......@@ -39,6 +39,6 @@
# fk_rails_280107c62b (communication_website_id => communication_websites.id)
# fk_rails_d208d15a73 (university_id => universities.id)
#
class Communication::Website::Page::Persons < Communication::Website::Page
class Communication::Website::Page::Author < Communication::Website::Page
end
......@@ -39,7 +39,7 @@
# fk_rails_280107c62b (communication_website_id => communication_websites.id)
# fk_rails_d208d15a73 (university_id => universities.id)
#
class Communication::Website::Page::CommunicationPosts < Communication::Website::Page
class Communication::Website::Page::CommunicationPost < Communication::Website::Page
def git_path(website)
"#{git_path_content_prefix(website)}posts/_index.html"
......
# == Schema Information
#
# Table name: communication_website_pages
#
# id :uuid not null, primary key
# bodyclass :string
# breadcrumb_title :string
# description :text
# description_short :text
# featured_image_alt :string
# featured_image_credit :text
# full_width :boolean default(FALSE)
# github_path :text
# header_text :text
# kind :integer
# position :integer default(0), not null
# published :boolean default(FALSE)
# slug :string
# text :text
# title :string
# type :string
# created_at :datetime not null
# updated_at :datetime not null
# communication_website_id :uuid not null, indexed
# language_id :uuid indexed
# parent_id :uuid indexed
# university_id :uuid not null, indexed
#
# Indexes
#
# index_communication_website_pages_on_communication_website_id (communication_website_id)
# index_communication_website_pages_on_language_id (language_id)
# index_communication_website_pages_on_parent_id (parent_id)
# index_communication_website_pages_on_university_id (university_id)
#
# Foreign Keys
#
# fk_rails_1a42003f06 (parent_id => communication_website_pages.id)
# fk_rails_280107c62b (communication_website_id => communication_websites.id)
# fk_rails_d208d15a73 (university_id => universities.id)
#
class Communication::Website::Page::EducationDiploma < Communication::Website::Page
end
# == Schema Information
#
# Table name: communication_website_pages
#
# id :uuid not null, primary key
# bodyclass :string
# breadcrumb_title :string
# description :text
# description_short :text
# featured_image_alt :string
# featured_image_credit :text
# full_width :boolean default(FALSE)
# github_path :text
# header_text :text
# kind :integer
# position :integer default(0), not null
# published :boolean default(FALSE)
# slug :string
# text :text
# title :string
# type :string
# created_at :datetime not null
# updated_at :datetime not null
# communication_website_id :uuid not null, indexed
# language_id :uuid indexed
# parent_id :uuid indexed
# university_id :uuid not null, indexed
#
# Indexes
#
# index_communication_website_pages_on_communication_website_id (communication_website_id)
# index_communication_website_pages_on_language_id (language_id)
# index_communication_website_pages_on_parent_id (parent_id)
# index_communication_website_pages_on_university_id (university_id)
#
# Foreign Keys
#
# fk_rails_1a42003f06 (parent_id => communication_website_pages.id)
# fk_rails_280107c62b (communication_website_id => communication_websites.id)
# fk_rails_d208d15a73 (university_id => universities.id)
#
class Communication::Website::Page::EducationDiplomas < Communication::Website::Page
end
# == Schema Information
#
# Table name: communication_website_pages
#
# id :uuid not null, primary key
# bodyclass :string
# breadcrumb_title :string
# description :text
# description_short :text
# featured_image_alt :string
# featured_image_credit :text
# full_width :boolean default(FALSE)
# github_path :text
# header_text :text
# kind :integer
# position :integer default(0), not null
# published :boolean default(FALSE)
# slug :string
# text :text
# title :string
# type :string
# created_at :datetime not null
# updated_at :datetime not null
# communication_website_id :uuid not null, indexed
# language_id :uuid indexed
# parent_id :uuid indexed
# university_id :uuid not null, indexed
#
# Indexes
#
# index_communication_website_pages_on_communication_website_id (communication_website_id)
# index_communication_website_pages_on_language_id (language_id)
# index_communication_website_pages_on_parent_id (parent_id)
# index_communication_website_pages_on_university_id (university_id)
#
# Foreign Keys
#
# fk_rails_1a42003f06 (parent_id => communication_website_pages.id)
# fk_rails_280107c62b (communication_website_id => communication_websites.id)
# fk_rails_d208d15a73 (university_id => universities.id)
#
class Communication::Website::Page::EducationProgram < Communication::Website::Page
end
# == Schema Information
#
# Table name: communication_website_pages
#
# id :uuid not null, primary key
# bodyclass :string
# breadcrumb_title :string
# description :text
# description_short :text
# featured_image_alt :string
# featured_image_credit :text
# full_width :boolean default(FALSE)
# github_path :text
# header_text :text
# kind :integer
# position :integer default(0), not null
# published :boolean default(FALSE)
# slug :string
# text :text
# title :string
# type :string
# created_at :datetime not null
# updated_at :datetime not null
# communication_website_id :uuid not null, indexed
# language_id :uuid indexed
# parent_id :uuid indexed
# university_id :uuid not null, indexed
#
# Indexes
#
# index_communication_website_pages_on_communication_website_id (communication_website_id)
# index_communication_website_pages_on_language_id (language_id)
# index_communication_website_pages_on_parent_id (parent_id)
# index_communication_website_pages_on_university_id (university_id)
#
# Foreign Keys
#
# fk_rails_1a42003f06 (parent_id => communication_website_pages.id)
# fk_rails_280107c62b (communication_website_id => communication_websites.id)
# fk_rails_d208d15a73 (university_id => universities.id)
#
class Communication::Website::Page::EducationPrograms < Communication::Website::Page
end
......@@ -42,7 +42,7 @@
class Communication::Website::Page::Home < Communication::Website::Page
def git_path(website)
"#{git_path_content_prefix(website)}_index.html"
"#{git_path_prefix}_index.html"
end
protected
......
# == Schema Information
#
# Table name: communication_website_pages
#
# id :uuid not null, primary key
# bodyclass :string
# breadcrumb_title :string
# description :text
# description_short :text
# featured_image_alt :string
# featured_image_credit :text
# full_width :boolean default(FALSE)
# github_path :text
# header_text :text
# kind :integer
# position :integer default(0), not null
# published :boolean default(FALSE)
# slug :string
# text :text
# title :string
# type :string
# created_at :datetime not null
# updated_at :datetime not null
# communication_website_id :uuid not null, indexed
# language_id :uuid indexed
# parent_id :uuid indexed
# university_id :uuid not null, indexed
#
# Indexes
#
# index_communication_website_pages_on_communication_website_id (communication_website_id)
# index_communication_website_pages_on_language_id (language_id)
# index_communication_website_pages_on_parent_id (parent_id)
# index_communication_website_pages_on_university_id (university_id)
#
# Foreign Keys
#
# fk_rails_1a42003f06 (parent_id => communication_website_pages.id)
# fk_rails_280107c62b (communication_website_id => communication_websites.id)
# fk_rails_d208d15a73 (university_id => universities.id)
#
class Communication::Website::Page::Organization < Communication::Website::Page
end
......@@ -39,6 +39,6 @@
# fk_rails_280107c62b (communication_website_id => communication_websites.id)
# fk_rails_d208d15a73 (university_id => universities.id)
#
class Communication::Website::Page::Teachers < Communication::Website::Page
class Communication::Website::Page::Person < Communication::Website::Page
end
# == Schema Information
#
# Table name: communication_website_pages
#
# id :uuid not null, primary key
# bodyclass :string
# breadcrumb_title :string
# description :text
# description_short :text
# featured_image_alt :string
# featured_image_credit :text
# full_width :boolean default(FALSE)
# github_path :text
# header_text :text
# kind :integer
# position :integer default(0), not null
# published :boolean default(FALSE)
# slug :string
# text :text
# title :string
# type :string
# created_at :datetime not null
# updated_at :datetime not null
# communication_website_id :uuid not null, indexed
# language_id :uuid indexed
# parent_id :uuid indexed
# university_id :uuid not null, indexed
#
# Indexes
#
# index_communication_website_pages_on_communication_website_id (communication_website_id)
# index_communication_website_pages_on_language_id (language_id)
# index_communication_website_pages_on_parent_id (parent_id)
# index_communication_website_pages_on_university_id (university_id)
#
# Foreign Keys
#
# fk_rails_1a42003f06 (parent_id => communication_website_pages.id)
# fk_rails_280107c62b (communication_website_id => communication_websites.id)
# fk_rails_d208d15a73 (university_id => universities.id)
#
class Communication::Website::Page::ResearchPaper < Communication::Website::Page
end
# == Schema Information
#
# Table name: communication_website_pages
#
# id :uuid not null, primary key
# bodyclass :string
# breadcrumb_title :string
# description :text
# description_short :text
# featured_image_alt :string
# featured_image_credit :text
# full_width :boolean default(FALSE)
# github_path :text
# header_text :text
# kind :integer
# position :integer default(0), not null
# published :boolean default(FALSE)
# slug :string
# text :text
# title :string
# type :string
# created_at :datetime not null
# updated_at :datetime not null
# communication_website_id :uuid not null, indexed
# language_id :uuid indexed
# parent_id :uuid indexed
# university_id :uuid not null, indexed
#
# Indexes
#
# index_communication_website_pages_on_communication_website_id (communication_website_id)
# index_communication_website_pages_on_language_id (language_id)
# index_communication_website_pages_on_parent_id (parent_id)
# index_communication_website_pages_on_university_id (university_id)
#
# Foreign Keys
#
# fk_rails_1a42003f06 (parent_id => communication_website_pages.id)
# fk_rails_280107c62b (communication_website_id => communication_websites.id)
# fk_rails_d208d15a73 (university_id => universities.id)
#
class Communication::Website::Page::ResearchPapers < Communication::Website::Page
end
......@@ -39,6 +39,6 @@
# fk_rails_280107c62b (communication_website_id => communication_websites.id)
# fk_rails_d208d15a73 (university_id => universities.id)
#
class Communication::Website::Page::Administrators < Communication::Website::Page
class Communication::Website::Page::ResearchVolume < Communication::Website::Page
end
# == Schema Information
#
# Table name: communication_website_pages
#
# id :uuid not null, primary key
# bodyclass :string
# breadcrumb_title :string
# description :text
# description_short :text
# featured_image_alt :string
# featured_image_credit :text
# full_width :boolean default(FALSE)
# github_path :text
# header_text :text
# kind :integer
# position :integer default(0), not null
# published :boolean default(FALSE)
# slug :string
# text :text
# title :string
# type :string
# created_at :datetime not null
# updated_at :datetime not null
# communication_website_id :uuid not null, indexed
# language_id :uuid indexed
# parent_id :uuid indexed
# university_id :uuid not null, indexed
#
# Indexes
#
# index_communication_website_pages_on_communication_website_id (communication_website_id)
# index_communication_website_pages_on_language_id (language_id)
# index_communication_website_pages_on_parent_id (parent_id)
# index_communication_website_pages_on_university_id (university_id)
#
# Foreign Keys
#
# fk_rails_1a42003f06 (parent_id => communication_website_pages.id)
# fk_rails_280107c62b (communication_website_id => communication_websites.id)
# fk_rails_d208d15a73 (university_id => universities.id)
#
class Communication::Website::Page::ResearchVolumes < Communication::Website::Page
end
......@@ -39,6 +39,6 @@
# fk_rails_280107c62b (communication_website_id => communication_websites.id)
# fk_rails_d208d15a73 (university_id => universities.id)
#
class Communication::Website::Page::Researchers < Communication::Website::Page
class Communication::Website::Page::Researcher < Communication::Website::Page
end
......@@ -39,6 +39,6 @@
# fk_rails_280107c62b (communication_website_id => communication_websites.id)
# fk_rails_d208d15a73 (university_id => universities.id)
#
class Communication::Website::Page::Authors < Communication::Website::Page
class Communication::Website::Page::Teacher < Communication::Website::Page
end
......@@ -37,27 +37,6 @@ module Communication::Website::Page::WithKind
'teachers'
].freeze
# deprecated, remove
after_create :move_legacy_root_pages, if: :kind_home?
def as_special_page
@as_special_page ||= begin
# A normal page is always a normal page
return self if is_regular_page?
# A special page is the same in the database, but has some additional and specific methods
special_page_class = "Communication::Website::Page::#{kind.to_s.classify}".constantize
special_page_class.find id
end
end
def is_special_page?
kind != nil
end
def is_regular_page?
kind == nil
end
# -> dans les nouvelles classes
def has_special_git_path?
is_special_page? && SPECIAL_PAGES_WITH_GIT_SPECIAL_PATH.include?(kind)
......@@ -88,12 +67,4 @@ module Communication::Website::Page::WithKind
end
private
# deprecated, remove
def move_legacy_root_pages
root_pages = website.pages.where.not(id: id).root
root_pages.update_all(parent_id: id)
end
end
......@@ -31,6 +31,7 @@ module Communication::Website::Page::WithPath
end
def git_path(website)
# Same website and page published
return unless website.id == communication_website_id && published
path = git_path_content_prefix(website)
......@@ -39,10 +40,9 @@ module Communication::Website::Page::WithPath
elsif has_special_git_path?
path += "#{kind.split('_').last}/_index.html"
else
path += "pages/#{slug_with_ancestors}/_index.html"
end
path
"#{git_path_prefix}pages/#{slug_with_ancestors}/_index.html"
end
def url
......@@ -53,6 +53,10 @@ module Communication::Website::Page::WithPath
protected
def git_path_prefix
git_path_content_prefix(website)
end
def set_slug
self.slug = to_s.parameterize if self.slug.blank?
current_slug = self.slug
......
module Communication::Website::Page::WithType
extend ActiveSupport::Concern
def is_necessary?
# Communication::Website::Page::CommunicationPosts -> communication_posts
# Used for i18n
def type_key
type.demodulize.underscore
end
def is_special_page?
type.present?
end
def is_regular_page?
type.blank?
end
def is_necessary_for_website?
true
end
......@@ -13,7 +27,12 @@ module Communication::Website::Page::WithType
true
end
def unpublishable?
# Can it be unpublished?
def draftable?
true
end
def deletable?
true
end
end
\ No newline at end of file
......@@ -25,7 +25,7 @@
<% end %>
<div class="ms-auto align-items-center" role="group">
<% if page.is_special_page? %>
<span class="me-3 show-on-hover"><%= t("communication.website.pages.defaults.#{page.kind}.admin_description") %></span>
<span class="me-3 show-on-hover"><%= t("communication.website.pages.defaults.#{page.type_key}.admin_description") %></span>
<% end %>
<div class="btn-group">
<%= duplicate_link page if page.is_regular_page? %>
......
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