diff --git a/app/controllers/admin/communication/extranets_controller.rb b/app/controllers/admin/communication/extranets_controller.rb index c4ca5d22ae83ccda613e1cc2fbb91ec39ca43b1f..01296ea7e713ddcbd76ba7104cced914e88a7b2c 100644 --- a/app/controllers/admin/communication/extranets_controller.rb +++ b/app/controllers/admin/communication/extranets_controller.rb @@ -55,6 +55,6 @@ class Admin::Communication::ExtranetsController < Admin::Communication::Applicat def extranet_params params.require(:communication_extranet) - .permit(:name, :domain, :logo, :logo_delete) + .permit(:name, :domain, :about_type, :about_id, :logo, :logo_delete) end end diff --git a/app/controllers/admin/communication/website/index_pages_controller.rb b/app/controllers/admin/communication/website/index_pages_controller.rb deleted file mode 100644 index 3d4bd80fdd16ac03fb0437654edbfa89c92890ef..0000000000000000000000000000000000000000 --- a/app/controllers/admin/communication/website/index_pages_controller.rb +++ /dev/null @@ -1,58 +0,0 @@ -class Admin::Communication::Website::IndexPagesController < Admin::Communication::Website::ApplicationController - before_action :get_index_page, only: [:edit, :update] - before_action :ensure_abilities - - def index - breadcrumb - @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 - breadcrumb - add_breadcrumb t("communication.website.index_pages.default.#{@index_page.kind}.title") - end - - def update - if @index_page.update_and_sync(index_page_params) - redirect_to admin_communication_website_indexes_path(@website), notice: t('admin.successfully_updated_html', model: Communication::Website::IndexPage.model_name.human) - else - breadcrumb - add_breadcrumb t("communication.website.index_pages.default.#{@index_page.kind}.title") - render :edit, status: :unprocessable_entity - end - end - - protected - - def get_index_page - @index_page = @website.index_for(params[:kind]) - end - - def ensure_abilities - if @index_page - authorize! :update, @index_page - else - authorize! :read, @website - end - end - - def breadcrumb - super - add_breadcrumb Communication::Website::IndexPage.model_name.human(count: 2), admin_communication_website_indexes_path(@website) - end - - - def index_page_params - params.require(:communication_website_index_page) - .permit( - :title, :breadcrumb_title, :description, :header_text, :text, :path, :featured_image, :featured_image_delete, - :featured_image_infos, :featured_image_alt - ) - .merge(university_id: current_university.id) - end -end diff --git a/app/controllers/admin/communication/website/pages_controller.rb b/app/controllers/admin/communication/website/pages_controller.rb index 87855f6d9f6c0d27f3619ea375ec63d2bb59c4c7..26aa3f068d18579169652aaa42d77c93c3a0adcf 100644 --- a/app/controllers/admin/communication/website/pages_controller.rb +++ b/app/controllers/admin/communication/website/pages_controller.rb @@ -1,9 +1,9 @@ class Admin::Communication::Website::PagesController < Admin::Communication::Website::ApplicationController load_and_authorize_resource class: Communication::Website::Page, through: :website - before_action :get_root_pages, only: [:index, :new, :create, :edit, :update] - def index + @homepage = @website.pages.kind_home.first + @first_level_pages = @homepage.children.ordered breadcrumb end @@ -67,16 +67,16 @@ class Admin::Communication::Website::PagesController < Admin::Communication::Web end def destroy - @page.destroy_and_sync - redirect_to admin_communication_website_pages_url(@website), notice: t('admin.successfully_destroyed_html', model: @page.to_s) + if @page.is_special_page? + redirect_back(fallback_location: admin_communication_website_page_path(@page), alert: t('admin.communication.website.pages.delete_special_page_notice')) + else + @page.destroy_and_sync + redirect_to admin_communication_website_pages_url(@website), notice: t('admin.successfully_destroyed_html', model: @page.to_s) + end end protected - def get_root_pages - @root_pages = @website.pages.root.ordered - end - def breadcrumb super add_breadcrumb Communication::Website::Page.model_name.human(count: 2), @@ -86,8 +86,8 @@ class Admin::Communication::Website::PagesController < Admin::Communication::Web def page_params params.require(:communication_website_page) - .permit(:communication_website_id, :title, - :description, :description_short, :text, :about_type, :about_id, :slug, :published, + .permit(:communication_website_id, :title, :breadcrumb_title, + :description, :description_short, :header_text, :text, :slug, :published, :featured_image, :featured_image_delete, :featured_image_infos, :featured_image_alt, :parent_id, :related_category_id) .merge(university_id: current_university.id) diff --git a/app/controllers/admin/research/journal/articles_controller.rb b/app/controllers/admin/research/journal/articles_controller.rb index c112b51d5a28f27c5982be8b23ebfa01cb73beba..986777174ed261094f1ebd24ce558936ff100602 100644 --- a/app/controllers/admin/research/journal/articles_controller.rb +++ b/app/controllers/admin/research/journal/articles_controller.rb @@ -60,7 +60,7 @@ class Admin::Research::Journal::ArticlesController < Admin::Research::Journal::A def article_params params.require(:research_journal_article) - .permit(:title, :slug, :text, :published, :published_at, :abstract, :pdf, :references, :keywords, :research_journal_volume_id, person_ids: []) + .permit(:title, :slug, :text, :published, :published_at, :abstract, :description, :pdf, :references, :keywords, :research_journal_volume_id, person_ids: []) .merge(university_id: current_university.id) end end diff --git a/app/controllers/admin/research/journal/volumes_controller.rb b/app/controllers/admin/research/journal/volumes_controller.rb index b0c1d63da54692956c8ef503b2f12262f19f20b7..95413015794473f3e40693691de334d8a187ee3e 100644 --- a/app/controllers/admin/research/journal/volumes_controller.rb +++ b/app/controllers/admin/research/journal/volumes_controller.rb @@ -56,7 +56,7 @@ class Admin::Research::Journal::VolumesController < Admin::Research::Journal::Ap def volume_params params.require(:research_journal_volume) .permit( - :title, :slug, :number, :keywords, :published, :published_at, :description, + :title, :slug, :number, :keywords, :published, :published_at, :description, :text, :featured_image, :featured_image_infos, :featured_image_delete, :featured_image_alt ) .merge(university_id: current_university.id) diff --git a/app/models/ability.rb b/app/models/ability.rb index 0b32788eb8b717ec582fc62f2c602ebad63dbcb0..6668ccaa91ffdea4903b5504f8d222a4fdbafd93 100644 --- a/app/models/ability.rb +++ b/app/models/ability.rb @@ -57,7 +57,6 @@ class Ability can :manage, Communication::Website::Post, university_id: @user.university_id, communication_website_id: managed_websites_ids can :manage, Communication::Website::Category, university_id: @user.university_id, communication_website_id: managed_websites_ids can [:read, :update, :reorder], Communication::Website::Menu, university_id: @user.university_id, communication_website_id: managed_websites_ids - can [:read, :update], Communication::Website::IndexPage, university_id: @user.university_id, communication_website_id: managed_websites_ids can :manage, Communication::Website::Menu::Item, university_id: @user.university_id, website_id: managed_websites_ids can :create, Communication::Website::Menu::Item, university_id: @user.university_id can :manage, University::Organization, university_id: @user.university_id @@ -72,7 +71,6 @@ class Ability can :manage, Communication::Website::Page, university_id: @user.university_id can :manage, Communication::Website::Post, university_id: @user.university_id can :manage, Communication::Website::Category, university_id: @user.university_id - can [:read, :update], Communication::Website::IndexPage, university_id: @user.university_id can [:read, :update, :reorder], Communication::Website::Menu, university_id: @user.university_id can :manage, Communication::Website::Menu::Item, university_id: @user.university_id can :manage, Communication::Website::Imported::Website, university_id: @user.university_id diff --git a/app/models/communication/extranet.rb b/app/models/communication/extranet.rb index 4d22aba55404c4e436f3ce97998dadb1c8fda678..f041347526c323c78bc734599153063ab7fc6629 100644 --- a/app/models/communication/extranet.rb +++ b/app/models/communication/extranet.rb @@ -3,14 +3,17 @@ # Table name: communication_extranets # # id :uuid not null, primary key +# about_type :string indexed => [about_id] # domain :string # name :string # created_at :datetime not null # updated_at :datetime not null +# about_id :uuid indexed => [about_type] # university_id :uuid not null, indexed # # Indexes # +# index_communication_extranets_on_about (about_type,about_id) # index_communication_extranets_on_university_id (university_id) # # Foreign Keys @@ -18,6 +21,7 @@ # fk_rails_c2268c7ebd (university_id => universities.id) # class Communication::Extranet < ApplicationRecord + include WithAbouts include WithUniversity validates_presence_of :name, :domain diff --git a/app/models/communication/website.rb b/app/models/communication/website.rb index a3ec423b645f1a54f47e99c445f96fdaf9318581..ce85a34e592788a6605de2184a0899b5a8e02f18 100644 --- a/app/models/communication/website.rb +++ b/app/models/communication/website.rb @@ -32,9 +32,9 @@ class Communication::Website < ApplicationRecord include WithGit include WithGitRepository include WithImport - include WithIndexPages include WithMenuItems include WithProgramCategories + include WithSpecialPages scope :ordered, -> { order(:name) } @@ -55,27 +55,10 @@ class Communication::Website < ApplicationRecord dependencies = [self, config_permalinks, config_base_url] + menus dependencies += pages + pages.map(&:active_storage_blobs).flatten dependencies += posts + posts.map(&:active_storage_blobs).flatten if has_communication_posts? - dependencies += people_with_facets + people.map(&:active_storage_blobs).flatten if has_people? + dependencies += people_with_facets + people.map(&:active_storage_blobs).flatten if has_persons? dependencies += [categories] if has_communication_categories? dependencies += about.git_dependencies(website) - dependencies += git_index_pages_dependencies(website) dependencies end - def git_index_pages_dependencies(website) - # TMP: add index_pages - index_pages_dependencies = [index_for(:home)] + index_for(:home).active_storage_blobs - index_pages_dependencies += [index_for(:communication_posts)] + index_for(:communication_posts).active_storage_blobs if has_communication_posts? - index_pages_dependencies += [index_for(:education_programs)] + index_for(:education_programs).active_storage_blobs if has_education_programs? - index_pages_dependencies += [index_for(:persons)] + index_for(:persons).active_storage_blobs if has_people? - index_pages_dependencies += [index_for(:authors)] + index_for(:authors).active_storage_blobs if has_authors? - index_pages_dependencies += [index_for(:administrators)] + index_for(:administrators).active_storage_blobs if has_administrators? - index_pages_dependencies += [index_for(:teachers)] + index_for(:teachers).active_storage_blobs if has_teachers? - index_pages_dependencies += [index_for(:research_volumes)] + index_for(:research_volumes).active_storage_blobs if has_research_volumes? - index_pages_dependencies += [index_for(:research_articles)] + index_for(:research_articles).active_storage_blobs if has_research_articles? - index_pages_dependencies += [index_for(:researchers)] + index_for(:researchers).active_storage_blobs if has_researchers? - index_pages_dependencies - # END TMP - end - end diff --git a/app/models/communication/website/category.rb b/app/models/communication/website/category.rb index d4a32e3922d7af4d40e265f56439bf078034a8cf..111fb7a8e1637a280cc48a60a1ee2f56b2a3a38e 100644 --- a/app/models/communication/website/category.rb +++ b/app/models/communication/website/category.rb @@ -81,11 +81,11 @@ class Communication::Website::Category < ApplicationRecord end def git_dependencies(website) - [self] + descendents + active_storage_blobs + posts + website.menus + [self] + descendants + active_storage_blobs + posts + website.menus end def git_destroy_dependencies(website) - [self] + descendents + active_storage_blobs + [self] + descendants + active_storage_blobs end def update_children_paths diff --git a/app/models/communication/website/index_page.rb b/app/models/communication/website/index_page.rb index fc8f8e428e219ad60969a3790a9f40202609d565..2e11d4a2317138fb6e54aea3c8946a29ebb80a61 100644 --- a/app/models/communication/website/index_page.rb +++ b/app/models/communication/website/index_page.rb @@ -29,7 +29,6 @@ class Communication::Website::IndexPage < ApplicationRecord include WithUniversity include Sanitizable - include WithGit include WithFeaturedImage include WithBlobs @@ -39,6 +38,9 @@ class Communication::Website::IndexPage < ApplicationRecord education_programs: 20, research_articles: 30, research_volumes: 32, + legal_terms: 80, + sitemap: 81, + privacy_policy: 82, persons: 100, administrators: 110, authors: 120, @@ -54,46 +56,8 @@ 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 - def git_dependencies(website) - [self] + active_storage_blobs + website.menus + [website.config_permalinks] - end - - def git_destroy_dependencies(website) - [self] + active_storage_blobs - end - - def home - @home ||= Communication::Website::IndexPage::Home.find(id) - end - - def education_programs - @education_programs ||= Communication::Website::IndexPage::EducationPrograms.find(id) - end - - protected - - def explicit_blob_ids - super.concat [featured_image&.blob_id] - end - - def inherited_blob_ids - [best_featured_image&.blob_id] - end - end diff --git a/app/models/communication/website/index_page/administrators.rb b/app/models/communication/website/index_page/administrators.rb deleted file mode 100644 index d659241bfd31b36e87c64790ce33f29c0a4f1e16..0000000000000000000000000000000000000000 --- a/app/models/communication/website/index_page/administrators.rb +++ /dev/null @@ -1,42 +0,0 @@ -# == Schema Information -# -# Table name: communication_website_index_pages -# -# id :uuid not null, primary key -# breadcrumb_title :string -# description :text -# featured_image_alt :string -# header_text :text -# kind :integer -# path :string -# text :text -# title :string -# created_at :datetime not null -# updated_at :datetime not null -# communication_website_id :uuid not null, indexed -# university_id :uuid not null, indexed -# -# Indexes -# -# idx_comm_website_index_page_on_communication_website_id (communication_website_id) -# index_communication_website_index_pages_on_university_id (university_id) -# -# Foreign Keys -# -# fk_rails_5cd2482227 (communication_website_id => communication_websites.id) -# fk_rails_7eb45227ae (university_id => universities.id) -# -class Communication::Website::IndexPage::Administrators < Communication::Website::IndexPage - def self.polymorphic_name - 'Communication::Website::IndexPage::Administrators' - end - - def git_path(website) - 'content/administrators/_index.html' - end - - def url - "/#{website.index_for(:persons).path}/#{website.index_for(:administrators).path}/" - end - -end diff --git a/app/models/communication/website/index_page/authors.rb b/app/models/communication/website/index_page/authors.rb deleted file mode 100644 index e6ecbf853e8aeb6190edf7f65b5f50399069b4a3..0000000000000000000000000000000000000000 --- a/app/models/communication/website/index_page/authors.rb +++ /dev/null @@ -1,42 +0,0 @@ -# == Schema Information -# -# Table name: communication_website_index_pages -# -# id :uuid not null, primary key -# breadcrumb_title :string -# description :text -# featured_image_alt :string -# header_text :text -# kind :integer -# path :string -# text :text -# title :string -# created_at :datetime not null -# updated_at :datetime not null -# communication_website_id :uuid not null, indexed -# university_id :uuid not null, indexed -# -# Indexes -# -# idx_comm_website_index_page_on_communication_website_id (communication_website_id) -# index_communication_website_index_pages_on_university_id (university_id) -# -# Foreign Keys -# -# fk_rails_5cd2482227 (communication_website_id => communication_websites.id) -# fk_rails_7eb45227ae (university_id => universities.id) -# -class Communication::Website::IndexPage::Authors < Communication::Website::IndexPage - def self.polymorphic_name - 'Communication::Website::IndexPage::Authors' - end - - def git_path(website) - 'content/authors/_index.html' - end - - def url - "/#{website.index_for(:persons).path}/#{website.index_for(:authors).path}/" - end - -end diff --git a/app/models/communication/website/index_page/communication_posts.rb b/app/models/communication/website/index_page/communication_posts.rb deleted file mode 100644 index 2b11622df8b163fd40e2060fbdffd35e731e7743..0000000000000000000000000000000000000000 --- a/app/models/communication/website/index_page/communication_posts.rb +++ /dev/null @@ -1,42 +0,0 @@ -# == Schema Information -# -# Table name: communication_website_index_pages -# -# id :uuid not null, primary key -# breadcrumb_title :string -# description :text -# featured_image_alt :string -# header_text :text -# kind :integer -# path :string -# text :text -# title :string -# created_at :datetime not null -# updated_at :datetime not null -# communication_website_id :uuid not null, indexed -# university_id :uuid not null, indexed -# -# Indexes -# -# idx_comm_website_index_page_on_communication_website_id (communication_website_id) -# index_communication_website_index_pages_on_university_id (university_id) -# -# Foreign Keys -# -# fk_rails_5cd2482227 (communication_website_id => communication_websites.id) -# fk_rails_7eb45227ae (university_id => universities.id) -# -class Communication::Website::IndexPage::CommunicationPosts < Communication::Website::IndexPage - def self.polymorphic_name - 'Communication::Website::IndexPage::CommunicationPosts' - end - - def git_path(website) - 'content/posts/_index.html' - end - - def url - "/#{website.index_for(:communication_posts).path}/" - end - -end diff --git a/app/models/communication/website/index_page/education_programs.rb b/app/models/communication/website/index_page/education_programs.rb deleted file mode 100644 index 95dc357e043a235d654d22c7b81a0ce74f048a1a..0000000000000000000000000000000000000000 --- a/app/models/communication/website/index_page/education_programs.rb +++ /dev/null @@ -1,46 +0,0 @@ -# == Schema Information -# -# Table name: communication_website_index_pages -# -# id :uuid not null, primary key -# breadcrumb_title :string -# description :text -# featured_image_alt :string -# header_text :text -# kind :integer -# path :string -# text :text -# title :string -# created_at :datetime not null -# updated_at :datetime not null -# communication_website_id :uuid not null, indexed -# university_id :uuid not null, indexed -# -# Indexes -# -# idx_comm_website_index_page_on_communication_website_id (communication_website_id) -# index_communication_website_index_pages_on_university_id (university_id) -# -# Foreign Keys -# -# fk_rails_5cd2482227 (communication_website_id => communication_websites.id) -# fk_rails_7eb45227ae (university_id => universities.id) -# -class Communication::Website::IndexPage::EducationPrograms < Communication::Website::IndexPage - def self.polymorphic_name - 'Communication::Website::IndexPage::EducationPrograms' - end - - def git_path(website) - 'content/programs/_index.html' - end - - def url - "/#{path}/" - end - - def git_dependencies(website) - [self] + active_storage_blobs + website.education_programs - end - -end diff --git a/app/models/communication/website/index_page/home.rb b/app/models/communication/website/index_page/home.rb deleted file mode 100644 index 7c929c16e40ca31c022e2ddabb3652ce328cfad8..0000000000000000000000000000000000000000 --- a/app/models/communication/website/index_page/home.rb +++ /dev/null @@ -1,42 +0,0 @@ -# == Schema Information -# -# Table name: communication_website_index_pages -# -# id :uuid not null, primary key -# breadcrumb_title :string -# description :text -# featured_image_alt :string -# header_text :text -# kind :integer -# path :string -# text :text -# title :string -# created_at :datetime not null -# updated_at :datetime not null -# communication_website_id :uuid not null, indexed -# university_id :uuid not null, indexed -# -# Indexes -# -# idx_comm_website_index_page_on_communication_website_id (communication_website_id) -# index_communication_website_index_pages_on_university_id (university_id) -# -# Foreign Keys -# -# fk_rails_5cd2482227 (communication_website_id => communication_websites.id) -# fk_rails_7eb45227ae (university_id => universities.id) -# -class Communication::Website::IndexPage::Home < Communication::Website::IndexPage - def self.polymorphic_name - 'Communication::Website::IndexPage::Home' - end - - def git_path(website) - 'content/_index.html' - end - - def url - '/' - end - -end diff --git a/app/models/communication/website/index_page/persons.rb b/app/models/communication/website/index_page/persons.rb deleted file mode 100644 index d2f4063e745c3db34cff26cb04ddeeae6b421286..0000000000000000000000000000000000000000 --- a/app/models/communication/website/index_page/persons.rb +++ /dev/null @@ -1,42 +0,0 @@ -# == Schema Information -# -# Table name: communication_website_index_pages -# -# id :uuid not null, primary key -# breadcrumb_title :string -# description :text -# featured_image_alt :string -# header_text :text -# kind :integer -# path :string -# text :text -# title :string -# created_at :datetime not null -# updated_at :datetime not null -# communication_website_id :uuid not null, indexed -# university_id :uuid not null, indexed -# -# Indexes -# -# idx_comm_website_index_page_on_communication_website_id (communication_website_id) -# index_communication_website_index_pages_on_university_id (university_id) -# -# Foreign Keys -# -# fk_rails_5cd2482227 (communication_website_id => communication_websites.id) -# fk_rails_7eb45227ae (university_id => universities.id) -# -class Communication::Website::IndexPage::Persons < Communication::Website::IndexPage - def self.polymorphic_name - 'Communication::Website::IndexPage::Persons' - end - - def git_path(website) - 'content/persons/_index.html' - end - - def url - "/#{website.index_for(:persons).path}/" - end - -end diff --git a/app/models/communication/website/index_page/research_articles.rb b/app/models/communication/website/index_page/research_articles.rb deleted file mode 100644 index bcf97c7c8b0c16ae53f4cffeee4690c122335a55..0000000000000000000000000000000000000000 --- a/app/models/communication/website/index_page/research_articles.rb +++ /dev/null @@ -1,42 +0,0 @@ -# == Schema Information -# -# Table name: communication_website_index_pages -# -# id :uuid not null, primary key -# breadcrumb_title :string -# description :text -# featured_image_alt :string -# header_text :text -# kind :integer -# path :string -# text :text -# title :string -# created_at :datetime not null -# updated_at :datetime not null -# communication_website_id :uuid not null, indexed -# university_id :uuid not null, indexed -# -# Indexes -# -# idx_comm_website_index_page_on_communication_website_id (communication_website_id) -# index_communication_website_index_pages_on_university_id (university_id) -# -# Foreign Keys -# -# fk_rails_5cd2482227 (communication_website_id => communication_websites.id) -# fk_rails_7eb45227ae (university_id => universities.id) -# -class Communication::Website::IndexPage::ResearchArticles < Communication::Website::IndexPage - def self.polymorphic_name - 'Communication::Website::IndexPage::ResearchArticles' - end - - def git_path(website) - 'content/articles/_index.html' - end - - def url - "/#{website.index_for(:research_articles).path}/" - end - -end diff --git a/app/models/communication/website/index_page/research_volumes.rb b/app/models/communication/website/index_page/research_volumes.rb deleted file mode 100644 index 71c5ed187f10c0af487d32aef027566b2d0ca0bf..0000000000000000000000000000000000000000 --- a/app/models/communication/website/index_page/research_volumes.rb +++ /dev/null @@ -1,42 +0,0 @@ -# == Schema Information -# -# Table name: communication_website_index_pages -# -# id :uuid not null, primary key -# breadcrumb_title :string -# description :text -# featured_image_alt :string -# header_text :text -# kind :integer -# path :string -# text :text -# title :string -# created_at :datetime not null -# updated_at :datetime not null -# communication_website_id :uuid not null, indexed -# university_id :uuid not null, indexed -# -# Indexes -# -# idx_comm_website_index_page_on_communication_website_id (communication_website_id) -# index_communication_website_index_pages_on_university_id (university_id) -# -# Foreign Keys -# -# fk_rails_5cd2482227 (communication_website_id => communication_websites.id) -# fk_rails_7eb45227ae (university_id => universities.id) -# -class Communication::Website::IndexPage::ResearchVolumes < Communication::Website::IndexPage - def self.polymorphic_name - 'Communication::Website::IndexPage::ResearchVolumes' - end - - def git_path(website) - 'content/volumes/_index.html' - end - - def url - "/#{website.index_for(:research_volumes).path}/" - end - -end diff --git a/app/models/communication/website/index_page/researchers.rb b/app/models/communication/website/index_page/researchers.rb deleted file mode 100644 index 8fdf3b9532b4d6669b37c42ef9b275d1857deff0..0000000000000000000000000000000000000000 --- a/app/models/communication/website/index_page/researchers.rb +++ /dev/null @@ -1,42 +0,0 @@ -# == Schema Information -# -# Table name: communication_website_index_pages -# -# id :uuid not null, primary key -# breadcrumb_title :string -# description :text -# featured_image_alt :string -# header_text :text -# kind :integer -# path :string -# text :text -# title :string -# created_at :datetime not null -# updated_at :datetime not null -# communication_website_id :uuid not null, indexed -# university_id :uuid not null, indexed -# -# Indexes -# -# idx_comm_website_index_page_on_communication_website_id (communication_website_id) -# index_communication_website_index_pages_on_university_id (university_id) -# -# Foreign Keys -# -# fk_rails_5cd2482227 (communication_website_id => communication_websites.id) -# fk_rails_7eb45227ae (university_id => universities.id) -# -class Communication::Website::IndexPage::Researchers < Communication::Website::IndexPage - def self.polymorphic_name - 'Communication::Website::IndexPage::Researchers' - end - - def git_path(website) - 'content/researchers/_index.html' - end - - def url - "/#{website.index_for(:persons).path}/#{website.index_for(:researchers).path}/" - end - -end diff --git a/app/models/communication/website/index_page/teachers.rb b/app/models/communication/website/index_page/teachers.rb deleted file mode 100644 index d99383aee68768d76af15061f82ead229103aa0f..0000000000000000000000000000000000000000 --- a/app/models/communication/website/index_page/teachers.rb +++ /dev/null @@ -1,42 +0,0 @@ -# == Schema Information -# -# Table name: communication_website_index_pages -# -# id :uuid not null, primary key -# breadcrumb_title :string -# description :text -# featured_image_alt :string -# header_text :text -# kind :integer -# path :string -# text :text -# title :string -# created_at :datetime not null -# updated_at :datetime not null -# communication_website_id :uuid not null, indexed -# university_id :uuid not null, indexed -# -# Indexes -# -# idx_comm_website_index_page_on_communication_website_id (communication_website_id) -# index_communication_website_index_pages_on_university_id (university_id) -# -# Foreign Keys -# -# fk_rails_5cd2482227 (communication_website_id => communication_websites.id) -# fk_rails_7eb45227ae (university_id => universities.id) -# -class Communication::Website::IndexPage::Teachers < Communication::Website::IndexPage - def self.polymorphic_name - 'Communication::Website::IndexPage::Teachers' - end - - def git_path(website) - 'content/teachers/_index.html' - end - - def url - "/#{website.index_for(:persons).path}/#{website.index_for(:teachers).path}/" - end - -end diff --git a/app/models/communication/website/menu/item/with_targets.rb b/app/models/communication/website/menu/item/with_targets.rb index a23b3b758b16ab1192d6300e055e0a815b52351a..c70f22afe5966e5ceb484c0340771be73b23d7cc 100644 --- a/app/models/communication/website/menu/item/with_targets.rb +++ b/app/models/communication/website/menu/item/with_targets.rb @@ -16,58 +16,58 @@ module Communication::Website::Menu::Item::WithTargets end def target_for_programs - "/#{website.index_for(:education_programs).path}" + "#{website.special_page(:education_programs).path}" end def target_for_program - "/#{website.index_for(:education_programs).path}#{about.path}" + "#{website.special_page(:education_programs).path}#{about.path}" end def target_for_news - "/#{website.index_for(:communication_posts).path}" + "#{website.special_page(:communication_posts).path}" end def target_for_news_article - "/#{website.index_for(:communication_posts).path}#{about.path}" if about&.published && about&.published_at + "#{website.special_page(:communication_posts).path}#{about.path}" if about&.published && about&.published_at end def target_for_news_category - "/#{website.index_for(:communication_posts).path}#{about.path}" if about + "#{website.special_page(:communication_posts).path}#{about.path}" if about end def target_for_staff - "/#{website.index_for(:persons).path}" + "#{website.special_page(:persons).path}" end def target_for_administrators - "/#{website.index_for(:administrators).path}" + "#{website.special_page(:administrators).path}" end def target_for_authors - "/#{website.index_for(:authors).path}" + "#{website.special_page(:authors).path}" end def target_for_researchers - "/#{website.index_for(:researchers).path}" + "#{website.special_page(:researchers).path}" end def target_for_teachers - "/#{website.index_for(:teachers).path}" + "#{website.special_page(:teachers).path}" end def target_for_research_volumes - "/#{website.index_for(:research_volumes).path}" + "#{website.special_page(:research_volumes).path}" end def target_for_research_volume - "/#{website.index_for(:research_volumes).path}#{about.path}" if about&.published && about&.published_at + "#{website.special_page(:research_volumes).path}#{about.path}" if about&.published && about&.published_at end def target_for_research_articles - "/#{website.index_for(:research_articles).path}" + "#{website.special_page(:research_articles).path}" end def target_for_research_article - "/#{website.index_for(:research_articles).path}#{about.path}" if about&.published && about&.published_at + "#{website.special_page(:research_articles).path}#{about.path}" if about&.published && about&.published_at end end diff --git a/app/models/communication/website/page.rb b/app/models/communication/website/page.rb index 24e4499cf6350f122c24af56edd51b30c6e7d15d..ddd9a8b287dc227e419dc168ea583e20bf032dd3 100644 --- a/app/models/communication/website/page.rb +++ b/app/models/communication/website/page.rb @@ -3,12 +3,13 @@ # Table name: communication_website_pages # # id :uuid not null, primary key -# about_type :string indexed => [about_id] +# breadcrumb_title :string # description :text # description_short :text # featured_image_alt :string # github_path :text -# old_text :text +# header_text :text +# kind :integer # path :text # position :integer default(0), not null # published :boolean default(FALSE) @@ -17,7 +18,6 @@ # title :string # created_at :datetime not null # updated_at :datetime not null -# about_id :uuid indexed => [about_type] # communication_website_id :uuid not null, indexed # parent_id :uuid indexed # related_category_id :uuid indexed @@ -25,7 +25,6 @@ # # Indexes # -# index_communication_website_pages_on_about (about_type,about_id) # index_communication_website_pages_on_communication_website_id (communication_website_id) # index_communication_website_pages_on_parent_id (parent_id) # index_communication_website_pages_on_related_category_id (related_category_id) @@ -41,15 +40,15 @@ class Communication::Website::Page < ApplicationRecord include Sanitizable - include WithUniversity + include WithBlobs + include WithBlocks include WithGit include WithFeaturedImage - include WithBlobs + include WithKind include WithMenuItemTarget - include WithSlug # We override slug_unavailable? method - include WithTree include WithPosition - include WithBlocks + include WithTree + include WithUniversity has_summernote :text @@ -71,26 +70,42 @@ class Communication::Website::Page < ApplicationRecord validates :title, presence: true + validates :slug, presence: true, unless: :kind_home? + validate :slug_must_be_unique + validates :slug, format: { with: /\A[a-z0-9\-]+\z/, message: I18n.t('slug_error') }, unless: :kind_home? + + before_validation :check_slug, :make_path after_save :update_children_paths, if: :saved_change_to_path? scope :recent, -> { order(updated_at: :desc).limit(5) } + def generated_path + "#{parent&.path}/#{slug}".gsub(/\/+/, '/') + end + def git_path(website) - "content/pages/#{path}/_index.html" if published + return unless published + if is_special_page? && SPECIAL_PAGES_WITH_GIT_SPECIAL_PATH.include?(kind) + "content/#{kind.split('_').last}/_index.html" + else + "content/pages/#{path}/_index.html" + end end def git_dependencies(website) - [self] + - website.menus + - descendents + - active_storage_blobs + - siblings + - git_block_dependencies + dependencies = [self] + + website.menus + + descendants + + active_storage_blobs + + siblings + + git_block_dependencies + dependencies += website.education_programs if kind_education_programs? + dependencies end def git_destroy_dependencies(website) [self] + - descendents + + descendants + active_storage_blobs end @@ -128,18 +143,29 @@ class Communication::Website::Page < ApplicationRecord website.pages.where(parent_id: parent_id).ordered.last end + def check_slug + self.slug = to_s.parameterize if self.slug.blank? && !kind_home? + current_slug = self.slug + n = 0 + while slug_unavailable?(self.slug) + n += 1 + self.slug = [current_slug, n].join('-') + end + end + def slug_unavailable?(slug) - [ - website.index_for(:communication_posts).path, - website.index_for(:education_programs).path, - website.index_for(:persons).path, - website.index_for(:research_articles).path, - website.index_for(:research_volumes).path - ].include?(slug) || - self.class.unscoped - .where(communication_website_id: self.communication_website_id, slug: slug) - .where.not(id: self.id) - .exists? + self.class.unscoped + .where(communication_website_id: self.communication_website_id, slug: slug) + .where.not(id: self.id) + .exists? + end + + def make_path + self.path = kind_home? ? '/' : generated_path + end + + def slug_must_be_unique + errors.add(:slug, ActiveRecord::Errors.default_error_messages[:taken]) if slug_unavailable?(slug) end def explicit_blob_ids diff --git a/app/models/communication/website/page/with_kind.rb b/app/models/communication/website/page/with_kind.rb new file mode 100644 index 0000000000000000000000000000000000000000..667926934fe5380a9498a4679e9ac6ed815ec718 --- /dev/null +++ b/app/models/communication/website/page/with_kind.rb @@ -0,0 +1,53 @@ +module Communication::Website::Page::WithKind + extend ActiveSupport::Concern + + included do + + enum kind: { + home: 0, + communication_posts: 10, + education_programs: 20, + research_articles: 30, + research_volumes: 32, + legal_terms: 80, + sitemap: 81, + privacy_policy: 82, + persons: 100, + administrators: 110, + authors: 120, + researchers: 130, + teachers: 140 + }, _prefix: 'kind' + + SPECIAL_PAGES_WITH_GIT_SPECIAL_PATH = [ + 'communication_posts', + 'education_programs', + 'research_articles', + 'research_volumes', + 'persons', + 'administrators', + 'authors', + 'researchers', + 'teachers' + ].freeze + + after_create :move_legacy_root_pages, if: :kind_home? + + def is_special_page? + kind != nil + end + + def is_regular_page? + !is_special_page? + end + + end + + private + + def move_legacy_root_pages + root_pages = website.pages.where.not(id: id).root + root_pages.update_all(parent_id: id) + end + +end diff --git a/app/models/communication/website/post.rb b/app/models/communication/website/post.rb index 72910c15fe2c6f169dfe8886c1f850e1e3e1940d..2910fa4942632f594ed895395a0ce4ab34de648d 100644 --- a/app/models/communication/website/post.rb +++ b/app/models/communication/website/post.rb @@ -7,7 +7,6 @@ # description_short :text # featured_image_alt :string # github_path :text -# old_text :text # pinned :boolean default(FALSE) # published :boolean default(FALSE) # published_at :datetime @@ -94,7 +93,7 @@ class Communication::Website::Post < ApplicationRecord def url return unless published return if website.url.blank? - "#{website.url}#{website.index_for(:communication_posts).path}#{path}" + "#{website.url}#{website.special_page(:communication_posts).path}#{path}" end def to_s diff --git a/app/models/communication/website/with_dependencies.rb b/app/models/communication/website/with_dependencies.rb index 193fb1dd63e4bafde4880e76e7e3db8ff5b1c2aa..8e490602eac308b2d1c1ab9111ad3c29c71051a0 100644 --- a/app/models/communication/website/with_dependencies.rb +++ b/app/models/communication/website/with_dependencies.rb @@ -75,6 +75,23 @@ module Communication::Website::WithDependencies end end + # those tests has_xxx? should match the special page kind + def has_home? + true + end + + def has_legal_terms? + true + end + + def has_sitemap? + true + end + + def has_privacy_policy? + true + end + def has_communication_posts? posts.published.any? end @@ -87,7 +104,7 @@ module Communication::Website::WithDependencies authors.compact.any? end - def has_people? + def has_persons? has_authors? || has_administrators? || has_researchers? || has_teachers? end diff --git a/app/models/communication/website/with_index_pages.rb b/app/models/communication/website/with_index_pages.rb deleted file mode 100644 index d90ab37157e66cb9aafbca8feb72c674c7d14aee..0000000000000000000000000000000000000000 --- a/app/models/communication/website/with_index_pages.rb +++ /dev/null @@ -1,22 +0,0 @@ -module Communication::Website::WithIndexPages - extend ActiveSupport::Concern - - included do - has_many :index_pages, - class_name: 'Communication::Website::IndexPage', - foreign_key: :communication_website_id, - dependent: :destroy - - def index_for(kind) - klass = "Communication::Website::IndexPage::#{kind.to_s.camelize}".constantize - key = "communication.website.index_pages.default.#{kind.to_s}" - klass.where(communication_website_id: id, kind: kind).first_or_create( - title: I18n.t("#{key}.title"), - path: I18n.t("#{key}.path"), - description: I18n.t("#{key}.description"), - university_id: university_id - ) - end - end - -end diff --git a/app/models/communication/website/with_menu_items.rb b/app/models/communication/website/with_menu_items.rb index 6aefcc20c775a0187eaa31be77acaf452d3d2105..51818072c81d59137a0d1f35bc47f1c359479524 100644 --- a/app/models/communication/website/with_menu_items.rb +++ b/app/models/communication/website/with_menu_items.rb @@ -41,7 +41,7 @@ module Communication::Website::WithMenuItems end def menu_item_kind_staff? - has_people? + has_persons? end def menu_item_kind_administrators? diff --git a/app/models/communication/website/with_special_pages.rb b/app/models/communication/website/with_special_pages.rb new file mode 100644 index 0000000000000000000000000000000000000000..2b25ff672980cb19bb32673fef4d96ea150135b1 --- /dev/null +++ b/app/models/communication/website/with_special_pages.rb @@ -0,0 +1,85 @@ +module Communication::Website::WithSpecialPages + extend ActiveSupport::Concern + + included do + + after_create :create_missing_special_pages + after_touch :create_missing_special_pages, :manage_special_pages_publication + + def special_page(kind) + pages.where(kind: kind).first + end + + def create_missing_special_pages + homepage = create_special_page('home') + # first level pages with test + ['legal_terms', 'sitemap', 'privacy_policy', 'communication_posts', 'education_programs', 'research_articles', 'research_volumes'].each do |kind| + create_special_page(kind, homepage.id) if public_send("has_#{kind}?") + end + # team pages + if has_persons? + persons = create_special_page('persons', homepage.id) + ['administrators', 'authors', 'researchers', 'teachers'].each do |kind| + create_special_page(kind, persons.id) if public_send("has_#{kind}?") + end + end + end + + def manage_special_pages_publication + special_pages_keys.each do |kind| + published = public_send("has_#{kind}?") + special_page(kind).update(published: published) + end + end + + end + + private + + def create_special_page(kind, parent_id = nil) + i18n_key = "communication.website.pages.defaults.#{kind}" + # TODO: remove legacy after migrations + legacy_index_page = Communication::Website::IndexPage.where(communication_website_id: id, kind: kind).first + if legacy_index_page.present? + page = pages.where(kind: kind).first + unless page.present? + page = pages.create( + kind: kind, + title: legacy_index_page.title, + slug: legacy_index_page.path, + description_short: legacy_index_page.description, + parent_id: parent_id, + published: true, + university_id: university_id, + breadcrumb_title: legacy_index_page.breadcrumb_title, + featured_image_alt: legacy_index_page.featured_image_alt, + header_text: legacy_index_page.header_text, + text: legacy_index_page.text + ) + if legacy_index_page.featured_image.attached? + blob_to_duplicate = legacy_index_page.featured_image.blob + page.featured_image.attach( + io: URI.open(blob_to_duplicate.url), + filename: blob_to_duplicate.filename.to_s + ) + end + end + else + page = pages.where(kind: kind).first_or_create( + title: I18n.t("#{i18n_key}.title"), + slug: I18n.t("#{i18n_key}.slug"), + description_short: I18n.t("#{i18n_key}.description_short"), + parent_id: parent_id, + published: true, + university_id: university_id + ) + end + page + end + + def special_pages_keys + @special_pages_keys ||= pages.where.not(kind: nil).pluck(:kind).uniq + end + + +end diff --git a/app/models/communication/website/with_abouts.rb b/app/models/concerns/with_abouts.rb similarity index 77% rename from app/models/communication/website/with_abouts.rb rename to app/models/concerns/with_abouts.rb index b2871b99cd7a9da0c5f10801288079bfd6f79e97..55d5b9248d63c320926a1196bd6e30cfee7d5af8 100644 --- a/app/models/communication/website/with_abouts.rb +++ b/app/models/concerns/with_abouts.rb @@ -1,4 +1,4 @@ -module Communication::Website::WithAbouts +module WithAbouts extend ActiveSupport::Concern included do @@ -10,8 +10,9 @@ module Communication::Website::WithAbouts [ nil, Education::School.name, + Education::Program.name, Research::Laboratory.name, - Research::Journal.name + Research::Journal.name, ] end diff --git a/app/models/concerns/with_git.rb b/app/models/concerns/with_git.rb index 4d8fbe8f3ae3bc34e9c682882b989d058a0e82c1..99d3b266b773d9707305c27feea691120c48e512 100644 --- a/app/models/concerns/with_git.rb +++ b/app/models/concerns/with_git.rb @@ -37,6 +37,7 @@ module WithGit def sync_with_git websites_for_self.each do |website| + website.touch next unless website.git_repository.valid? dependencies = git_dependencies(website).to_a.flatten.uniq.compact dependencies.each do |object| diff --git a/app/models/concerns/with_tree.rb b/app/models/concerns/with_tree.rb index 9d15c5e8bd07259ed853c265a6588cc0d30f57fe..d07be887702a56d970d0907bb3c589a12c5eb84c 100644 --- a/app/models/concerns/with_tree.rb +++ b/app/models/concerns/with_tree.rb @@ -14,24 +14,24 @@ module WithTree end def ancestors - has_parent? ? parent.ancestors.push(parent) + has_parent? ? parent.ancestors.ordered.push(parent) : [] end - def descendents - has_children? ? children.map { |child| [child, child.descendents].flatten }.flatten + def descendants + has_children? ? children.ordered.map { |child| [child, child.descendants].flatten }.flatten : [] end def siblings - self.class.unscoped.where(parent: parent, university: university).where.not(id: id) + self.class.unscoped.where(parent: parent, university: university).where.not(id: id).ordered end def self_and_children(level) elements = [] label = " " * level + self.to_s elements << { label: label, id: self.id, parent_id: self.parent_id } - children.each do |child| + children.ordered.each do |child| elements.concat(child.self_and_children(level + 1)) end elements diff --git a/app/models/education/program.rb b/app/models/education/program.rb index aa7592f7986e139828c11ee40983c125fb4785ac..71b3a465147f9d8693da45f155efb954f4d914b4 100644 --- a/app/models/education/program.rb +++ b/app/models/education/program.rb @@ -44,6 +44,7 @@ # fk_rails_ec1f16f607 (parent_id => education_programs.id) # class Education::Program < ApplicationRecord + include Aboutable include Sanitizable include WithUniversity include WithGit @@ -177,6 +178,35 @@ class Education::Program < ApplicationRecord websites.find_each(&:set_programs_categories!) end + ##################### + # Aboutable methods # + ##################### + def has_administrators? + university_people_through_role_involvements.any? || + descendants.any? { |descendant| descendant.university_people_through_role_involvements.any? } + end + + def has_researchers? + false + end + + def has_teachers? + university_people_through_involvements.any? || + descendants.any? { |descendant| descendant.university_people_through_involvements.any? } + end + + def has_education_programs? + published? || descendants.any?(&:published?) + end + + def has_research_articles? + false + end + + def has_research_volumes? + false + end + protected def last_ordered_element diff --git a/app/models/education/school.rb b/app/models/education/school.rb index 6781044770a9c692b154b3a7d666871120c7883c..be2ac83e0609728e0bd926a35260c93e8ce789ab 100644 --- a/app/models/education/school.rb +++ b/app/models/education/school.rb @@ -109,6 +109,9 @@ class Education::School < ApplicationRecord dependencies end + ##################### + # Aboutable methods # + ##################### def has_administrators? university_people_through_role_involvements.any? || university_people_through_program_role_involvements.any? diff --git a/app/models/research/journal.rb b/app/models/research/journal.rb index f888d2538df4fe043fb2ea00f04f34bbbeb95b66..08cbbc495f5179431568c1c47663493c19fa4044 100644 --- a/app/models/research/journal.rb +++ b/app/models/research/journal.rb @@ -27,11 +27,11 @@ class Research::Journal < ApplicationRecord has_many :websites, class_name: 'Communication::Website', as: :about, dependent: :nullify has_many :volumes, foreign_key: :research_journal_id, dependent: :destroy - has_many :published_volumes, -> { published }, foreign_key: :research_journal_id, dependent: :destroy + has_many :published_volumes, -> { published }, class_name: 'Research::Journal::Volume', foreign_key: :research_journal_id, dependent: :destroy has_many :articles, foreign_key: :research_journal_id, dependent: :destroy - has_many :published_articles, -> { published }, foreign_key: :research_journal_id, dependent: :destroy + has_many :published_articles, -> { published }, class_name: 'Research::Journal::Article', foreign_key: :research_journal_id, dependent: :destroy has_many :people, -> { distinct }, through: :articles - has_many :people_through_published_articles, -> { distinct }, through: :published_articles + has_many :people_through_published_articles, -> { distinct }, through: :published_articles, source: :people scope :ordered, -> { order(:title) } @@ -59,6 +59,9 @@ class Research::Journal < ApplicationRecord [self] + articles + volumes end + ##################### + # Aboutable methods # + ##################### def has_administrators? false end diff --git a/app/models/research/journal/article.rb b/app/models/research/journal/article.rb index 4b2dbf5d18c4bf160fe7a74237b76eb3069073cb..40fa4544dc9b9fc82aecc134fa00e1b3ab551e77 100644 --- a/app/models/research/journal/article.rb +++ b/app/models/research/journal/article.rb @@ -4,6 +4,7 @@ # # id :uuid not null, primary key # abstract :text +# description :text # keywords :text # position :integer # published :boolean default(FALSE) diff --git a/app/models/research/journal/volume.rb b/app/models/research/journal/volume.rb index 669024489df736771e47d66d5f29ced058304df4..6b76d17061ec0edbbc5ef60fda61bb39598c6add 100644 --- a/app/models/research/journal/volume.rb +++ b/app/models/research/journal/volume.rb @@ -10,6 +10,7 @@ # published :boolean default(FALSE) # published_at :datetime # slug :string +# text :text # title :string # created_at :datetime not null # updated_at :datetime not null @@ -34,6 +35,8 @@ class Research::Journal::Volume < ApplicationRecord include WithFeaturedImage include WithSlug + has_summernote :text + belongs_to :journal, foreign_key: :research_journal_id has_many :articles, foreign_key: :research_journal_volume_id, dependent: :nullify has_many :websites, -> { distinct }, through: :journal diff --git a/app/models/user/with_person.rb b/app/models/user/with_person.rb index 063ea80f70c79639a05ba40e9865a7b2bd5cf1ad..730ff543ad60e056e5f30653ba95b3596bea6696 100644 --- a/app/models/user/with_person.rb +++ b/app/models/user/with_person.rb @@ -4,7 +4,7 @@ module User::WithPerson included do has_one :person, class_name: 'University::Person', dependent: :nullify - after_create_commit :find_or_create_person + after_create_commit :find_or_create_person unless :server_admin? end protected diff --git a/app/views/admin/communication/_abouts.html.erb b/app/views/admin/communication/_abouts.html.erb new file mode 100644 index 0000000000000000000000000000000000000000..f236cd7d2f0a741e8382b9b6aba866dfe3eec102 --- /dev/null +++ b/app/views/admin/communication/_abouts.html.erb @@ -0,0 +1,41 @@ +<%= f.input :about_type, + collection: Communication::Website.about_types, + input_html: { data: { conditional: true }, id: "about_type" }, + label_method: lambda { |object| + I18n.t("#{i18n_key}#{object}") + }, + include_blank: false %> +<div class="d-none" + data-conditional-source="about_type" + data-conditional-value="Education::School"> + <%= f.input :about_id, + collection: current_university.education_schools.ordered, + label: Education::School.model_name.human, + include_blank: false %> +</div> +<div class="d-none" + data-conditional-source="about_type" + data-conditional-value="Education::Program"> + <%= f.input :about_id, + collection: collection_tree(current_university.education_programs), + label: Education::Program.model_name.human, + label_method: ->(p) { sanitize p[:label] }, + value_method: ->(p) { p[:id] }, + include_blank: false %> +</div> +<div class="d-none" + data-conditional-source="about_type" + data-conditional-value="Research::Journal"> + <%= f.input :about_id, + collection: current_university.research_journals, + label: Research::Journal.model_name.human, + include_blank: false %> +</div> +<div class="d-none" + data-conditional-source="about_type" + data-conditional-value="Research::Laboratory"> + <%= f.input :about_id, + collection: current_university.research_laboratories, + label: Research::Laboratory.model_name.human, + include_blank: false %> +</div> diff --git a/app/views/admin/communication/blocks/_list.html.erb b/app/views/admin/communication/blocks/_list.html.erb index 5600bb047c83e8a5862efbae48a64e111ff25f97..ad44cee9ff9fc0c71b8e70cf229d7632d505e4c9 100644 --- a/app/views/admin/communication/blocks/_list.html.erb +++ b/app/views/admin/communication/blocks/_list.html.erb @@ -13,7 +13,7 @@ <thead> <tr> <th width="20" class="ps-0"> </th> - <th><%= Communication::Block.human_attribute_name('name') %></th> + <th><%= Communication::Block.human_attribute_name('title') %></th> <th><%= Communication::Block.human_attribute_name('template') %></th> <th></th> </tr> diff --git a/app/views/admin/communication/extranets/_form.html.erb b/app/views/admin/communication/extranets/_form.html.erb index bcd279d9ffa618ad56fafa8680f599cfabc4c410..c1d3e253a04e72f3221b7ca89cb4eb748dd76c00 100644 --- a/app/views/admin/communication/extranets/_form.html.erb +++ b/app/views/admin/communication/extranets/_form.html.erb @@ -8,7 +8,7 @@ <div class="card-body"> <%= f.input :name %> <%= f.input :domain %> - + <%= render 'admin/communication/abouts', f: f, i18n_key: 'activerecord.attributes.communication/extranet.about_' %> </div> </div> </div> @@ -23,7 +23,6 @@ input_html: { accept: '.jpg,.jpeg,.png,.svg' }, preview: 200, direct_upload: true %> - </div> </div> </div> diff --git a/app/views/admin/communication/extranets/index.html.erb b/app/views/admin/communication/extranets/index.html.erb index 94ba7170829cd03ec1157b54785b6d814fe17d3d..5a83cd771fb1dd1cba9de0a92262a70f34f43302 100644 --- a/app/views/admin/communication/extranets/index.html.erb +++ b/app/views/admin/communication/extranets/index.html.erb @@ -3,8 +3,11 @@ <table class="<%= table_classes %>"> <thead> <tr> - <th><%= Communication::Website.human_attribute_name('name') %></th> - <th><%= Communication::Website.human_attribute_name('url') %></th> + <th><%= Communication::Extranet.human_attribute_name('name') %></th> + <th><%= Communication::Extranet.human_attribute_name('domain') %></th> + <th><%= Communication::Extranet.human_attribute_name('about_type') %></th> + <th><%= Communication::Extranet.human_attribute_name('about') %></th> + <th></th> <th></th> </tr> </thead> @@ -13,6 +16,8 @@ <tr> <td><%= link_to extranet, [:admin, extranet] %></td> <td><%= link_to extranet.url, extranet.url, target: :_blank %></td> + <td><%= I18n.t("activerecord.attributes.communication/extranet.about_#{extranet.about_type}") %></td> + <td><%= link_to extranet.about, [:admin, extranet.about] if extranet.about %></td> <td class="text-end"> <div class="btn-group" role="group"> <%= edit_link extranet %> diff --git a/app/views/admin/communication/extranets/show.html.erb b/app/views/admin/communication/extranets/show.html.erb index c2ce9ea944e5c45dd612257f2c26632899a2d777..2569f1707d1d78be6387188287de3106bdb88c0f 100644 --- a/app/views/admin/communication/extranets/show.html.erb +++ b/app/views/admin/communication/extranets/show.html.erb @@ -1,8 +1,14 @@ <% content_for :title, @extranet %> <% content_for :title_right do %> - <%= link_to @extranet.url, @extranet.url, target: :_blank %> -<% end unless @extranet.url.blank? %> + <% unless @extranet.url.blank? %> + <%= link_to @extranet.url, @extranet.url, target: :_blank %><br> + <% end %> + <%= I18n.t("activerecord.attributes.communication/extranet.about_#{@extranet.about_type}") %> + <% if @extranet.about %> + (<%= link_to @extranet.about, [:admin, @extranet.about] unless @extranet.about.nil? %>) + <% end %> +<% end %> <% content_for :action_bar_right do %> <%= edit_link @extranet %> diff --git a/app/views/admin/communication/website/categories/_form.html.erb b/app/views/admin/communication/website/categories/_form.html.erb index 6fa1142149b0703e0855e2d88ed0451c2912b511..62dca15c8d6907d6af06c91c1f6968e5d094cb9a 100644 --- a/app/views/admin/communication/website/categories/_form.html.erb +++ b/app/views/admin/communication/website/categories/_form.html.erb @@ -7,7 +7,6 @@ </div> <div class="card-body"> <%= f.input :name %> - <%= f.input :description %> <%= f.input :text, as: :summernote %> </div> </div> @@ -47,6 +46,14 @@ <%= f.input :featured_image_alt %> </div> </div> + <div class="card flex-fill w-100"> + <div class="card-header"> + <h5 class="card-title mb-0"><%= t('seo') %></h5> + </div> + <div class="card-body"> + <%= f.input :description %> + </div> + </div> </div> </div> <% content_for :action_bar_right do %> diff --git a/app/views/admin/communication/website/categories/show.html.erb b/app/views/admin/communication/website/categories/show.html.erb index a5b6bf332df3c6646881154162e30307ea20b801..569001f70f81fbc29aa2995d309a0bb886c81203 100644 --- a/app/views/admin/communication/website/categories/show.html.erb +++ b/app/views/admin/communication/website/categories/show.html.erb @@ -8,8 +8,6 @@ <h2 class="card-title mb-0 h5"><%= t('content') %></h2> </div> <div class="card-body"> - <h3 class="h5"><%= Communication::Website::Category.human_attribute_name('description') %></h3> - <p><%= sanitize @category.description %></p> <h3 class="h5"><%= Communication::Website::Category.human_attribute_name('text') %></h3> <%= sanitize @category.text %> </div> @@ -57,6 +55,17 @@ </div> </div> <% end %> + <% if @category.description.present? %> + <div class="card flex-fill w-100"> + <div class="card-header"> + <h5 class="card-title mb-0"><%= t('seo') %></h5> + </div> + <div class="card-body"> + <h3 class="h5"><%= Communication::Website::Category.human_attribute_name('description') %></h3> + <%= simple_format @category.description %> + </div> + </div> + <% end %> </div> </div> <% if @posts.total_count > 0 %> diff --git a/app/views/admin/communication/website/configs/permalinks/static.html.erb b/app/views/admin/communication/website/configs/permalinks/static.html.erb index bd2143afd03e6b9edf63bc81ba4497ed4e1b08d2..f92b0bae0a18feb5ee151e49c1c1abca33a648c8 100644 --- a/app/views/admin/communication/website/configs/permalinks/static.html.erb +++ b/app/views/admin/communication/website/configs/permalinks/static.html.erb @@ -1,22 +1,22 @@ <% if @website.has_communication_posts? %> -posts: /<%= @website.index_for(:communication_posts).path %>/:year/:month/:day/:slug/ +posts: <%= @website.special_page(:communication_posts).path %>/:year/:month/:day/:slug/ <% end %> <% if @website.has_communication_categories? %> -categories: /<%= @website.index_for(:communication_posts).path %>/:slug/ +categories: <%= @website.special_page(:communication_posts).path %>/:slug/ <% end %> -<% if @website.has_people? %> -persons: /<%= @website.index_for(:persons).path %>/:slug/ +<% if @website.has_persons? %> +persons: <%= @website.special_page(:persons).path %>/:slug/ <% end %> <% if @website.has_authors? %> -authors: /<%= @website.index_for(:persons).path %>/:slug/<%= @website.index_for(:communication_posts).path %>/ +authors: /<%= @website.special_page(:persons).path %>/:slug/<%= @website.special_page(:communication_posts).slug %>/ <% end %> <%# ces paths complémentaires sont nécessairesà Hugo mais on ne les utilise pas %> <% if @website.has_administrators? %> -administrators: /<%= @website.index_for(:persons).path %>/:slug/roles/ +administrators: /<%= @website.special_page(:persons).path %>/:slug/roles/ <% end %> <% if @website.has_teachers? %> -teachers: /<%= @website.index_for(:persons).path %>/:slug/programs/ +teachers: /<%= @website.special_page(:persons).path %>/:slug/programs/ <% end %> <% if @website.has_researchers? %> -researchers: /<%= @website.index_for(:persons).path %>/:slug/articles/ +researchers: /<%= @website.special_page(:persons).path %>/:slug/articles/ <% end %> diff --git a/app/views/admin/communication/website/index_page/_static.html.erb b/app/views/admin/communication/website/index_page/_static.html.erb deleted file mode 100644 index 570195e81ad1d34d078bd644fb5a678e32a21749..0000000000000000000000000000000000000000 --- a/app/views/admin/communication/website/index_page/_static.html.erb +++ /dev/null @@ -1,15 +0,0 @@ ---- -title: > - <%= @about.title %> -breadcrumb_title: "<%= @about.breadcrumb_title.blank? ? @about.title : @about.breadcrumb_title %>" -url: <%= @about.url %> -<% if @about.featured_image.attached? %> -image: "<%= @about.featured_image.blob.id %>" -image_alt: "<%= @about.featured_image_alt %>" -<% end %> -description: > - <%= prepare_text_for_static @about.description %> -header_text: > - <%= prepare_html_for_static @about.header_text, @website.university %> ---- -<%= prepare_html_for_static @about.text, @website.university %> diff --git a/app/views/admin/communication/website/index_page/administrators/static.html.erb b/app/views/admin/communication/website/index_page/administrators/static.html.erb deleted file mode 100644 index 0042b13cee883af590932bf8edce6224b38ed268..0000000000000000000000000000000000000000 --- a/app/views/admin/communication/website/index_page/administrators/static.html.erb +++ /dev/null @@ -1 +0,0 @@ -<%= render 'admin/communication/website/index_page/static' %> diff --git a/app/views/admin/communication/website/index_page/authors/static.html.erb b/app/views/admin/communication/website/index_page/authors/static.html.erb deleted file mode 100644 index 0042b13cee883af590932bf8edce6224b38ed268..0000000000000000000000000000000000000000 --- a/app/views/admin/communication/website/index_page/authors/static.html.erb +++ /dev/null @@ -1 +0,0 @@ -<%= render 'admin/communication/website/index_page/static' %> diff --git a/app/views/admin/communication/website/index_page/communication_posts/static.html.erb b/app/views/admin/communication/website/index_page/communication_posts/static.html.erb deleted file mode 100644 index 0042b13cee883af590932bf8edce6224b38ed268..0000000000000000000000000000000000000000 --- a/app/views/admin/communication/website/index_page/communication_posts/static.html.erb +++ /dev/null @@ -1 +0,0 @@ -<%= render 'admin/communication/website/index_page/static' %> diff --git a/app/views/admin/communication/website/index_page/education_programs/static.html.erb b/app/views/admin/communication/website/index_page/education_programs/static.html.erb deleted file mode 100644 index 0042b13cee883af590932bf8edce6224b38ed268..0000000000000000000000000000000000000000 --- a/app/views/admin/communication/website/index_page/education_programs/static.html.erb +++ /dev/null @@ -1 +0,0 @@ -<%= render 'admin/communication/website/index_page/static' %> diff --git a/app/views/admin/communication/website/index_page/homes/static.html.erb b/app/views/admin/communication/website/index_page/homes/static.html.erb deleted file mode 100644 index 0042b13cee883af590932bf8edce6224b38ed268..0000000000000000000000000000000000000000 --- a/app/views/admin/communication/website/index_page/homes/static.html.erb +++ /dev/null @@ -1 +0,0 @@ -<%= render 'admin/communication/website/index_page/static' %> diff --git a/app/views/admin/communication/website/index_page/persons/static.html.erb b/app/views/admin/communication/website/index_page/persons/static.html.erb deleted file mode 100644 index 0042b13cee883af590932bf8edce6224b38ed268..0000000000000000000000000000000000000000 --- a/app/views/admin/communication/website/index_page/persons/static.html.erb +++ /dev/null @@ -1 +0,0 @@ -<%= render 'admin/communication/website/index_page/static' %> diff --git a/app/views/admin/communication/website/index_page/research_articles/static.html.erb b/app/views/admin/communication/website/index_page/research_articles/static.html.erb deleted file mode 100644 index 0042b13cee883af590932bf8edce6224b38ed268..0000000000000000000000000000000000000000 --- a/app/views/admin/communication/website/index_page/research_articles/static.html.erb +++ /dev/null @@ -1 +0,0 @@ -<%= render 'admin/communication/website/index_page/static' %> diff --git a/app/views/admin/communication/website/index_page/research_volumes/static.html.erb b/app/views/admin/communication/website/index_page/research_volumes/static.html.erb deleted file mode 100644 index 0042b13cee883af590932bf8edce6224b38ed268..0000000000000000000000000000000000000000 --- a/app/views/admin/communication/website/index_page/research_volumes/static.html.erb +++ /dev/null @@ -1 +0,0 @@ -<%= render 'admin/communication/website/index_page/static' %> diff --git a/app/views/admin/communication/website/index_page/researchers/static.html.erb b/app/views/admin/communication/website/index_page/researchers/static.html.erb deleted file mode 100644 index 0042b13cee883af590932bf8edce6224b38ed268..0000000000000000000000000000000000000000 --- a/app/views/admin/communication/website/index_page/researchers/static.html.erb +++ /dev/null @@ -1 +0,0 @@ -<%= render 'admin/communication/website/index_page/static' %> diff --git a/app/views/admin/communication/website/index_page/teachers/static.html.erb b/app/views/admin/communication/website/index_page/teachers/static.html.erb deleted file mode 100644 index 0042b13cee883af590932bf8edce6224b38ed268..0000000000000000000000000000000000000000 --- a/app/views/admin/communication/website/index_page/teachers/static.html.erb +++ /dev/null @@ -1 +0,0 @@ -<%= render 'admin/communication/website/index_page/static' %> diff --git a/app/views/admin/communication/website/index_pages/edit.html.erb b/app/views/admin/communication/website/index_pages/edit.html.erb deleted file mode 100644 index 4eaf6be10a3cb0350baaf5e4d1b54303d2f188b5..0000000000000000000000000000000000000000 --- a/app/views/admin/communication/website/index_pages/edit.html.erb +++ /dev/null @@ -1,61 +0,0 @@ -<% content_for :title, t("communication.website.index_pages.default.#{@index_page.kind}.title") %> - -<%= render 'admin/communication/websites/sidebar' do %> - - <%= simple_form_for @index_page, url: admin_communication_website_index_path(website_id: @website.id, kind: @index_page.kind) do |f| %> - <div class="row"> - <div class="col-md-8"> - <div class="card flex-fill w-100"> - <div class="card-header"> - <h5 class="card-title mb-0"><%= t('content') %></h5> - </div> - <div class="card-body"> - <%= f.input :title, input_html: { name: 'communication_website_index_page[title]', id: 'communication_website_index_page_title' } %> - <%= f.input :path, - required: true, - input_html: { - name: 'communication_website_index_page[path]', - class: 'js-slug-input', - data: { source: '#communication_website_index_page_title' } - } unless @index_page.home? %> - <%= f.input :breadcrumb_title, - input_html: { name: 'communication_website_index_page[breadcrumb_title]' }, - hint: t('simple_form.hints.communication_website_index_page.breadcrumb_title') %> - <%= f.input :description, input_html: { name: 'communication_website_index_page[description]' } %> - <%= f.input :header_text, - as: :summernote, - input_html: { - name: 'communication_website_index_page[header_text]', - data: { 'summernote-config' => 'mini' } - } %> - <%= f.input :text, as: :summernote, input_html: { name: 'communication_website_index_page[text]' } %> - </div> - </div> - </div> - <div class="col-md-4"> - <div class="card flex-fill w-100"> - <div class="card-header"> - <h5 class="card-title mb-0"><%= t('activerecord.attributes.communication/website/page.featured_image') %></h5> - </div> - <div class="card-body"> - <%= f.input :featured_image, - as: :single_deletable_file, - direct_upload: true, - label: false, - input_html: { - accept: '.jpg,.jpeg,.png', - name: 'communication_website_index_page[featured_image]' - }, - preview: true - %> - <%= f.input :featured_image_alt, input_html: { name: 'communication_website_index_page[featured_image_alt]' } %> - </div> - </div> - </div> - </div> - <% content_for :action_bar_right do %> - <%= submit f %> - <% end %> - <% end %> - -<% 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 deleted file mode 100644 index 8b5faee66f9adb59eb52a2b02318171126017915..0000000000000000000000000000000000000000 --- a/app/views/admin/communication/website/index_pages/index.html.erb +++ /dev/null @@ -1,30 +0,0 @@ -<% content_for :title, t('activerecord.models.communication/website/index_page.other') %> - -<%= render 'admin/communication/websites/sidebar' do %> - - <div class="row"> - <% @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.#{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(kind).title %> - </p> - <% end %> - <p class="text-muted small"> - <%= @website.index_for(kind).description %> - </p> - <div class="text-end"> - <%= link_to t("edit"), - admin_communication_website_index_path(website_id: @website.id, kind: kind), - class: button_classes('stretched-link') %> - </div> - </div> - </div> - </div> - <% end %> - </div> - -<% end %> diff --git a/app/views/admin/communication/website/pages/_form.html.erb b/app/views/admin/communication/website/pages/_form.html.erb index 06ac463306ef7bd1774aa7566290de62ee3a5292..7846ec1ef9f4b05bcbffae6a91363c8628451ab7 100644 --- a/app/views/admin/communication/website/pages/_form.html.erb +++ b/app/views/admin/communication/website/pages/_form.html.erb @@ -7,37 +7,44 @@ </div> <div class="card-body"> <%= f.input :title %> - <%= f.input :description %> + <%= f.input :breadcrumb_title %> <%= f.input :description_short %> + <%= f.input :header_text, + as: :summernote, + input_html: { + data: { 'summernote-config' => 'mini' } + } %> <%= f.input :text, as: :summernote %> <%= f.association :related_category, collection: collection_tree(@website.categories), label_method: ->(p) { sanitize p[:label] }, - value_method: ->(p) { p[:id] } if @website.categories.any? %> + value_method: ->(p) { p[:id] } if @website.categories.any? && page.is_regular_page? %> </div> </div> </div> <div class="col-md-4"> - <div class="card flex-fill w-100"> - <div class="card-header"> - <h5 class="card-title mb-0"><%= t('metadata') %></h5> + <% unless page.kind_home? %> + <div class="card flex-fill w-100"> + <div class="card-header"> + <h5 class="card-title mb-0"><%= t('metadata') %></h5> + </div> + <div class="card-body"> + <%= f.input :slug, + as: :string, + required: true, + input_html: page.persisted? ? {} : { + class: 'js-slug-input', + data: { source: '#communication_website_page_title' } + } unless page.kind_home? %> + <%= f.input :published if page.is_regular_page? %> + <%= f.association :parent, + collection: collection_tree(@website.pages, page), + include_blank: false, + label_method: ->(p) { sanitize p[:label] }, + value_method: ->(p) { p[:id] } unless page.kind_home? %> + </div> </div> - <div class="card-body"> - <%= f.input :slug, - as: :string, - input_html: page.persisted? ? {} : { - class: 'js-slug-input', - data: { source: '#communication_website_page_title' } - } %> - <%= f.input :published %> - <%= f.association :parent, - collection: collection_tree(@website.pages, page), - label_method: ->(p) { sanitize p[:label] }, - value_method: ->(p) { p[:id] } %> - <ul> - </ul> - </div> - </div> + <% end %> <div class="card flex-fill w-100"> <div class="card-header"> <h5 class="card-title mb-0"><%= t('activerecord.attributes.communication/website/page.featured_image') %></h5> @@ -53,6 +60,15 @@ <%= f.input :featured_image_alt %> </div> </div> + <div class="card flex-fill w-100"> + <div class="card-header"> + <h5 class="card-title mb-0"><%= t('seo') %></h5> + </div> + <div class="card-body"> + <%= f.input :description %> + </div> + </div> + </div> </div> </div> <% content_for :action_bar_right do %> diff --git a/app/views/admin/communication/website/pages/_treebranch.html.erb b/app/views/admin/communication/website/pages/_treebranch.html.erb index d3e6569796bf413d97bc2f5af813c5837f776fe7..2958456fd3882d3b4a6a5f63f06d3dc2efc861ba 100644 --- a/app/views/admin/communication/website/pages/_treebranch.html.erb +++ b/app/views/admin/communication/website/pages/_treebranch.html.erb @@ -15,7 +15,9 @@ <%= link_to page, admin_communication_website_page_path(website_id: page.website.id, id: page.id), class: "#{'opacity-50' unless page.published?}" %> - <span class="move_btn py-2 ps-2"><i class="fas fa-sort"></i></span> + <% unless page.kind_home? %> + <span class="move_btn py-2 ps-2"><i class="fas fa-sort"></i></span> + <% end %> <%= link_to children_admin_communication_website_page_path(website_id: page.website.id, id: page.id), class: 'js-treeview-openzone small ps-2', remote: true do %> <span class="open_text"><%= t 'folder.open' %></span> @@ -23,7 +25,7 @@ <% end %> <div class="btn-group ms-auto" role="group"> <%= edit_link page %> - <%= destroy_link page, confirm_message: page.children.any? ? t('please_confirm_with_children') : t('please_confirm') %> + <%= destroy_link page, confirm_message: page.children.any? ? t('please_confirm_with_children') : t('please_confirm') if page.is_regular_page? %> </div> </div> <ul class="list-unstyled treeview__children js-treeview-children <%= 'js-treeview-sortable-container' if can?(:reorder, page) %> ms-4" data-id="<%= page.id %>"> diff --git a/app/views/admin/communication/website/pages/index.html.erb b/app/views/admin/communication/website/pages/index.html.erb index 296d0c46f3477c46819ffb97cea0cc5b0cc1e25a..1821044eaafcd7de7b63e4aaddf195313391345c 100644 --- a/app/views/admin/communication/website/pages/index.html.erb +++ b/app/views/admin/communication/website/pages/index.html.erb @@ -3,10 +3,27 @@ <%= render 'admin/communication/websites/sidebar' do %> <div class="card"> <div class="card-body"> - <ul class="list-unstyled treeview js-treeview <%= 'treeview--sortable js-treeview-sortable js-treeview-sortable-container' if can?(:reorder, @root_pages.first) %>" - data-id="" - data-sort-url="<%= reorder_admin_communication_website_pages_path %>"> - <%= render 'treebranch', pages: @root_pages %> + <ul class="list-unstyled treeview"> + <li class="treeview__element treeview__element--opened treeview__element--loaded" data-id="<%= @homepage.id %>" data-parent=""> + <div class="d-flex align-items-center treeview__label border-bottom p-1"> + <div class="d-inline-block p-2 ps-0" style="width: 22px"> + <span class="close_btn text-primary"> + <i class="close_btn--with_children fas fa-folder-open"></i> + </span> + </div> + <%= link_to @homepage, + admin_communication_website_page_path(website_id: @homepage.website.id, id: @homepage.id) + %> + <div class="btn-group ms-auto" role="group"> + <%= edit_link @homepage %> + </div> + </div> + <ul class="list-unstyled ms-4 treeview__children js-treeview <%= 'treeview--sortable js-treeview-sortable js-treeview-sortable-container' if can?(:reorder, @homepage) %>" + data-id="<%= @homepage.id %>" + data-sort-url="<%= reorder_admin_communication_website_pages_path %>"> + <%= render 'treebranch', pages: @first_level_pages %> + </ul> + </li> </ul> </div> </div> diff --git a/app/views/admin/communication/website/pages/show.html.erb b/app/views/admin/communication/website/pages/show.html.erb index 8522695fb5c41da445144963bf6906097deca556..d4cf76214d81dd2fa144f240aea015a0ec80b156 100644 --- a/app/views/admin/communication/website/pages/show.html.erb +++ b/app/views/admin/communication/website/pages/show.html.erb @@ -9,7 +9,6 @@ <h2 class="card-title mb-0 h5"><%= t('content') %></h2> </div> <div class="card-body"> - <%= render 'admin/application/property/text', object: @page, property: :description %> <%= render 'admin/application/property/text', object: @page, property: :description_short %> <%= render 'admin/application/property/text', object: @page, property: :text %> </div> @@ -30,8 +29,10 @@ <h2 class="card-title mb-0 h5"><%= t('metadata') %></h2> </div> <div class="card-body"> - <h3 class="h5"><%= Communication::Website::Page.human_attribute_name('slug') %></h3> - <p><%= @page.slug %></p> + <% unless @page.slug.blank? %> + <h3 class="h5"><%= Communication::Website::Page.human_attribute_name('slug') %></h3> + <p><%= @page.slug %></p> + <% end %> <h3 class="h5"><%= Communication::Website::Page.human_attribute_name('path') %></h3> <p><%= @page.path %></p> <h3 class="h5"><%= Communication::Website::Page.human_attribute_name('published') %></h3> @@ -58,7 +59,7 @@ <% if @page.children.any? %> <h3 class="h5"><%= Communication::Website::Page.human_attribute_name('children') %></h3> <ul class="list-unstyled mb-0"> - <% @page.children.each do |child| %> + <% @page.children.ordered.each do |child| %> <li> <%= link_to_if can?(:read, child), child, @@ -80,6 +81,17 @@ </div> </div> <% end %> + <% if @page.description.present? %> + <div class="card flex-fill w-100"> + <div class="card-header"> + <h5 class="card-title mb-0"><%= t('seo') %></h5> + </div> + <div class="card-body"> + <h3 class="h5"><%= Communication::Website::Page.human_attribute_name('description') %></h3> + <%= simple_format @page.description %> + </div> + </div> + <% end %> </div> </div> <% end %> @@ -89,7 +101,7 @@ <% end %> <% content_for :action_bar_left do %> - <%= destroy_link @page %> + <%= destroy_link @page if @page.is_regular_page? %> <%= link_to t('static'), static_admin_communication_website_page_path(@page), class: button_classes('btn-light') if current_user.server_admin? %> diff --git a/app/views/admin/communication/website/pages/static.html.erb b/app/views/admin/communication/website/pages/static.html.erb index ac51c4aa5fc7e8b70f42a8b1832b90e4271d7fd6..159cccbde8f7ced2194b077bbe73d6ede455f10c 100644 --- a/app/views/admin/communication/website/pages/static.html.erb +++ b/app/views/admin/communication/website/pages/static.html.erb @@ -1,7 +1,8 @@ --- title: > <%= @about.title %> -url: "<%= @about.path %>/" +breadcrumb_title: "<%= @about.breadcrumb_title.blank? ? @about.title : @about.breadcrumb_title %>" +url: "<%= @about.path unless @about.kind_home? %>/" position: <%= @about.position %> <% if @about.best_featured_image.attached? %> image: "<%= @about.best_featured_image.blob.id %>" @@ -14,6 +15,8 @@ description: > <%= prepare_text_for_static @about.description %> description_short: > <%= prepare_text_for_static @about.description_short %> +header_text: > + <%= prepare_html_for_static @about.header_text, @website.university %> <%= render 'admin/communication/blocks/static', about: @about %> --- <%= prepare_html_for_static @about.text, @about.university %> diff --git a/app/views/admin/communication/website/posts/_form.html.erb b/app/views/admin/communication/website/posts/_form.html.erb index 9965c8536f358ceb37f6cf697cdc5d73b43806c3..6ef3fd5d9dc249c5ddcf0f42fc530f4165006e2b 100644 --- a/app/views/admin/communication/website/posts/_form.html.erb +++ b/app/views/admin/communication/website/posts/_form.html.erb @@ -7,7 +7,6 @@ </div> <div class="card-body"> <%= f.input :title %> - <%= f.input :description %> <%= f.input :description_short %> <%= f.input :text, as: :summernote %> </div> @@ -57,6 +56,14 @@ <%= f.input :featured_image_alt %> </div> </div> + <div class="card flex-fill w-100"> + <div class="card-header"> + <h5 class="card-title mb-0"><%= t('seo') %></h5> + </div> + <div class="card-body"> + <%= f.input :description %> + </div> + </div> </div> </div> <% content_for :action_bar_right do %> diff --git a/app/views/admin/communication/website/posts/show.html.erb b/app/views/admin/communication/website/posts/show.html.erb index ba186de893e773502f618479fb0765eaae02e762..732c06463116c75af776182bbad9cef574b37f19 100644 --- a/app/views/admin/communication/website/posts/show.html.erb +++ b/app/views/admin/communication/website/posts/show.html.erb @@ -8,11 +8,9 @@ <h2 class="card-title mb-0 h5"><%= t('content') %></h2> </div> <div class="card-body"> - <%= render 'admin/application/property/text', object: @post, property: :description %> <%= render 'admin/application/property/text', object: @post, property: :description_short %> <%= render 'admin/application/property/text', object: @post, property: :text %> <%= render 'admin/application/property/summernote_embeds', object: @post, property: :medias %> - <p><%= prepare_text_for_static @post.description %></p> </div> </div> </div> @@ -64,6 +62,17 @@ </div> </div> <% end %> + <% if @post.description.present? %> + <div class="card flex-fill w-100"> + <div class="card-header"> + <h5 class="card-title mb-0"><%= t('seo') %></h5> + </div> + <div class="card-body"> + <h3 class="h5"><%= Communication::Website::Post.human_attribute_name('description') %></h3> + <%= simple_format @post.description %> + </div> + </div> + <% end %> </div> </div> <% end %> diff --git a/app/views/admin/communication/websites/_form.html.erb b/app/views/admin/communication/websites/_form.html.erb index 0c21118ca61b6d3f4fdbf48e47dc6c70968f240d..d1d031fc376d11cd812e4c43788ecf932e24e8a1 100644 --- a/app/views/admin/communication/websites/_form.html.erb +++ b/app/views/admin/communication/websites/_form.html.erb @@ -8,37 +8,7 @@ <div class="card-body"> <%= f.input :name %> <%= f.input :url %> - <%= f.input :about_type, - collection: Communication::Website.about_types, - input_html: { data: { conditional: true } }, - label_method: lambda { |object| - I18n.t("activerecord.attributes.communication/website.about_#{object}") - }, - include_blank: false %> - <div class="d-none" - data-conditional-source="communication_website_about_type" - data-conditional-value="Education::School"> - <%= f.input :about_id, - collection: current_university.education_schools, - label: Education::School.model_name.human, - include_blank: false %> - </div> - <div class="d-none" - data-conditional-source="communication_website_about_type" - data-conditional-value="Research::Journal"> - <%= f.input :about_id, - collection: current_university.research_journals, - label: Research::Journal.model_name.human, - include_blank: false %> - </div> - <div class="d-none" - data-conditional-source="communication_website_about_type" - data-conditional-value="Research::Laboratory"> - <%= f.input :about_id, - collection: current_university.research_laboratories, - label: Research::Laboratory.model_name.human, - include_blank: false %> - </div> + <%= render 'admin/communication/abouts', f: f, i18n_key: 'activerecord.attributes.communication/website.about_' %> </div> </div> </div> diff --git a/app/views/admin/communication/websites/_sidebar.html.erb b/app/views/admin/communication/websites/_sidebar.html.erb index fac84877c2e3f7d8f3179c14765abef219b794d5..d9c4071137851401284acc3f3c115a76b25a9624 100644 --- a/app/views/admin/communication/websites/_sidebar.html.erb +++ b/app/views/admin/communication/websites/_sidebar.html.erb @@ -10,7 +10,7 @@ ability: can?(:read, @website) }, { - title: Communication::Website::Page.model_name.human(count: 2), + title: t('admin.communication.website.pages.structure'), path: admin_communication_website_pages_path(website_id: @website), ability: can?(:read, Communication::Website::Page) }, @@ -33,12 +33,7 @@ title: Communication::Website::Menu.model_name.human(count: 2), path: admin_communication_website_menus_path(website_id: @website), ability: can?(:read, Communication::Website::Category) - }, - { - title: Communication::Website::IndexPage.model_name.human(count: 2), - path: admin_communication_website_indexes_path(website_id: @website), - ability: can?(:read, @website) - }, + } ].each do |object| next unless object[:ability] active = object[:path].in? request.path diff --git a/app/views/admin/education/programs/_form.html.erb b/app/views/admin/education/programs/_form.html.erb index 7824826f8fc952d799931a4d9aafeee06a4980d2..02f1c454d2ce694dff48443fb1cee0aebf5aca2f 100644 --- a/app/views/admin/education/programs/_form.html.erb +++ b/app/views/admin/education/programs/_form.html.erb @@ -42,6 +42,14 @@ <%= f.input :featured_image_alt %> </div> </div> + <div class="card flex-fill w-100"> + <div class="card-header"> + <h5 class="card-title mb-0"><%= t('seo') %></h5> + </div> + <div class="card-body"> + <%= f.input :description %> + </div> + </div> </div> <div class="col-md-9"> <div class="card flex-fill w-100"> @@ -49,7 +57,6 @@ <h5 class="card-title mb-0"><%= t('education.program.useful_informations') %></h5> </div> <div class="card-body"> - <%= f.input :description %> <%= render 'admin/education/programs/forms/input_with_inheritance', f: f, property: :presentation %> <%= render 'admin/education/programs/forms/input_with_inheritance', f: f, property: :registration %> <%= render 'admin/education/programs/forms/input_with_inheritance', f: f, property: :pricing %> diff --git a/app/views/admin/education/programs/show.html.erb b/app/views/admin/education/programs/show.html.erb index 31252724d950a44989b40b7ed221640163b4030b..51064ef1ccb42ed7cfff872bca6f4495356a52f9 100644 --- a/app/views/admin/education/programs/show.html.erb +++ b/app/views/admin/education/programs/show.html.erb @@ -38,6 +38,17 @@ </div> </div> <% end %> + <% if @program.description.present? %> + <div class="card flex-fill w-100"> + <div class="card-header"> + <h5 class="card-title mb-0"><%= t('seo') %></h5> + </div> + <div class="card-body"> + <h3 class="h5"><%= Education::Program.human_attribute_name('description') %></h3> + <%= simple_format @program.description %> + </div> + </div> + <% end %> </div> <div class="col-md-9"> <div class="card flex-fill w-100"> @@ -45,7 +56,6 @@ <h5 class="card-title mb-0"><%= t('education.program.useful_informations') %></h5> </div> <div class="card-body"> - <%= render 'admin/application/property/text', object: @program, property: :description %> <% [ :presentation, :registration, diff --git a/app/views/admin/education/programs/static.html.erb b/app/views/admin/education/programs/static.html.erb index b07fa6c361f7d811c28cc3210d33718384e246a3..f3375da1798af2e65b8a571df8f9965f3661ac06 100644 --- a/app/views/admin/education/programs/static.html.erb +++ b/app/views/admin/education/programs/static.html.erb @@ -3,7 +3,7 @@ <% administrator_involvements = @about.involvements_through_roles.includes(:person).ordered_by_name %> title: > <%= @about.name %> -url: /<%= @website.index_for(:education_programs).path %><%= @about.path %>/ +url: <%= @website.special_page(:education_programs).path %><%= @about.path %>/ description: > <%= prepare_text_for_static @about.description %> position: <%= @about.position %> diff --git a/app/views/admin/education/schools/_form.html.erb b/app/views/admin/education/schools/_form.html.erb index 8b449512a819255b2d2f0d3b84a10fb3abf429d7..57b9627530e8783d4cfa05ae69f283e103240a80 100644 --- a/app/views/admin/education/schools/_form.html.erb +++ b/app/views/admin/education/schools/_form.html.erb @@ -17,7 +17,7 @@ <%= f.input :city %> </div> </div> - <%= f.input :country %> + <%= f.input :country, input_html: { class: 'form-select' } %> </div> </div> </div> diff --git a/app/views/admin/research/journal/articles/_form.html.erb b/app/views/admin/research/journal/articles/_form.html.erb index dfb583c60d1d172b5887ce56b207c98bab37fdd1..741b225ea346850dd5aae973e8953042c23f93c9 100644 --- a/app/views/admin/research/journal/articles/_form.html.erb +++ b/app/views/admin/research/journal/articles/_form.html.erb @@ -7,12 +7,6 @@ </div> <div class="card-body"> <%= f.input :title, as: :text, input_html: { rows: 3 } %> - <%= f.input :slug, - as: :string, - input_html: article.persisted? ? {} : { - class: 'js-slug-input', - data: { source: '#research_journal_article_title' } - } %> <%= f.input :abstract, as: :text, input_html: { rows: 8 } %> <%= f.input :pdf %> <%= f.input :text, as: :summernote %> @@ -26,6 +20,12 @@ <h5 class="card-title mb-0"><%= t('metadata') %></h5> </div> <div class="card-body"> + <%= f.input :slug, + as: :string, + input_html: article.persisted? ? {} : { + class: 'js-slug-input', + data: { source: '#research_journal_article_title' } + } %> <%= f.association :volume, collection: @journal.volumes, label: Research::Journal::Volume.model_name.human %> <%= f.input :published %> <%= f.input :published_at, html5: true %> @@ -33,6 +33,14 @@ <%= f.association :people, collection: current_university.people.researchers.ordered, as: :check_boxes %> </div> </div> + <div class="card flex-fill w-100"> + <div class="card-header"> + <h5 class="card-title mb-0"><%= t('seo') %></h5> + </div> + <div class="card-body"> + <%= f.input :description %> + </div> + </div> </div> </div> <% content_for :action_bar_right do %> diff --git a/app/views/admin/research/journal/articles/show.html.erb b/app/views/admin/research/journal/articles/show.html.erb index 303fe4093e93a211ccc3102d5771e86e9c2e21e1..f3a91e8386ec0e86731cc645b69ce5e232776eeb 100644 --- a/app/views/admin/research/journal/articles/show.html.erb +++ b/app/views/admin/research/journal/articles/show.html.erb @@ -50,6 +50,17 @@ <% end %> </div> </div> + <% if @article.description.present? %> + <div class="card flex-fill w-100"> + <div class="card-header"> + <h5 class="card-title mb-0"><%= t('seo') %></h5> + </div> + <div class="card-body"> + <h3 class="h5"><%= Research::Journal::Article.human_attribute_name('description') %></h3> + <%= simple_format @article.description %> + </div> + </div> + <% end %> </div> </div> diff --git a/app/views/admin/research/journal/articles/static.html.erb b/app/views/admin/research/journal/articles/static.html.erb index be28d7fc85071be00271788b9641194486695328..e59d272ad84b0becdb4485a7981ac40d70fbc5b3 100644 --- a/app/views/admin/research/journal/articles/static.html.erb +++ b/app/views/admin/research/journal/articles/static.html.erb @@ -2,7 +2,7 @@ title: "<%= @about.title %>" slug: "<%= @about.slug %>" description: > - <%= prepare_text_for_static @about.abstract %> + <%= prepare_text_for_static @about.description %> <% if @about.volume && @about.volume.path %> volumes: - "<%= @about.volume.path %>" @@ -18,6 +18,7 @@ researchers: <% @about.people.each do |person| %> - "<%= person.slug %>" <% end %> +description_short: "<%= @about.abstract %>" abstract: "<%= @about.abstract %>" references: "<%= @about.references %>" --- diff --git a/app/views/admin/research/journal/volumes/_form.html.erb b/app/views/admin/research/journal/volumes/_form.html.erb index 77e82605d2174ed4943dca1dd5fd03eed0c91a9d..6bd74e9b1bcdac87a864baab00454dba716748fc 100644 --- a/app/views/admin/research/journal/volumes/_form.html.erb +++ b/app/views/admin/research/journal/volumes/_form.html.erb @@ -7,19 +7,13 @@ </div> <div class="card-body"> <%= f.input :title %> - <%= f.input :slug, - as: :string, - input_html: volume.persisted? ? {} : { - class: 'js-slug-input', - data: { source: '#research_journal_volume_title' } - } %> <%= f.input :featured_image, as: :single_deletable_file, input_html: { accept: '.jpg,.jpeg,.png' }, preview: 200, direct_upload: true %> <%= f.input :featured_image_alt %> - <%= f.input :description, input_html: { rows: 10 } %> + <%= f.input :text, as: :summernote %> </div> </div> </div> @@ -29,12 +23,26 @@ <h5 class="card-title mb-0"><%= t('metadata') %></h5> </div> <div class="card-body"> + <%= f.input :slug, + as: :string, + input_html: volume.persisted? ? {} : { + class: 'js-slug-input', + data: { source: '#research_journal_volume_title' } + } %> <%= f.input :number %> <%= f.input :published %> <%= f.input :published_at, html5: true %> <%= f.input :keywords %> </div> </div> + <div class="card flex-fill w-100"> + <div class="card-header"> + <h5 class="card-title mb-0"><%= t('seo') %></h5> + </div> + <div class="card-body"> + <%= f.input :description %> + </div> + </div> </div> </div> <% content_for :action_bar_right do %> diff --git a/app/views/admin/research/journal/volumes/show.html.erb b/app/views/admin/research/journal/volumes/show.html.erb index 26d0e416ec2a806ee094519e34ef2be5f438fc31..cfc3f72711d0b3ba98aa25e6ad491f1e2ee05c6c 100644 --- a/app/views/admin/research/journal/volumes/show.html.erb +++ b/app/views/admin/research/journal/volumes/show.html.erb @@ -7,8 +7,6 @@ <h2 class="card-title mb-0 h5"><%= t('content') %></h2> </div> <div class="card-body"> - <h3 class="h5"><%= Research::Journal::Volume.human_attribute_name('description') %></h3> - <p><%= @volume.description %></p> <% if @articles.any? %> <h3 class="h5 mt-4"><%= Research::Journal::Volume.human_attribute_name('articles') %></h3> <table class="table"> @@ -76,6 +74,17 @@ </div> </div> <% end %> + <% if @volume.description.present? %> + <div class="card flex-fill w-100"> + <div class="card-header"> + <h5 class="card-title mb-0"><%= t('seo') %></h5> + </div> + <div class="card-body"> + <h3 class="h5"><%= Research::Journal::Volume.human_attribute_name('description') %></h3> + <%= simple_format @volume.description %> + </div> + </div> + <% end %> </div> </div> diff --git a/app/views/admin/research/journal/volumes/static.html.erb b/app/views/admin/research/journal/volumes/static.html.erb index 43ad2a1847a235137bf015f0dc843404ffc7e178..dca4bce639c1ce6b70d1cbea313c056567023253 100644 --- a/app/views/admin/research/journal/volumes/static.html.erb +++ b/app/views/admin/research/journal/volumes/static.html.erb @@ -10,5 +10,7 @@ date: "<%= @about.published_at.iso8601 %>" image: "<%= @about.featured_image.blob.id %>" image_alt: "<%= @about.featured_image_alt %>" <% end %> +description: > + <%= prepare_text_for_static @about.description %> --- -<%= @about.description %> +<%= prepare_html_for_static @about.text, @about.university %> diff --git a/app/views/admin/research/laboratories/_form.html.erb b/app/views/admin/research/laboratories/_form.html.erb index cb80b7583aa92635b95e623ed803a32e460a8d8a..b9471761b0146649a071c038cc11064cb3c40261 100644 --- a/app/views/admin/research/laboratories/_form.html.erb +++ b/app/views/admin/research/laboratories/_form.html.erb @@ -7,7 +7,7 @@ <%= f.input :address %> <%= f.input :zipcode %> <%= f.input :city %> - <%= f.input :country %> + <%= f.input :country, input_html: { class: 'form-select' } %> </div> </div> </div> diff --git a/app/views/admin/research/laboratory/axes/_form.html.erb b/app/views/admin/research/laboratory/axes/_form.html.erb index f0476a1520b10dfe1c6f4dc62d81abfbced3fdd8..542cdad8c62083fce97ce85c915390c4570da8ab 100644 --- a/app/views/admin/research/laboratory/axes/_form.html.erb +++ b/app/views/admin/research/laboratory/axes/_form.html.erb @@ -14,11 +14,20 @@ <%= f.input :short_name %> </div> </div> - <%= f.input :description, as: :text, input_html: { rows: 2 } %> <%= f.input :text, as: :summernote %> </div> </div> </div> + <div class="col-md-4"> + <div class="card flex-fill w-100"> + <div class="card-header"> + <h5 class="card-title mb-0"><%= t('seo') %></h5> + </div> + <div class="card-body"> + <%= f.input :description %> + </div> + </div> + </div> </div> <% content_for :action_bar_right do %> <%= submit f %> diff --git a/app/views/admin/research/laboratory/axes/show.html.erb b/app/views/admin/research/laboratory/axes/show.html.erb index 52adb140eb592b4d282d77c209ff6682f03c68b8..a9477f5d11d54ec06e9c3ffa77741f7fa2c03cd2 100644 --- a/app/views/admin/research/laboratory/axes/show.html.erb +++ b/app/views/admin/research/laboratory/axes/show.html.erb @@ -11,13 +11,24 @@ <h3 class="h5"><%= Research::Laboratory::Axis.human_attribute_name('short_name') %></h3> <%= @axis.short_name %> <% end %> - <h3 class="h5 mt-4"><%= Research::Laboratory::Axis.human_attribute_name('description') %></h3> - <%= simple_format @axis.description %> <h3 class="h5 mt-4"><%= Research::Laboratory::Axis.human_attribute_name('text') %></h3> <%= @axis.text %> </div> </div> </div> + <div class="col-md-4"> + <% if @axis.description.present? %> + <div class="card flex-fill w-100"> + <div class="card-header"> + <h5 class="card-title mb-0"><%= t('seo') %></h5> + </div> + <div class="card-body"> + <h3 class="h5"><%= Research::Laboratory::Axis.human_attribute_name('description') %></h3> + <%= simple_format @axis.description %> + </div> + </div> + <% end %> + </div> </div> <% content_for :action_bar_left do %> diff --git a/app/views/admin/university/organizations/_form.html.erb b/app/views/admin/university/organizations/_form.html.erb index 745de780b79a6a634a2bd9c0f27eee516b34d3d4..090877041dac2239e7c51126980d3d06f3318c0c 100644 --- a/app/views/admin/university/organizations/_form.html.erb +++ b/app/views/admin/university/organizations/_form.html.erb @@ -7,7 +7,6 @@ </div> <div class="card-body"> <%= f.input :name %> - <%= f.input :description %> <%= f.input :text, as: :summernote %> </div> </div> @@ -23,7 +22,7 @@ <%= f.input :address %> <%= f.input :zipcode %> <%= f.input :city %> - <%= f.input :country %> + <%= f.input :country, input_html: { class: 'form-select' } %> </div> <div class="col-md-6"> <%= f.input :url %> @@ -83,6 +82,14 @@ direct_upload: true %> </div> </div> + <div class="card flex-fill w-100"> + <div class="card-header"> + <h5 class="card-title mb-0"><%= t('seo') %></h5> + </div> + <div class="card-body"> + <%= f.input :description %> + </div> + </div> </div> </div> <% content_for :action_bar_right do %> diff --git a/app/views/admin/university/organizations/show.html.erb b/app/views/admin/university/organizations/show.html.erb index 4ab9efb8b3419a6881e7bccd0141db5d4f327e7c..73ac36dcf36517bc284ae830dfcc291563a9aaf2 100644 --- a/app/views/admin/university/organizations/show.html.erb +++ b/app/views/admin/university/organizations/show.html.erb @@ -6,7 +6,7 @@ <h5 class="card-title mb-0"><%= t('content') %></h5> </div> <div class="card-body"> - <% [:name, :description].each do |property| %> + <% [:name].each do |property| %> <h3 class="h5"><%= University::Organization.human_attribute_name(property) %></h3> <p><%= @organization.send property %></p> <% end %> @@ -73,16 +73,29 @@ <%= @organization.active %> </div> </div> - <div class="card flex-fill w-100"> - <div class="card-header"> - <h5 class="card-title mb-0"> - <%= University::Organization.human_attribute_name('logo') %> - </h5> + <% if @organization.logo.attached? %> + <div class="card flex-fill w-100"> + <div class="card-header"> + <h5 class="card-title mb-0"> + <%= University::Organization.human_attribute_name('logo') %> + </h5> + </div> + <div class="card-body"> + <%= kamifusen_tag @organization.logo, class: 'img-fluid' %> + </div> </div> - <div class="card-body"> - <%= kamifusen_tag @organization.logo, class: 'img-fluid' %> + <% end %> + <% if @organization.description.present? %> + <div class="card flex-fill w-100"> + <div class="card-header"> + <h5 class="card-title mb-0"><%= t('seo') %></h5> + </div> + <div class="card-body"> + <h3 class="h5"><%= University::Organization.human_attribute_name('description') %></h3> + <%= simple_format @organization.description %> + </div> </div> - </div> + <% end %> </div> </div> diff --git a/app/views/admin/university/people/_form.html.erb b/app/views/admin/university/people/_form.html.erb index b602a2dec76d8120c56ebd96b02606e564351bf9..158388ff7178e9f8874cc56c99e3c593229a85c2 100644 --- a/app/views/admin/university/people/_form.html.erb +++ b/app/views/admin/university/people/_form.html.erb @@ -22,7 +22,6 @@ <%= f.input :phone %> </div> </div> - <%= f.input :description %> <%= f.input :description_short %> <%= f.input :biography, as: :summernote %> </div> @@ -92,6 +91,14 @@ direct_upload: true %> </div> </div> + <div class="card flex-fill w-100"> + <div class="card-header"> + <h5 class="card-title mb-0"><%= t('seo') %></h5> + </div> + <div class="card-body"> + <%= f.input :description %> + </div> + </div> </div> </div> <% content_for :action_bar_right do %> diff --git a/app/views/admin/university/people/_main_infos.html.erb b/app/views/admin/university/people/_main_infos.html.erb index d5eb9647867b6ed754e52fb6b2a1558a8d561e62..12dd8800b37bce89d1d4b8ed57f926f285931276 100644 --- a/app/views/admin/university/people/_main_infos.html.erb +++ b/app/views/admin/university/people/_main_infos.html.erb @@ -13,14 +13,37 @@ <h3 class="h5"><%= University::Person.human_attribute_name('phone') %></h3> <p><%= link_to person.phone, "tel:#{person.phone}", target: '_blank' %></p> <% end %> - <h3 class="h5"><%= University::Person.human_attribute_name('description') %></h3> - <%= simple_format person.description %> - <h3 class="h5"><%= University::Person.human_attribute_name('description_short') %></h3> - <%= simple_format person.description_short %> - <h3 class="h5"><%= University::Person.human_attribute_name('biography') %></h3> - <%= person.biography %> + <% unless person.description_short.blank? %> + <h3 class="h5"><%= University::Person.human_attribute_name('description_short') %></h3> + <%= simple_format person.description_short %> + <% end %> + <% unless person.biography.blank? %> + <h3 class="h5"><%= University::Person.human_attribute_name('biography') %></h3> + <%= person.biography %> + <% end %> </div> </div> + <% unless person.url.blank? && person.linkedin.blank? && person.twitter.blank? %> + <div class="card flex-fill w-100"> + <div class="card-header"> + <h2 class="card-title mb-0 h5"><%= University::Person.human_attribute_name('socials') %></h2> + </div> + <div class="card-body"> + <% unless person.url.blank? %> + <h3 class="h5"><%= University::Person.human_attribute_name('url') %></h3> + <p><%= link_to person.url, person.url, target: '_blank' %></p> + <% end %> + <% unless person.linkedin.blank? %> + <h3 class="h5"><%= University::Person.human_attribute_name('linkedin') %></h3> + <p><%= link_to person.linkedin, person.linkedin, target: '_blank' %></p> + <% end %> + <% unless person.twitter.blank? %> + <h3 class="h5"><%= University::Person.human_attribute_name('twitter') %></h3> + <%= link_to person.twitter, "https://twitter.com/#{person.twitter}", target: '_blank' %> + <% end %> + </div> + </div> + <% end %> </div> <div class="col-md-4"> <div class="card flex-fill w-100"> @@ -53,5 +76,16 @@ </div> </div> <% end %> + <% if person.description.present? %> + <div class="card flex-fill w-100"> + <div class="card-header"> + <h5 class="card-title mb-0"><%= t('seo') %></h5> + </div> + <div class="card-body"> + <h3 class="h5"><%= University::Person.human_attribute_name('description') %></h3> + <%= simple_format person.description %> + </div> + </div> + <% end %> </div> </div> diff --git a/app/views/server/universities/_form.html.erb b/app/views/server/universities/_form.html.erb index 8dec29b306684544d64a64c9af5c558fb117224b..4fbcd19ddbd32ab09c2c29d509ee7c74df4f6015 100644 --- a/app/views/server/universities/_form.html.erb +++ b/app/views/server/universities/_form.html.erb @@ -17,7 +17,7 @@ <%= f.input :city %> </div> </div> - <%= f.input :country %> + <%= f.input :country, input_html: { class: 'form-select' } %> </div> <div class="col-md-4"> <%= f.input :logo, diff --git a/config/application.rb b/config/application.rb index fa48add78a80dfb12115dcd4ef7e49473776c8d6..42ca666b01aa256c57a18f21684d2147d5fb0743 100644 --- a/config/application.rb +++ b/config/application.rb @@ -48,6 +48,9 @@ module Osuny authentication: :plain } + # Need for +repage, because of https://github.com/rails/rails/commit/b2ab8dd3a4a184f3115e72b55c237c7b66405bd9 + config.active_storage.supported_image_processing_methods = ["+"] + config.action_view.sanitized_allowed_tags = [ "a", "abbr", "acronym", "address", "b", "big", "blockquote", "br", "cite", "code", "dd", "del", "dfn", "div", "dl", "dt", "em", diff --git a/config/locales/communication/en.yml b/config/locales/communication/en.yml index 3beeb6eebd3899da3af1ecccd77ad25866aaa51e..b358f93a78cdef6be18069b995be72e6b9171a4e 100644 --- a/config/locales/communication/en.yml +++ b/config/locales/communication/en.yml @@ -20,9 +20,6 @@ en: communication/website/imported/website: one: Imported website other: Imported websites - communication/website/index_page: - one: Index page - other: Index pages communication/website/menu: one: Menu other: Menus @@ -39,15 +36,23 @@ en: other: Posts all: All posts attributes: - communication/extranet: - title: Title - domain: Domain communication/block: name: Name template: Kind of block + communication/extranet: + about: About + about_: Independent extranet (no specific subject) + about_Education::Program: Program extranet + about_Education::School: School extranet + about_Research::Journal: Journal extranet + about_Research::Laboratory: Laboratory extranet + about_type: About + title: Title + domain: Domain communication/website: about: About about_: Independent website (no specific subject) + about_Education::Program: Program website about_Education::School: School website about_Research::Journal: Journal website about_Research::Laboratory: Laboratory website @@ -56,22 +61,13 @@ en: url: URL communication/website/category: children: Children categories - description: Description (SEO) + description: Meta Description text: Text featured_image: Featured image featured_image_alt: Alt text name: Name parent: Parent category slug: Slug - communication/website/index_page: - breadcrumb_title: Name displayed in breadcrumb - description: Description (SEO) - featured_image: Features image - featured_image_alt: Alternative text - header_text: Header text - slug: Slug - text: Page text - title: Title communication/website/imported/category: original: Original communication/website/imported/medium: @@ -87,23 +83,25 @@ en: title: Title url: URL communication/website/page: - related_category: Related category + breadcrumb_title: Title in breadcrumbs children: Children pages - description: Description (SEO) + description: Meta Description description_short: Short description featured_image: Featured image featured_image_alt: Alt text + header_text: Title displayed in header parent: Parent page published: Published? + related_category: Related category slug: Slug - text: Text + text: Main page text title: Title website: Website communication/website/post: author: Author category: Category categories: Categories - description: Description (SEO) + description: Meta Description description_short: Short description featured_image: Featured image featured_image_alt: Alt text @@ -118,6 +116,10 @@ en: communication: blocks: templates: + chapter: + edit: + text_label: Text + text_placeholder: Enter text gallery: edit: add_image: Add image @@ -156,7 +158,10 @@ en: photo_label: Photo remove_photo: Remove photo remove_testimonial: Remove testimonial - + website: + pages: + delete_special_page_notice: Can't delete this page + structure: Structure communication: authors: one: Author @@ -179,50 +184,62 @@ en: refresh: Refresh import show: Show import pending: Import in progress - index_pages: - default: + last_pages: Last pages + last_posts: Last posts + pages: + defaults: administrators: - description: List of members in the administrative team - path: administrative-team + description_short: List of members in the administrative team + slug: administrative-team title: Administrative team authors: - description: List of members in the editorial team - path: editorial-team - title: Editoriale team + description_short: List of members in the editorial team + slug: editorial-team + title: Editorial team communication_posts: - description: List of posts - path: posts + description_short: List of posts + slug: posts title: Posts education_programs: - description: List of available programs - path: programs + description_short: List of available programs + slug: programs title: Programs home: - description: '' - path: home + description_short: '' + slug: '' title: Home - persons: - description: List of members in the team - path: team + legal_terms: + description_short: '' + slug: legal-terms + title: Legal terms + people: + description_short: List of members in the team + slug: team title: Team + privacy_policy: + description_short: '' + slug: privacy-policy + title: Privacy policy research_articles: - description: List of articles - path: articles + description_short: List of articles + slug: articles title: Articles research_volumes: - description: List of volumes - path: volumes + description_short: List of volumes + slug: volumes title: Volumes researchers: - description: List of members in the research team - path: research-team + description_short: List of members in the research team + slug: research-team title: Research team + sitemap: + description_short: '' + slug: sitemap + title: Sitemap teachers: - description: List of members in the educational team - path: educational-team + description_short: List of members in the educational team + slug: educational-team title: Educational team - last_pages: Last pages - last_posts: Last posts posts: new_curation: New curation see_all: See the full list (%{number} elements) @@ -258,5 +275,10 @@ en: url: URL simple_form: hints: - communication_website_index_page: - breadcrumb_title: If the field is empty, page title will be used in the breadcrumbs. + communication_website_category: + description: If this field is empty the main text's begining will be used. + communication_website_page: + breadcrumb_title: If the field is empty, page title will be used in breadcrumbs. + description: If this field is empty, "short description" field will be used. If also emty the main text's begining will be used. + communication_website_post: + description: If this field is empty, "short description" field will be used. If also emty the main text's begining will be used. diff --git a/config/locales/communication/fr.yml b/config/locales/communication/fr.yml index b6c3edd4f045f2bfea96acca57928d784cf83f37..b93bab6e8286db1b8a6e9126e62fe40d3d7e9ed6 100644 --- a/config/locales/communication/fr.yml +++ b/config/locales/communication/fr.yml @@ -20,9 +20,6 @@ fr: communication/website/imported/website: one: Site importé other: Sites importés - communication/website/index_page: - one: Page d'index - other: Pages d'index communication/website/menu: one: Menu other: Menus @@ -43,35 +40,34 @@ fr: title: Titre template: Type de bloc communication/extranet: + about: Sujet de l'extranet + about_: Extranet indépendant (aucun sujet) + about_Education::Program: Extranet d'une formation + about_Education::School: Extranet d'une école + about_Research::Journal: Extranet d'une revue scientifique + about_Research::Laboratory: Extranet d'un laboratoire + about_type: Type d'extranet name: Nom domain: Domaine communication/website: about: Sujet du site about_: Site indépendant (aucun sujet) + about_Education::Program: Site de formation about_Education::School: Site d'école about_Research::Journal: Site de revue scientifique about_Research::Laboratory: Site de laboratoire - about_type: Sujet du site + about_type: Type de site name: Nom url: URL communication/website/category: children: Catégories enfants - description: Description (SEO) + description: Meta Description text: Texte featured_image: Image à la une featured_image_alt: Texte alternatif name: Nom parent: Catégorie parente slug: Slug - communication/website/index_page: - breadcrumb_title: Nom affiché dans le fil d'ariane - description: Description (SEO) - featured_image: Image à la une - featured_image_alt: Texte alternatif - header_text: Texte affiché dans le header - slug: Slug - text: Texte de la page - title: Titre communication/website/imported/category: original: Original communication/website/imported/medium: @@ -87,23 +83,25 @@ fr: title: Titre url: URL communication/website/page: - related_category: Catégorie liée + breadcrumb_title: Nom affiché dans le fil d'ariane children: Pages enfants - description: Description (SEO) + description: Meta Description description_short: Description courte featured_image: Image à la une featured_image_alt: Texte alternatif + header_text: Titre affiché dans le header parent: Page parente published: Publié ? + related_category: Catégorie liée slug: Slug - text: Texte + text: Texte principal de la page title: Titre website: Site Web communication/website/post: author: Auteur·rice category: Catégorie categories: Catégories - description: Description (SEO) + description: Meta Description description_short: Description courte featured_image: Image à la une featured_image_alt: Texte alternatif @@ -160,6 +158,10 @@ fr: photo_label: Photo remove_photo: Enlever la photo remove_testimonial: Enlever le témoignage + website: + pages: + delete_special_page_notice: Impossible de supprimer cette page + structure: Arborescence communication: authors: one: Auteur·rice @@ -182,50 +184,62 @@ fr: refresh: Relancer l'import show: Voir l'import pending: Import en cours - index_pages: - default: + last_pages: Dernières pages + last_posts: Dernières actualités + pages: + defaults: administrators: - description: Liste des membres de l'équipe administrative - path: equipe-administrative + description_short: Liste des membres de l'équipe administrative + slug: equipe-administrative title: Équipe administrative authors: - description: Liste des membres de l'équipe éditoriale - path: equipe-editoriale + description_short: Liste des membres de l'équipe éditoriale + slug: equipe-editoriale title: Équipe éditoriale communication_posts: - description: Liste des actualités - path: actualites + description_short: Liste des actualités + slug: actualites title: Actualités education_programs: - description: Liste des formations proposées - path: offre-de-formation - title: L'offre de formation + description_short: Liste des formations proposées + slug: offre-de-formation + title: "L'offre de formation" home: - description: '' - path: accueil + description_short: '' + slug: '' title: Accueil - persons: - description: Liste des membres de l'équipe - path: equipe + legal_terms: + description_short: '' + slug: mentions-legales + title: Mentions légales + people: + description_short: Liste des membres de l'équipe + slug: equipe title: Équipe + privacy_policy: + description_short: '' + slug: politique-de-confidentialite + title: Politique de confidentialité research_articles: - description: Liste des articles - path: articles + description_short: Liste des articles + slug: articles title: Articles research_volumes: - description: Liste des volumes - path: volumes + description_short: Liste des volumes + slug: volumes title: Volumes researchers: - description: Liste des membres de l'équipe de recherche - path: equipe-de-recherche + description_short: Liste des membres de l'équipe de recherche + slug: equipe-de-recherche title: Équipe de recherche + sitemap: + description_short: '' + slug: plan-du-site + title: Plan du site teachers: - description: Liste des membres de l'équipe pédagogique - path: equipe-pedagogique + description_short: Liste des membres de l'équipe pédagogique + slug: equipe-pedagogique title: Équipe pédagogique - last_pages: Dernières pages - last_posts: Dernières actualités posts: new_curation: Nouvelle curation see_all: Voir la liste complète (%{number} éléments) @@ -261,5 +275,10 @@ fr: url: URL simple_form: hints: - communication_website_index_page: + communication_website_category: + description: Si ce champ est vide le début du texte principal sera utilisé. + communication_website_page: breadcrumb_title: Si ce champ est vide le titre de la page sera utilisé dans le fil d'Ariane. + description: Si ce champ est vide la "description courte" sera utilisée. Si elle est également vide le début du texte principal sera utilisé. + communication_website_post: + description: Si ce champ est vide la "description courte" sera utilisée. Si elle est également vide le début du texte principal sera utilisé. diff --git a/config/locales/education/en.yml b/config/locales/education/en.yml index 538a0ee1dcc3f4c738048e10afacc0f1b836358e..3d19dfc0f0963ec272cc0594e60acbde0cd2f76b 100644 --- a/config/locales/education/en.yml +++ b/config/locales/education/en.yml @@ -22,7 +22,7 @@ en: capacity: Capacity contacts: Contacts continuing: Formation continue - description: Description (SEO) + description: Meta Description duration: Durée ects: Crédits ECTS evaluation: Modalités d’évaluation diff --git a/config/locales/education/fr.yml b/config/locales/education/fr.yml index 9c2a6574a892a266074f58ef4d86d657eb9d22f9..d5a940794da9be72ae6c18d98b2179a0098a3a7e 100644 --- a/config/locales/education/fr.yml +++ b/config/locales/education/fr.yml @@ -22,7 +22,7 @@ fr: capacity: Capacité contacts: Contacts continuing: Formation continue - description: Description (SEO) + description: Meta Description duration: Durée ects: Crédits ECTS evaluation: Modalités d’évaluation diff --git a/config/locales/en.yml b/config/locales/en.yml index e15d7f9749754ae6b6bfd1677d1e1ae7d0134525..d8c2241b8d9702c3d1ecdd5c23738495c9398355 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -134,6 +134,7 @@ en: save: Save search: Search select_language: Select language + seo: SEO simple_form: error_notification: default_message: "Please review the problems below:" diff --git a/config/locales/fr.yml b/config/locales/fr.yml index cfa6f2e2aadc50100f91efc79474bdccc2ab05b1..9c50eb42a1c7b7d97710b656ad24309e584f8c5f 100644 --- a/config/locales/fr.yml +++ b/config/locales/fr.yml @@ -134,6 +134,7 @@ fr: save: Enregistrer search: Rechercher select_language: Sélectionnez une langue + seo: SEO simple_form: error_notification: default_message: "Les erreurs ci-dessous empêchent la validation :" diff --git a/config/locales/research/en.yml b/config/locales/research/en.yml index a2d811b11f3ca1470daab3cca02affcbf410c9a6..be2ded093af18e35d4e37661bef697780fdd0cef 100644 --- a/config/locales/research/en.yml +++ b/config/locales/research/en.yml @@ -28,6 +28,7 @@ en: title: Title research/journal/article: abstract: Abstract + description: Meta Description keywords: Keywords pdf: Article PDF published: Published? @@ -39,11 +40,12 @@ en: research/journal/volume: featured_image: Cover featured_image_alt: Alt text - description: Description (SEO) + description: Meta Description keywords: Keywords number: Number published: Published? published_at: Published at + text: Text title: Title research/laboratory: address: Address @@ -52,7 +54,7 @@ en: name: Name zipcode: Zipcode research/laboratory/axis: - description: Description (SEO) + description: Meta Description name: Name short_name: Short name text: Text @@ -73,5 +75,10 @@ en: other: Researchers simple_form: hints: + research_journal_article: + description: If this field is empty the main text's begining will be used. research_journal_volume: cover: JPG or PNG file + description: If this field is empty the main text's begining will be used. + research_laboratory_axis: + description: If this field is empty the main text's begining will be used. diff --git a/config/locales/research/fr.yml b/config/locales/research/fr.yml index 74eaf696e5c6be4f63858e7b63557c9a1e03b913..21ed4ad67eab2664de443272dd47e919648a99e7 100644 --- a/config/locales/research/fr.yml +++ b/config/locales/research/fr.yml @@ -28,6 +28,7 @@ fr: title: Titre research/journal/article: abstract: Extrait + description: Meta Description keywords: Mots clés pdf: PDF de l'article published: Publié ? @@ -39,11 +40,12 @@ fr: research/journal/volume: featured_image: Couverture featured_image_alt: Texte alternatif - description: Description (SEO) + description: Meta Description keywords: Mots clés number: Numéro published: Publié ? published_at: Publié le + text: Texte title: Titre research/laboratory: address: Adresse @@ -52,7 +54,7 @@ fr: name: Nom zipcode: Code postal research/laboratory/axis: - description: Description (SEO) + description: Meta Description name: Nom short_name: Nom court text: Texte @@ -73,5 +75,10 @@ fr: other: Chercheu·rs·ses simple_form: hints: + research_journal_article: + description: Si ce champ est vide le début de l'extrait sera utilisé. research_journal_volume: cover: Fichier JPG ou PNG + description: Si ce champ est vide le début du texte principal sera utilisé. + research_laboratory_axis: + description: Si ce champ est vide le début du texte principal sera utilisé. diff --git a/config/locales/university/en.yml b/config/locales/university/en.yml index 8172a9e926e507329bb06e3060c4a84ec8270cec..c9ba0ebd4afbd3b88049d7c0381c4dba47b075e0 100644 --- a/config/locales/university/en.yml +++ b/config/locales/university/en.yml @@ -20,13 +20,14 @@ en: abilities: Abilities biography: Biography communication_website_posts: Posts - description: Description (SEO) + description: Meta Description description_short: Short description education_programs: Programs email: Email first_name: First name habilitation: Can direct research? is_administration: Administrative staff + is_alumnus: Alumnus is_author: Author is_researcher: Researcher is_teacher: Teacher @@ -49,7 +50,7 @@ en: university/organization: name: Name long_name: Long name - description: Description (SEO) + description: Meta Description text: Text contact: Contact information legal: Legal information @@ -65,7 +66,7 @@ en: university/organization/import: file: File (.csv) university/role: - description: Description (SEO) + description: Description people: People models: university: @@ -93,9 +94,13 @@ en: hints: university: sms_sender_name: "11 characters max. Only alphanumeric chars ([A-Z][a-z][0-9])." + university_organization: + description: If this field is empty the main text's begining will be used. university_person: + description: If this field is empty, "short description" field will be used. If also emty the main text's begining will be used. habilitation: "Possesses an accreditation to supervise research." is_administration: "Fulfill administrative missions." + is_alumnus: "Studies or studied in the school." is_author: "Writes posts for websites." is_researcher: "Writes articles for journals." is_teacher: "Teaches in Schools." diff --git a/config/locales/university/fr.yml b/config/locales/university/fr.yml index 5738ca4ac0ad1c3cf7bbe109bf2a1ee4297af774..2c89406f5e58746f44b9159cd93c818cbf663616 100644 --- a/config/locales/university/fr.yml +++ b/config/locales/university/fr.yml @@ -20,17 +20,17 @@ fr: abilities: Responsabilités biography: Biographie communication_website_posts: Actualités - description: Description (SEO) + description: Meta Description description_short: Description courte education_programs: Formations email: Email first_name: Prénom habilitation: Peut diriger des recherches ? is_administration: Personnel administratif + is_alumnus: Alumnus is_author: Auteur·rice is_researcher: Chercheur·se is_teacher: Enseignant·e - is_alumnus: Alumnus last_name: Nom de famille linkedin: LinkedIn (URL) name: Nom @@ -50,7 +50,7 @@ fr: university/organization: name: Nom long_name: Nom complet - description: Description (SEO) + description: Meta Description text: Texte contact: Informations de contact legal: Informations légales @@ -66,7 +66,7 @@ fr: university/organization/import: file: Fichier (.csv) university/role: - description: Description (SEO) + description: Description people: Personnes models: university: @@ -94,13 +94,16 @@ fr: hints: university: sms_sender_name: "11 caractères maximum. Que des caractères alphadécimaux ([A-Z][a-z][0-9])." + university_organization: + description: Si ce champ est vide le début du texte principal sera utilisé. university_person: + description: Si ce champ est vide la "description courte" sera utilisée. Si elle est également vide le début du texte principal sera utilisé. habilitation: "Détient une Habilitation à Diriger des Recherches (HDR)." is_administration: "Remplit des missions administratives." + is_alumnus: "Étudie ou a étudié dans l'établissement." is_author: "Écrit des articles pour les sites." is_researcher: "Écrit des articles dans des revues scientifiques." is_teacher: "Enseigne dans des formations." - is_alumnus: "Étudie ou a étudié dans l'établissement." linkedin: "Exemple : https://www.linkedin.com/in/osuny" tenure: "À différencier d'une personne vacataire." twitter: "Exemple : osuny" diff --git a/config/routes/admin/communication.rb b/config/routes/admin/communication.rb index 8b65d9c852c44bf5d5576cea3d8d52e28d18df98..4ebcf1ce0531974450775c95d87cadc58b771641 100644 --- a/config/routes/admin/communication.rb +++ b/config/routes/admin/communication.rb @@ -44,12 +44,7 @@ namespace :communication do end get 'structure' => 'website/structure#edit' patch 'structure' => 'website/structure#update' - - get 'indexes' => 'website/index_pages#index' - get 'indexes/:kind' => 'website/index_pages#edit', as: :index - post 'indexes/:kind' => 'website/index_pages#update' - patch 'indexes/:kind' => 'website/index_pages#update' - put 'indexes/:kind' => 'website/index_pages#update' + end resources :blocks, controller: 'blocks', except: :index do collection do diff --git a/db/migrate/20220328131728_add_kind_breadcrumb_title_and_header_text_to_pages.rb b/db/migrate/20220328131728_add_kind_breadcrumb_title_and_header_text_to_pages.rb new file mode 100644 index 0000000000000000000000000000000000000000..676ae3c133385524da03669965327f534c944267 --- /dev/null +++ b/db/migrate/20220328131728_add_kind_breadcrumb_title_and_header_text_to_pages.rb @@ -0,0 +1,7 @@ +class AddKindBreadcrumbTitleAndHeaderTextToPages < ActiveRecord::Migration[6.1] + def change + add_column :communication_website_pages, :breadcrumb_title, :string + add_column :communication_website_pages, :header_text, :text + add_column :communication_website_pages, :kind, :integer + end +end diff --git a/db/migrate/20220408080633_remove_about_from_communication_website_pages.rb b/db/migrate/20220408080633_remove_about_from_communication_website_pages.rb new file mode 100644 index 0000000000000000000000000000000000000000..102ed58367cf33f7a018287344741f7aa4e0925f --- /dev/null +++ b/db/migrate/20220408080633_remove_about_from_communication_website_pages.rb @@ -0,0 +1,6 @@ +class RemoveAboutFromCommunicationWebsitePages < ActiveRecord::Migration[6.1] + def change + remove_column :communication_website_pages, :about_type + remove_column :communication_website_pages, :about_id + end +end diff --git a/db/migrate/20220408080927_remove_old_text_from_communication_website_pages_and_posts.rb b/db/migrate/20220408080927_remove_old_text_from_communication_website_pages_and_posts.rb new file mode 100644 index 0000000000000000000000000000000000000000..38a2a607071c8ef31b6ce3058d634eb5734cff03 --- /dev/null +++ b/db/migrate/20220408080927_remove_old_text_from_communication_website_pages_and_posts.rb @@ -0,0 +1,6 @@ +class RemoveOldTextFromCommunicationWebsitePagesAndPosts < ActiveRecord::Migration[6.1] + def change + remove_column :communication_website_pages, :old_text + remove_column :communication_website_posts, :old_text + end +end diff --git a/db/migrate/20220408104605_add_text_to_research_journal_volume.rb b/db/migrate/20220408104605_add_text_to_research_journal_volume.rb new file mode 100644 index 0000000000000000000000000000000000000000..1a8a3b5f9d2a09fb555c24f22945d1c74ede7357 --- /dev/null +++ b/db/migrate/20220408104605_add_text_to_research_journal_volume.rb @@ -0,0 +1,5 @@ +class AddTextToResearchJournalVolume < ActiveRecord::Migration[6.1] + def change + add_column :research_journal_volumes, :text, :text + end +end diff --git a/db/migrate/20220408105051_add_description_to_research_journal_article.rb b/db/migrate/20220408105051_add_description_to_research_journal_article.rb new file mode 100644 index 0000000000000000000000000000000000000000..8e1e21bc929bc46776db69d4ab32bf33abacf1aa --- /dev/null +++ b/db/migrate/20220408105051_add_description_to_research_journal_article.rb @@ -0,0 +1,6 @@ +class AddDescriptionToResearchJournalArticle < ActiveRecord::Migration[6.1] + def change + add_column :research_journal_articles, :description, :text + + end +end diff --git a/db/migrate/20220411133002_add_about_to_communication_extranets.rb b/db/migrate/20220411133002_add_about_to_communication_extranets.rb new file mode 100644 index 0000000000000000000000000000000000000000..b42deb0e9a6ef1e9562967a04a4b885ebf1a61ed --- /dev/null +++ b/db/migrate/20220411133002_add_about_to_communication_extranets.rb @@ -0,0 +1,6 @@ +class AddAboutToCommunicationExtranets < ActiveRecord::Migration[6.1] + def change + add_reference :communication_extranets, :about, polymorphic: true, type: :uuid + + end +end diff --git a/db/schema.rb b/db/schema.rb index 655cdc66a9e8d6e2e3d34aec7bd43761ec8c73a9..e83f950a6cc38e1e2d6be0db503fb67fb03976e7 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 2022_04_04_140813) do +ActiveRecord::Schema.define(version: 2022_04_11_133002) do # These are extensions that must be enabled in order to support this database enable_extension "pgcrypto" @@ -99,6 +99,9 @@ ActiveRecord::Schema.define(version: 2022_04_04_140813) do t.string "domain" t.datetime "created_at", precision: 6, null: false t.datetime "updated_at", precision: 6, null: false + t.string "about_type" + t.uuid "about_id" + t.index ["about_type", "about_id"], name: "index_communication_extranets_on_about" t.index ["university_id"], name: "index_communication_extranets_on_university_id" end @@ -309,18 +312,17 @@ ActiveRecord::Schema.define(version: 2022_04_04_140813) do t.text "path" t.uuid "parent_id" t.integer "position", default: 0, null: false - t.string "about_type" - t.uuid "about_id" t.datetime "created_at", precision: 6, null: false t.datetime "updated_at", precision: 6, null: false - t.text "old_text" t.boolean "published", default: false t.text "github_path" t.uuid "related_category_id" t.string "featured_image_alt" t.text "text" + t.string "breadcrumb_title" + t.text "header_text" + t.integer "kind" t.text "description_short" - t.index ["about_type", "about_id"], name: "index_communication_website_pages_on_about" t.index ["communication_website_id"], name: "index_communication_website_pages_on_communication_website_id" t.index ["parent_id"], name: "index_communication_website_pages_on_parent_id" t.index ["related_category_id"], name: "index_communication_website_pages_on_related_category_id" @@ -332,7 +334,6 @@ ActiveRecord::Schema.define(version: 2022_04_04_140813) do t.uuid "communication_website_id", null: false t.string "title" t.text "description" - t.text "old_text" t.boolean "published", default: false t.datetime "published_at" t.datetime "created_at", precision: 6, null: false @@ -476,23 +477,6 @@ ActiveRecord::Schema.define(version: 2022_04_04_140813) do t.index ["university_id"], name: "index_education_schools_on_university_id" end - create_table "external_organizations", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| - t.string "title" - t.text "description" - t.string "address" - t.string "zipcode" - t.string "city" - t.string "country" - t.string "website" - t.string "phone" - t.string "mail" - t.boolean "active" - t.string "sirene" - t.integer "kind" - t.datetime "created_at", precision: 6, null: false - t.datetime "updated_at", precision: 6, null: false - end - create_table "languages", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| t.string "name" t.string "iso_code" @@ -516,6 +500,7 @@ ActiveRecord::Schema.define(version: 2022_04_04_140813) do t.boolean "published", default: false t.integer "position" t.text "text" + t.text "description" t.index ["research_journal_id"], name: "index_research_journal_articles_on_research_journal_id" t.index ["research_journal_volume_id"], name: "index_research_journal_articles_on_research_journal_volume_id" t.index ["university_id"], name: "index_research_journal_articles_on_university_id" @@ -542,6 +527,7 @@ ActiveRecord::Schema.define(version: 2022_04_04_140813) do t.string "slug" t.string "featured_image_alt" t.boolean "published", default: false + t.text "text" t.index ["research_journal_id"], name: "index_research_journal_volumes_on_research_journal_id" t.index ["university_id"], name: "index_research_journal_volumes_on_university_id" end diff --git a/test/fixtures/communication/extranets.yml b/test/fixtures/communication/extranets.yml index bc8e28dc28879f1b8d9154076ecc63db7e04380b..776fd724dd5f024e021fce80b2a6c2d36c36bae3 100644 --- a/test/fixtures/communication/extranets.yml +++ b/test/fixtures/communication/extranets.yml @@ -3,14 +3,17 @@ # Table name: communication_extranets # # id :uuid not null, primary key +# about_type :string indexed => [about_id] # domain :string # name :string # created_at :datetime not null # updated_at :datetime not null +# about_id :uuid indexed => [about_type] # university_id :uuid not null, indexed # # Indexes # +# index_communication_extranets_on_about (about_type,about_id) # index_communication_extranets_on_university_id (university_id) # # Foreign Keys diff --git a/test/fixtures/communication/website/posts.yml b/test/fixtures/communication/website/posts.yml index 0bc85c0f7d3a8fd095a209660748ede658f845ff..e1a8f8962b8bafba9698d1b75a7ff3e6f095db49 100644 --- a/test/fixtures/communication/website/posts.yml +++ b/test/fixtures/communication/website/posts.yml @@ -7,7 +7,6 @@ # description_short :text # featured_image_alt :string # github_path :text -# old_text :text # pinned :boolean default(FALSE) # published :boolean default(FALSE) # published_at :datetime diff --git a/test/models/communication/extranet_test.rb b/test/models/communication/extranet_test.rb index 6230afc9a5003701d77724c0def02121a97d160e..54e7cf1a80e1fe893549cc7327a91a469e705468 100644 --- a/test/models/communication/extranet_test.rb +++ b/test/models/communication/extranet_test.rb @@ -3,14 +3,17 @@ # Table name: communication_extranets # # id :uuid not null, primary key +# about_type :string indexed => [about_id] # domain :string # name :string # created_at :datetime not null # updated_at :datetime not null +# about_id :uuid indexed => [about_type] # university_id :uuid not null, indexed # # Indexes # +# index_communication_extranets_on_about (about_type,about_id) # index_communication_extranets_on_university_id (university_id) # # Foreign Keys