diff --git a/app/assets/images/communication/blocks/templates/persons/grid.png b/app/assets/images/communication/blocks/templates/persons/grid.png index ce4398806..8622d58d3 100644 Binary files a/app/assets/images/communication/blocks/templates/persons/grid.png and b/app/assets/images/communication/blocks/templates/persons/grid.png differ diff --git a/app/assets/images/communication/blocks/templates/persons/list.png b/app/assets/images/communication/blocks/templates/persons/list.png index 14063ea7f..2be7d6323 100644 Binary files a/app/assets/images/communication/blocks/templates/persons/list.png and b/app/assets/images/communication/blocks/templates/persons/list.png differ diff --git a/app/assets/stylesheets/admin/components/content-editor.sass b/app/assets/stylesheets/admin/components/content-editor.sass index d9ad3009a..31d8c8559 100644 --- a/app/assets/stylesheets/admin/components/content-editor.sass +++ b/app/assets/stylesheets/admin/components/content-editor.sass @@ -1,4 +1,5 @@ -.edit_communication_block +.edit_communication_block, +.pages-edit #layouts .layout label diff --git a/app/controllers/admin/communication/websites/pages_controller.rb b/app/controllers/admin/communication/websites/pages_controller.rb index 434bc54ea..33fe673cf 100644 --- a/app/controllers/admin/communication/websites/pages_controller.rb +++ b/app/controllers/admin/communication/websites/pages_controller.rb @@ -167,7 +167,7 @@ def breadcrumb def page_params params.require(:communication_website_page) .permit( - :communication_website_id, :bodyclass, :full_width, :parent_id, category_ids: [], + :communication_website_id, :bodyclass, :full_width, :parent_id, :design_options, category_ids: [], localizations_attributes: [ :id, :title, :breadcrumb_title, :meta_description, :summary, :header_text, :text, :slug, :published, :header_cta, :header_cta_label, :header_cta_url, diff --git a/app/models/communication/block/template/page.rb b/app/models/communication/block/template/page.rb index 34c92822d..a35ad3b40 100644 --- a/app/models/communication/block/template/page.rb +++ b/app/models/communication/block/template/page.rb @@ -18,10 +18,10 @@ class Communication::Block::Template::Page < Communication::Block::Template::Bas has_component :category_id, :page_category has_component :option_image, :boolean, default: true + has_component :option_main_summary, :boolean, default: true # Deprecated has_component :option_categories, :boolean, default: false - has_component :option_main_summary, :boolean, default: true has_component :option_summary, :boolean, default: true - + def page page_id_component.page end diff --git a/app/models/communication/website/page.rb b/app/models/communication/website/page.rb index 416aec379..711258081 100644 --- a/app/models/communication/website/page.rb +++ b/app/models/communication/website/page.rb @@ -48,6 +48,7 @@ class Communication::Website::Page < ApplicationRecord include Sanitizable include Searchable include WithAutomaticMenus + include WithDesignOptions include WithMenuItemTarget include WithOpenApi include WithSpecialPage diff --git a/app/models/communication/website/page/accessibility.rb b/app/models/communication/website/page/accessibility.rb index ea3622905..ff3d5a831 100644 --- a/app/models/communication/website/page/accessibility.rb +++ b/app/models/communication/website/page/accessibility.rb @@ -1,5 +1,9 @@ class Communication::Website::Page::Accessibility < Communication::Website::Page + def design_options_block_template_kind + nil + end + def is_listed_among_children? false end diff --git a/app/models/communication/website/page/administration_location.rb b/app/models/communication/website/page/administration_location.rb index 61476157d..bd553ff7a 100644 --- a/app/models/communication/website/page/administration_location.rb +++ b/app/models/communication/website/page/administration_location.rb @@ -1,5 +1,9 @@ class Communication::Website::Page::AdministrationLocation < Communication::Website::Page + def design_options_block_template_kind + :locations + end + def is_hugo_index? true end diff --git a/app/models/communication/website/page/administrator.rb b/app/models/communication/website/page/administrator.rb index 6f934b137..82d2f9df3 100644 --- a/app/models/communication/website/page/administrator.rb +++ b/app/models/communication/website/page/administrator.rb @@ -1,5 +1,9 @@ class Communication::Website::Page::Administrator < Communication::Website::Page + def design_options_block_template_kind + :persons + end + def is_hugo_index? true end diff --git a/app/models/communication/website/page/author.rb b/app/models/communication/website/page/author.rb index e44b67ddc..76ac5f719 100644 --- a/app/models/communication/website/page/author.rb +++ b/app/models/communication/website/page/author.rb @@ -1,5 +1,9 @@ class Communication::Website::Page::Author < Communication::Website::Page + def design_options_block_template_kind + :persons + end + def is_hugo_index? true end diff --git a/app/models/communication/website/page/communication_agenda.rb b/app/models/communication/website/page/communication_agenda.rb index cf620635f..f0621567c 100644 --- a/app/models/communication/website/page/communication_agenda.rb +++ b/app/models/communication/website/page/communication_agenda.rb @@ -1,5 +1,9 @@ class Communication::Website::Page::CommunicationAgenda < Communication::Website::Page + def design_options_block_template_kind + :agenda + end + def is_hugo_index? true end diff --git a/app/models/communication/website/page/communication_agenda_archive.rb b/app/models/communication/website/page/communication_agenda_archive.rb index d31fead3b..2d2bbcee9 100644 --- a/app/models/communication/website/page/communication_agenda_archive.rb +++ b/app/models/communication/website/page/communication_agenda_archive.rb @@ -1,5 +1,9 @@ class Communication::Website::Page::CommunicationAgendaArchive < Communication::Website::Page + def design_options_block_template_kind + :agenda + end + def is_hugo_index? true end diff --git a/app/models/communication/website/page/communication_portfolio.rb b/app/models/communication/website/page/communication_portfolio.rb index 2fea410f6..53de1187b 100644 --- a/app/models/communication/website/page/communication_portfolio.rb +++ b/app/models/communication/website/page/communication_portfolio.rb @@ -1,5 +1,9 @@ class Communication::Website::Page::CommunicationPortfolio < Communication::Website::Page + def design_options_block_template_kind + :projects + end + def is_hugo_index? true end diff --git a/app/models/communication/website/page/communication_post.rb b/app/models/communication/website/page/communication_post.rb index 0d3153848..67a8714f9 100644 --- a/app/models/communication/website/page/communication_post.rb +++ b/app/models/communication/website/page/communication_post.rb @@ -1,5 +1,9 @@ class Communication::Website::Page::CommunicationPost < Communication::Website::Page + def design_options_block_template_kind + :posts + end + def is_hugo_index? true end @@ -12,6 +16,10 @@ def full_width_by_default? true end + def design_options_block_template_kind + :posts + end + def should_create_special_page? website.feature_posts end diff --git a/app/models/communication/website/page/education_program.rb b/app/models/communication/website/page/education_program.rb index 980c2db8e..3ed87e28a 100644 --- a/app/models/communication/website/page/education_program.rb +++ b/app/models/communication/website/page/education_program.rb @@ -1,5 +1,9 @@ class Communication::Website::Page::EducationProgram < Communication::Website::Page + def design_options_block_template_kind + :programs + end + def is_hugo_index? true end diff --git a/app/models/communication/website/page/legal_term.rb b/app/models/communication/website/page/legal_term.rb index 654069e08..8fb6ea114 100644 --- a/app/models/communication/website/page/legal_term.rb +++ b/app/models/communication/website/page/legal_term.rb @@ -1,5 +1,9 @@ class Communication::Website::Page::LegalTerm < Communication::Website::Page + def design_options_block_template_kind + nil + end + def is_listed_among_children? false end diff --git a/app/models/communication/website/page/organization.rb b/app/models/communication/website/page/organization.rb index ea8e9dd82..0fd0e9964 100644 --- a/app/models/communication/website/page/organization.rb +++ b/app/models/communication/website/page/organization.rb @@ -1,5 +1,9 @@ class Communication::Website::Page::Organization < Communication::Website::Page + def design_options_block_template_kind + :organizations + end + def is_hugo_index? true end diff --git a/app/models/communication/website/page/person.rb b/app/models/communication/website/page/person.rb index fca16c9e0..cd7d4fb7a 100644 --- a/app/models/communication/website/page/person.rb +++ b/app/models/communication/website/page/person.rb @@ -1,5 +1,9 @@ class Communication::Website::Page::Person < Communication::Website::Page + def design_options_block_template_kind + :persons + end + def is_hugo_index? true end diff --git a/app/models/communication/website/page/privacy_policy.rb b/app/models/communication/website/page/privacy_policy.rb index 8670c7b5d..2e2d07eb8 100644 --- a/app/models/communication/website/page/privacy_policy.rb +++ b/app/models/communication/website/page/privacy_policy.rb @@ -1,5 +1,9 @@ class Communication::Website::Page::PrivacyPolicy < Communication::Website::Page + def design_options_block_template_kind + nil + end + def is_listed_among_children? false end diff --git a/app/models/communication/website/page/sitemap.rb b/app/models/communication/website/page/sitemap.rb index 6c42b737b..92edde73e 100644 --- a/app/models/communication/website/page/sitemap.rb +++ b/app/models/communication/website/page/sitemap.rb @@ -1,5 +1,9 @@ class Communication::Website::Page::Sitemap < Communication::Website::Page + def design_options_block_template_kind + nil + end + def editable_width? false end diff --git a/app/models/communication/website/page/with_design_options.rb b/app/models/communication/website/page/with_design_options.rb new file mode 100644 index 000000000..0494aad17 --- /dev/null +++ b/app/models/communication/website/page/with_design_options.rb @@ -0,0 +1,36 @@ +module Communication::Website::Page::WithDesignOptions + extend ActiveSupport::Concern + + OPTION_PREFIX = 'option_' + + def design_options? + design_options_block_template_kind.present? + end + + def design_options=(value) + self[:design_options] = JSON.parse(value) + end + + def design_options + self[:design_options] || design_options_block.data + end + + def design_options_hash + design_options.map { |key, value| + next unless key.start_with? OPTION_PREFIX + [key.remove(OPTION_PREFIX), value] + }.compact + end + + def design_options_layout + design_options.dig('layout') + end + + def design_options_block_template_kind + :pages + end + + def design_options_block + @design_options_block ||= Communication::Block.new(template_kind: design_options_block_template_kind) + end +end diff --git a/app/views/admin/application/images/shared/_form.html.erb b/app/views/admin/application/images/shared/_form.html.erb index b68415a4a..e1a61f357 100644 --- a/app/views/admin/application/images/shared/_form.html.erb +++ b/app/views/admin/application/images/shared/_form.html.erb @@ -1,11 +1,9 @@ -<%= osuny_panel t('shared_image.title') do %> - <%= f.input :shared_image, - as: :single_deletable_file, - label: false, - hint: file_hint( - filesize: number_to_human_size(500.kilobytes), - formats: '.jpg, .png' - ), - input_html: { accept: '.jpg, .png' }, - preview: true %> -<% end %> +<%= f.input :shared_image, + as: :single_deletable_file, + label: t('shared_image.title'), + hint: file_hint( + filesize: number_to_human_size(500.kilobytes), + formats: '.jpg, .png' + ), + input_html: { accept: '.jpg, .png' }, + preview: true %> diff --git a/app/views/admin/application/meta_description/_form.html.erb b/app/views/admin/application/meta_description/_form.html.erb index b2fa7057e..705306899 100644 --- a/app/views/admin/application/meta_description/_form.html.erb +++ b/app/views/admin/application/meta_description/_form.html.erb @@ -1,10 +1,9 @@ -<%= osuny_panel t('admin.seo') do %> - <%= f.input :meta_description, - label: t('admin.meta_description.label'), - hint: t('admin.meta_description.hint'), - input_html: { - data: { translatable: true }, - rows: 3, - value: about.meta_description&.gsub('&', '&') - } %> -<% end %> +<%= f.input :meta_description, + as: :text, + label: t('admin.meta_description.label'), + hint: t('admin.meta_description.hint'), + input_html: { + data: { translatable: true }, + rows: 3, + value: about.meta_description&.gsub('&', '&') + } %> diff --git a/app/views/admin/communication/blocks/templates/agenda/_edit.html.erb b/app/views/admin/communication/blocks/templates/agenda/_edit.html.erb index 52f9ddde3..4c99438f5 100644 --- a/app/views/admin/communication/blocks/templates/agenda/_edit.html.erb +++ b/app/views/admin/communication/blocks/templates/agenda/_edit.html.erb @@ -54,17 +54,5 @@ <%= osuny_separator %> <%= osuny_small_panel t('admin.communication.blocks.components.layouts.label') do %> <%= block_component_edit block, :layout %> - <%= osuny_label t('admin.communication.blocks.display_options.title') %> -
-
- <%= block_component_edit block, :option_image, label: Communication::Website::Agenda::Event::Localization.human_attribute_name(:featured_image) %> - <%= block_component_edit block, :option_subtitle, label: Communication::Website::Agenda::Event::Localization.human_attribute_name(:subtitle) %> - <%= block_component_edit block, :option_summary, label: t('admin.summary.label') %> -
-
- <%= block_component_edit block, :option_dates, label: Communication::Website::Agenda::Event.human_attribute_name(:dates) %> - <%= block_component_edit block, :option_categories, label: Communication::Website::Agenda::Event.human_attribute_name(:categories) %> - <%= block_component_edit block, :option_status, label: Communication::Website::Agenda::Event.human_attribute_name(:status) %> -
-
+ <%= render 'admin/communication/blocks/templates/agenda/options', block: block %> <% end %> diff --git a/app/views/admin/communication/blocks/templates/agenda/_options.html.erb b/app/views/admin/communication/blocks/templates/agenda/_options.html.erb new file mode 100644 index 000000000..44d09b4f2 --- /dev/null +++ b/app/views/admin/communication/blocks/templates/agenda/_options.html.erb @@ -0,0 +1,13 @@ +<%= osuny_label t('admin.communication.blocks.display_options.title') %> +
+
+ <%= block_component_edit block, :option_image, label: Communication::Website::Agenda::Event::Localization.human_attribute_name(:featured_image) %> + <%= block_component_edit block, :option_subtitle, label: Communication::Website::Agenda::Event::Localization.human_attribute_name(:subtitle) %> + <%= block_component_edit block, :option_summary, label: t('admin.summary.label') %> +
+
+ <%= block_component_edit block, :option_dates, label: Communication::Website::Agenda::Event::Localization.human_attribute_name(:dates) %> + <%= block_component_edit block, :option_categories, label: Communication::Website::Agenda::Event.human_attribute_name(:categories) %> + <%= block_component_edit block, :option_status, label: Communication::Website::Agenda::Event.human_attribute_name(:status) %> +
+
diff --git a/app/views/admin/communication/blocks/templates/datatable/_edit.html.erb b/app/views/admin/communication/blocks/templates/datatable/_edit.html.erb index 974e39a6c..e736182dd 100644 --- a/app/views/admin/communication/blocks/templates/datatable/_edit.html.erb +++ b/app/views/admin/communication/blocks/templates/datatable/_edit.html.erb @@ -1,3 +1,5 @@ +<%= block_component_edit block, :description, summernote_config: 'mini' %> + <%= block_component_edit block, :alphabetical %>
@@ -49,11 +51,4 @@
-
-
- <%= block_component_edit block, :description, summernote_config: 'mini' %> -
-
- <%= block_component_edit block, :caption %> -
-
+<%= block_component_edit block, :caption %> diff --git a/app/views/admin/communication/blocks/templates/locations/_edit.html.erb b/app/views/admin/communication/blocks/templates/locations/_edit.html.erb index e2762cc07..17f4370e2 100644 --- a/app/views/admin/communication/blocks/templates/locations/_edit.html.erb +++ b/app/views/admin/communication/blocks/templates/locations/_edit.html.erb @@ -25,7 +25,5 @@ <%= osuny_separator %> <%= osuny_small_panel t('admin.communication.blocks.components.layouts.label') do %> <%= block_component_edit block, :layout %> - <%= osuny_label t('admin.communication.blocks.display_options.title') %> - <%= block_component_edit block, :option_image, label: Administration::Location::Localization.human_attribute_name(:featured_image) %> - <%= block_component_edit block, :option_summary, label: t('admin.summary.label') %> + <%= render 'admin/communication/blocks/templates/locations/options', block: block %> <% end %> \ No newline at end of file diff --git a/app/views/admin/communication/blocks/templates/locations/_options.html.erb b/app/views/admin/communication/blocks/templates/locations/_options.html.erb new file mode 100644 index 000000000..f244005d9 --- /dev/null +++ b/app/views/admin/communication/blocks/templates/locations/_options.html.erb @@ -0,0 +1,3 @@ +<%= osuny_label t('admin.communication.blocks.display_options.title') %> +<%= block_component_edit block, :option_image, label: Administration::Location::Localization.human_attribute_name(:featured_image) %> +<%= block_component_edit block, :option_summary, label: t('admin.summary.label') %> diff --git a/app/views/admin/communication/blocks/templates/organizations/_edit.html.erb b/app/views/admin/communication/blocks/templates/organizations/_edit.html.erb index 41d6de0ec..67c687f42 100644 --- a/app/views/admin/communication/blocks/templates/organizations/_edit.html.erb +++ b/app/views/admin/communication/blocks/templates/organizations/_edit.html.erb @@ -57,21 +57,12 @@ <%= osuny_separator %> <%= osuny_small_panel t('admin.communication.blocks.components.layouts.label') do %> <%= block_component_edit block, :layout %> - <%= osuny_label t('admin.communication.blocks.display_options.title') %> -
-
- <%= block_component_edit block, :option_logo %> - <%= block_component_edit block, :option_link %> -
-
- <%= block_component_edit block, :option_summary, label: t('admin.summary.label') %> - <%= block_component_edit block, :option_address %> -
- <%= block_component_edit block, :option_filters %> -
-
- <%= block_component_edit block, :alphabetical %> -
-
+ <%= render 'admin/communication/blocks/templates/organizations/options', block: block %> + <%= block_component_edit block, :option_link %> +
+ <%= block_component_edit block, :alphabetical %> +
+
+ <%= block_component_edit block, :option_filters %>
<% end %> diff --git a/app/views/admin/communication/blocks/templates/organizations/_options.html.erb b/app/views/admin/communication/blocks/templates/organizations/_options.html.erb new file mode 100644 index 000000000..27d2a0dcd --- /dev/null +++ b/app/views/admin/communication/blocks/templates/organizations/_options.html.erb @@ -0,0 +1,4 @@ +<%= osuny_label t('admin.communication.blocks.display_options.title') %> +<%= block_component_edit block, :option_logo, label: University::Organization.human_attribute_name(:logo) %> +<%= block_component_edit block, :option_summary, label: t('admin.summary.label') %> +<%= block_component_edit block, :option_address %> diff --git a/app/views/admin/communication/blocks/templates/pages/_edit.html.erb b/app/views/admin/communication/blocks/templates/pages/_edit.html.erb index a24d76640..e4d2afdba 100644 --- a/app/views/admin/communication/blocks/templates/pages/_edit.html.erb +++ b/app/views/admin/communication/blocks/templates/pages/_edit.html.erb @@ -41,9 +41,6 @@ <%= osuny_separator %> <%= osuny_small_panel t('admin.communication.blocks.components.layouts.label') do %> <%= block_component_edit block, :layout %> - <%= osuny_label t('admin.communication.blocks.display_options.title') %> + <%= render 'admin/communication/blocks/templates/pages/options', block: block %> <%= block_component_edit block, :option_main_summary %> - <%= block_component_edit block, :option_image %> - <%= block_component_edit block, :option_summary %> - <%= block_component_edit block, :option_categories %> <% end %> \ No newline at end of file diff --git a/app/views/admin/communication/blocks/templates/pages/_options.html.erb b/app/views/admin/communication/blocks/templates/pages/_options.html.erb new file mode 100644 index 000000000..219599a56 --- /dev/null +++ b/app/views/admin/communication/blocks/templates/pages/_options.html.erb @@ -0,0 +1,4 @@ +<%= osuny_label t('admin.communication.blocks.display_options.title') %> +<%= block_component_edit block, :option_image, label: Communication::Website::Page::Localization.human_attribute_name(:featured_image) %> +<%= block_component_edit block, :option_summary, label: t('admin.summary.label') %> +<%= block_component_edit block, :option_categories %> diff --git a/app/views/admin/communication/blocks/templates/pages/_static.html.erb b/app/views/admin/communication/blocks/templates/pages/_static.html.erb index d7f6d01fa..18f6361d4 100644 --- a/app/views/admin/communication/blocks/templates/pages/_static.html.erb +++ b/app/views/admin/communication/blocks/templates/pages/_static.html.erb @@ -1,3 +1,5 @@ + layout: <%= block.template.layout %> +<%= block_options_static block %> <% if block.template.page page = block.template.page diff --git a/app/views/admin/communication/blocks/templates/persons/_edit.html.erb b/app/views/admin/communication/blocks/templates/persons/_edit.html.erb index 061b641be..eb1adebc8 100644 --- a/app/views/admin/communication/blocks/templates/persons/_edit.html.erb +++ b/app/views/admin/communication/blocks/templates/persons/_edit.html.erb @@ -44,18 +44,8 @@ <%= osuny_separator %> <%= osuny_small_panel t('admin.communication.blocks.components.layouts.label') do %> <%= block_component_edit block, :layout %> - <%= osuny_label t('admin.communication.blocks.display_options.title') %> -
-
- <%= block_component_edit block, :option_image %> - <%= block_component_edit block, :option_summary, label: t('admin.summary.label') %> -
- <%= block_component_edit block, :alphabetical %> -
-
-
- <%= block_component_edit block, :option_link %> - <%= block_component_edit block, :option_contact %> -
+ <%= render 'admin/communication/blocks/templates/persons/options', block: block %> +
+ <%= block_component_edit block, :alphabetical %>
<% end %> \ No newline at end of file diff --git a/app/views/admin/communication/blocks/templates/persons/_options.html.erb b/app/views/admin/communication/blocks/templates/persons/_options.html.erb new file mode 100644 index 000000000..cf6bccc87 --- /dev/null +++ b/app/views/admin/communication/blocks/templates/persons/_options.html.erb @@ -0,0 +1,11 @@ +<%= osuny_label t('admin.communication.blocks.display_options.title') %> +
+
+ <%= block_component_edit block, :option_image, label: University::Person.human_attribute_name(:photo) %> + <%= block_component_edit block, :option_summary, label: t('admin.summary.label') %> +
+
+ <%= block_component_edit block, :option_contact %> + <%= block_component_edit block, :option_link %> +
+
diff --git a/app/views/admin/communication/blocks/templates/posts/_edit.html.erb b/app/views/admin/communication/blocks/templates/posts/_edit.html.erb index 12254ae9d..c85f56536 100644 --- a/app/views/admin/communication/blocks/templates/posts/_edit.html.erb +++ b/app/views/admin/communication/blocks/templates/posts/_edit.html.erb @@ -1,10 +1,10 @@ <%= block_component_edit block, :mode %>
-
+
<%= block_component_edit block, :posts_quantity %>
-
+
<%= block_component_edit block, :category_id %>
@@ -34,19 +34,6 @@ <%= osuny_separator %> <%= osuny_small_panel t('admin.communication.blocks.components.layouts.label') do %> <%= block_component_edit block, :layout %> - <%= osuny_label t('admin.communication.blocks.display_options.title') %> -
-
- <%= block_component_edit block, :option_image, label: Communication::Website::Post::Localization.human_attribute_name(:featured_image) %> - <%= block_component_edit block, :option_subtitle, label: Communication::Website::Post::Localization.human_attribute_name(:subtitle) %> - <%= block_component_edit block, :option_summary, label: t('admin.summary.label') %> - <%= block_component_edit block, :option_author, label: Communication::Website::Post.human_attribute_name(:authors) %> -
-
- <%= block_component_edit block, :option_date, label: Communication::Website::Post::Localization.human_attribute_name(:date) %> - <%= block_component_edit block, :option_categories, label: Communication::Website::Post.human_attribute_name(:categories) %> - <%= block_component_edit block, :option_reading_time, label: Communication::Website::Post::Localization.human_attribute_name(:reading_time) %> -
-
+ <%= render 'admin/communication/blocks/templates/posts/options', block: block %> <% end %>
\ No newline at end of file diff --git a/app/views/admin/communication/blocks/templates/posts/_options.html.erb b/app/views/admin/communication/blocks/templates/posts/_options.html.erb new file mode 100644 index 000000000..096789665 --- /dev/null +++ b/app/views/admin/communication/blocks/templates/posts/_options.html.erb @@ -0,0 +1,14 @@ +<%= osuny_label t('admin.communication.blocks.display_options.title') %> +
+
+ <%= block_component_edit block, :option_image, label: Communication::Website::Post::Localization.human_attribute_name(:featured_image) %> + <%= block_component_edit block, :option_subtitle, label: Communication::Website::Post::Localization.human_attribute_name(:subtitle) %> + <%= block_component_edit block, :option_summary, label: t('admin.summary.label') %> + <%= block_component_edit block, :option_date, label: Communication::Website::Post::Localization.human_attribute_name(:date) %> +
+
+ <%= block_component_edit block, :option_author, label: Communication::Website::Post.human_attribute_name(:authors) %> + <%= block_component_edit block, :option_categories, label: Communication::Website::Post.human_attribute_name(:categories) %> + <%= block_component_edit block, :option_reading_time, label: Communication::Website::Post::Localization.human_attribute_name(:reading_time) %> +
+
diff --git a/app/views/admin/communication/blocks/templates/programs/_edit.html.erb b/app/views/admin/communication/blocks/templates/programs/_edit.html.erb index 7408fe376..53f07d9d5 100644 --- a/app/views/admin/communication/blocks/templates/programs/_edit.html.erb +++ b/app/views/admin/communication/blocks/templates/programs/_edit.html.erb @@ -25,8 +25,5 @@ <%= osuny_separator %> <%= osuny_small_panel t('admin.communication.blocks.components.layouts.label') do %> <%= block_component_edit block, :layout %> - <%= osuny_label t('admin.communication.blocks.display_options.title') %> - <%= block_component_edit block, :option_image, label: Education::Program::Localization.human_attribute_name(:featured_image) %> - <%= block_component_edit block, :option_summary, label: t('admin.summary.label') %> - <%= block_component_edit block, :option_diploma, label: Education::Program.human_attribute_name(:diploma) %> + <%= render 'admin/communication/blocks/templates/programs/options', block: block %> <% end %> \ No newline at end of file diff --git a/app/views/admin/communication/blocks/templates/programs/_options.html.erb b/app/views/admin/communication/blocks/templates/programs/_options.html.erb new file mode 100644 index 000000000..4a82c5512 --- /dev/null +++ b/app/views/admin/communication/blocks/templates/programs/_options.html.erb @@ -0,0 +1,4 @@ +<%= osuny_label t('admin.communication.blocks.display_options.title') %> +<%= block_component_edit block, :option_image, label: Education::Program::Localization.human_attribute_name(:featured_image) %> +<%= block_component_edit block, :option_summary, label: t('admin.summary.label') %> +<%= block_component_edit block, :option_diploma, label: Education::Program.human_attribute_name(:diploma) %> diff --git a/app/views/admin/communication/blocks/templates/projects/_edit.html.erb b/app/views/admin/communication/blocks/templates/projects/_edit.html.erb index 466b8d239..413b2953f 100644 --- a/app/views/admin/communication/blocks/templates/projects/_edit.html.erb +++ b/app/views/admin/communication/blocks/templates/projects/_edit.html.erb @@ -30,17 +30,6 @@ <%= osuny_separator %> <%= osuny_small_panel t('admin.communication.blocks.components.layouts.label') do %> <%= block_component_edit block, :layout %> - <%= osuny_label t('admin.communication.blocks.display_options.title') %> -
-
- <%= block_component_edit block, :option_image, label: Communication::Website::Portfolio::Project::Localization.human_attribute_name(:featured_image) %> - <%= block_component_edit block, :option_subtitle, label: Communication::Website::Portfolio::Project::Localization.human_attribute_name(:subtitle) %> - <%= block_component_edit block, :option_summary, label: t('admin.summary.label') %> -
-
- <%= block_component_edit block, :option_categories, label: Communication::Website::Portfolio::Project.human_attribute_name(:categories) %> - <%= block_component_edit block, :option_year, label: Communication::Website::Portfolio::Project.human_attribute_name(:year) %> -
-
+ <%= render 'admin/communication/blocks/templates/projects/options', block: block %> <% end %>
\ No newline at end of file diff --git a/app/views/admin/communication/blocks/templates/projects/_options.html.erb b/app/views/admin/communication/blocks/templates/projects/_options.html.erb new file mode 100644 index 000000000..fe773cb0d --- /dev/null +++ b/app/views/admin/communication/blocks/templates/projects/_options.html.erb @@ -0,0 +1,12 @@ +<%= osuny_label t('admin.communication.blocks.display_options.title') %> +
+
+ <%= block_component_edit block, :option_image, label: Communication::Website::Portfolio::Project::Localization.human_attribute_name(:featured_image) %> + <%= block_component_edit block, :option_subtitle, label: Communication::Website::Portfolio::Project::Localization.human_attribute_name(:subtitle) %> + <%= block_component_edit block, :option_summary, label: t('admin.summary.label') %> +
+
+ <%= block_component_edit block, :option_categories, label: Communication::Website::Portfolio::Project.human_attribute_name(:categories) %> + <%= block_component_edit block, :option_year, label: Communication::Website::Portfolio::Project.human_attribute_name(:year) %> +
+
diff --git a/app/views/admin/communication/websites/edit_language.html.erb b/app/views/admin/communication/websites/edit_language.html.erb index ae6063247..220a8fcf8 100644 --- a/app/views/admin/communication/websites/edit_language.html.erb +++ b/app/views/admin/communication/websites/edit_language.html.erb @@ -6,7 +6,6 @@ <%= f.error_notification message: f.object.errors[:base].to_sentence if f.object.errors[:base].present? %> <%= lf.hidden_field :language_id, value: current_language.id %> -
<%= lf.input :name %> diff --git a/app/views/admin/communication/websites/pages/_form.html.erb b/app/views/admin/communication/websites/pages/_form.html.erb index 67df16d88..0b0f8ecde 100644 --- a/app/views/admin/communication/websites/pages/_form.html.erb +++ b/app/views/admin/communication/websites/pages/_form.html.erb @@ -10,7 +10,7 @@ url = page.new_record? ? admin_communication_website_pages_path <%= lf.hidden_field :language_id, value: current_language.id %>
-
+
<%= osuny_panel t('content') do %> <%= lf.input :title, input_html: { data: { translatable: true } } %> <%= lf.input :breadcrumb_title, input_html: { data: { translatable: true } } %> @@ -20,9 +20,17 @@ url = page.new_record? ? admin_communication_website_pages_path <%= lf.input :text, as: :summernote if strip_tags(l10n.text).present? %> <% end %> <%= render 'admin/application/categories/widget/form', f: f, categories: @categories %> - <%= render 'admin/application/meta_description/form', f: lf, about: l10n %> + <%= render 'admin/communication/websites/pages/design_options/form', f: f, about: page %> +
+
+ <%= render 'admin/application/meta_description/form', f: lf, about: l10n %> +
+
+ <%= render 'admin/application/images/shared/form', f: lf, about: @l10n %> +
+
-
+
<%= osuny_panel t('metadata') do %> <%= lf.input :published, label: t('publication.published'), @@ -40,7 +48,6 @@ url = page.new_record? ? admin_communication_website_pages_path <%= f.input :bodyclass, label: t('admin.bodyclass') if can?(:edit, @website) %> <%= f.input :full_width if page.editable_width? %> <% end %> - <%= render 'admin/application/images/shared/form', f: lf, about: @l10n %>
diff --git a/app/views/admin/communication/websites/pages/design_options/_form.html.erb b/app/views/admin/communication/websites/pages/design_options/_form.html.erb new file mode 100644 index 000000000..9425c2176 --- /dev/null +++ b/app/views/admin/communication/websites/pages/design_options/_form.html.erb @@ -0,0 +1,24 @@ +<% +if about.design_options? + @kind = @page.design_options_block_template_kind + @block = @page.design_options_block + @data = @page.design_options + %> +
+ <%= block_component_edit @block, :layout %> + <%= render "admin/communication/blocks/templates/#{@kind}/options", block: @block %> + +
+ <%# Include vue.js before calling Vue.createApp %> + <%= javascript_include_tag 'vue' %> + +<% end %> \ No newline at end of file diff --git a/app/views/admin/communication/websites/pages/design_options/_show.html.erb b/app/views/admin/communication/websites/pages/design_options/_show.html.erb new file mode 100644 index 000000000..48fff96cc --- /dev/null +++ b/app/views/admin/communication/websites/pages/design_options/_show.html.erb @@ -0,0 +1,11 @@ +<% +if about.design_options? + kind = about.design_options_block_template_kind + %> +
+

+ <%= osuny_label t('admin.communication.blocks.components.layouts.label') %>
+ <%= t "admin.communication.blocks.templates.#{kind}.layouts.#{about.design_options_layout}.label" %> +

+
+<% end %> \ No newline at end of file diff --git a/app/views/admin/communication/websites/pages/design_options/_static.html.erb b/app/views/admin/communication/websites/pages/design_options/_static.html.erb new file mode 100644 index 000000000..b254e9a76 --- /dev/null +++ b/app/views/admin/communication/websites/pages/design_options/_static.html.erb @@ -0,0 +1,7 @@ +<% if about.design_options? %> + layout: "<%= about.design_options_layout %>" + options: +<% about.design_options_hash.each do |key, value| %> + <%= key %>: <%= value %> +<% end %> +<% end %> diff --git a/app/views/admin/communication/websites/pages/show.html.erb b/app/views/admin/communication/websites/pages/show.html.erb index 8b2e7a638..1c5883625 100644 --- a/app/views/admin/communication/websites/pages/show.html.erb +++ b/app/views/admin/communication/websites/pages/show.html.erb @@ -30,6 +30,7 @@

<%= @l10n.title %>

<%= render 'admin/application/property/publication', about: @l10n %> <% end %> + <%= render 'admin/communication/websites/pages/design_options/show', about: @page %>
<%= render 'admin/application/images/featured/show', about: @l10n %> @@ -47,6 +48,7 @@ <%= render 'admin/application/meta_description/show', about: @l10n %>
+ <%= render 'admin/communication/contents/editor', about: @l10n %> <%= render 'admin/communication/websites/pages/show/special_page' %> diff --git a/app/views/admin/communication/websites/pages/show/_special_page.html.erb b/app/views/admin/communication/websites/pages/show/_special_page.html.erb index c9771d914..0ca7b58d3 100644 --- a/app/views/admin/communication/websites/pages/show/_special_page.html.erb +++ b/app/views/admin/communication/websites/pages/show/_special_page.html.erb @@ -19,5 +19,11 @@ # il faut envoyer un tableau vide, qui est la valeur par défaut, pour mettre le troisième argument `partial` à true exists = lookup_context.exists? path, [], true %> - <%= render path if exists %> + <% if exists %> +
+
+ <%= render path %> +
+
+ <% end %> <% end %> \ No newline at end of file diff --git a/app/views/admin/communication/websites/pages/static.html.erb b/app/views/admin/communication/websites/pages/static.html.erb index 1126f5e36..2691677ac 100644 --- a/app/views/admin/communication/websites/pages/static.html.erb +++ b/app/views/admin/communication/websites/pages/static.html.erb @@ -6,9 +6,8 @@ breadcrumb_title: >- <%= prepare_text_for_static @l10n.best_breadcrumb_title %> <%= render 'admin/application/static/core', about: @l10n %> <%= render 'admin/application/static/breadcrumbs', about: @l10n %> -<%= render 'admin/application/static/design', - about: page, - l10n: @l10n %> +<%= render 'admin/application/static/design', about: page, l10n: @l10n %> +<%= render 'admin/communication/websites/pages/design_options/static', about: page %> <% if page.static_layout %> layout: <%= page.static_layout %> <% end %> diff --git a/config/locales/communication/blocks/en.yml b/config/locales/communication/blocks/en.yml index 4a6d789de..7ca1ea8cb 100644 --- a/config/locales/communication/blocks/en.yml +++ b/config/locales/communication/blocks/en.yml @@ -607,6 +607,8 @@ en: label: Page none: No page title: Selected pages + show_main_summary: + label: Show main page summary layouts: alternate: description: Pages either on the left or on the right, composing a graphically light layout. @@ -664,15 +666,13 @@ en: category: A specific category selection: A selection of persons option_contact: - label: "With contact information for each person?" - option_image: - label: With a portrait for each person? + label: Contact information option_link: - label: Clickable link to person's page + label: Clickable link options: Display options layouts: grid: - description: As a grid, left to right and top to bottom. + description: A grid of persons, with circular photos the same size. label: Grid large: description: Each person is presented in majesty, across the full width available, with a large image. diff --git a/config/locales/communication/blocks/fr.yml b/config/locales/communication/blocks/fr.yml index f7bdf628d..8308270bb 100644 --- a/config/locales/communication/blocks/fr.yml +++ b/config/locales/communication/blocks/fr.yml @@ -607,6 +607,8 @@ fr: label: Page none: Aucune page title: Pages sélectionnées + show_main_summary: + label: Afficher le résumé de la page principale layouts: alternate: description: Une alternance très légère graphiquement de pages, rythmée entre la gauche et la droite. @@ -664,11 +666,9 @@ fr: category: Une catégorie spécifique selection: Une sélection de personnes option_contact: - label: "Avec les informations de contact de chaque personne\_?" - option_image: - label: "Avec un portrait de chaque personne\_?" + label: Informations de contact option_link: - label: Lien cliquable vers la page de la personne + label: Lien cliquable options: Options d'affichage layouts: grid: diff --git a/config/locales/communication/en.yml b/config/locales/communication/en.yml index aada5c7b3..293b6ae59 100644 --- a/config/locales/communication/en.yml +++ b/config/locales/communication/en.yml @@ -741,7 +741,7 @@ en: item: kind: administrators: Administration staff - authors: Editorial staff + authors: Authors blank: Title category: News category diploma: Specific diploma @@ -756,8 +756,8 @@ en: posts: News index program: Specific program programs: Programs index - researchers: Research staff - teachers: Educational staff + researchers: Researchers + teachers: Teachers url: URL volume: Specific research volume volumes: Research volumes index diff --git a/db/migrate/20241123061523_add_options_to_communication_website_pages.rb b/db/migrate/20241123061523_add_options_to_communication_website_pages.rb new file mode 100644 index 000000000..fbf65984b --- /dev/null +++ b/db/migrate/20241123061523_add_options_to_communication_website_pages.rb @@ -0,0 +1,5 @@ +class AddOptionsToCommunicationWebsitePages < ActiveRecord::Migration[7.2] + def change + add_column :communication_website_pages, :design_options, :jsonb + end +end diff --git a/db/schema.rb b/db/schema.rb index cb9b09d06..6a8ab87b2 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -1132,6 +1132,7 @@ t.string "type" t.string "migration_identifier" t.integer "position_in_tree" + t.jsonb "design_options" t.datetime "deleted_at" 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"