diff --git a/app/models/concerns/with_blocks.rb b/app/models/concerns/with_blocks.rb index faa5518b94a6178eb6f03625c2b933851d4c2b85..81d3707d1de134ad434b4ee707fd9cfce073b78f 100644 --- a/app/models/concerns/with_blocks.rb +++ b/app/models/concerns/with_blocks.rb @@ -8,4 +8,9 @@ module WithBlocks def git_block_dependencies blocks.collect &:git_dependencies end + + # Basic rule is: TOC if 2 titles or more + def show_toc? + (blocks.collect(&:title).uniq.compact - ['']).many? + end end diff --git a/app/views/admin/communication/websites/categories/static.html.erb b/app/views/admin/communication/websites/categories/static.html.erb index 482d80b62b7a80336531551cd852640bef6ac796..48296bc4384393a72eff9fe88fdda194194ed0ff 100644 --- a/app/views/admin/communication/websites/categories/static.html.erb +++ b/app/views/admin/communication/websites/categories/static.html.erb @@ -1,6 +1,11 @@ --- title: "<%= @about.name %>" <%= render 'admin/application/static/permalink', forced_slug: @about.slug_with_ancestors_slugs %> +layout: + full_width: <%= @about.full_width %> + toc: + present: <%= @about.show_toc? %> + offcanvas: <%= !@about.full_width %> <% if @about.parent %> parent: "<%= @about.parent.path %>" <% end %> diff --git a/app/views/admin/communication/websites/pages/static.html.erb b/app/views/admin/communication/websites/pages/static.html.erb index ffa172256f9ba4d3837262ba51d39107da5e1de8..b2c2c29fe36429d83f50255e2eb0e876ef232a32 100644 --- a/app/views/admin/communication/websites/pages/static.html.erb +++ b/app/views/admin/communication/websites/pages/static.html.erb @@ -11,7 +11,11 @@ has: teachers: <%= @website.has_teachers? %> <% end %> position: <%= @about.position %> -full_width: <%= @about.full_width %> +layout: + full_width: <%= @about.full_width %> + toc: + offcanvas: <%= !@about.full_width %> + present: <%= @about.show_toc? %> bodyclass: <%= @about.best_bodyclass %> <%= render 'admin/communication/unsplash/static' %> <% if @about.children.published.any? %> diff --git a/app/views/admin/communication/websites/posts/static.html.erb b/app/views/admin/communication/websites/posts/static.html.erb index 414ff587104d180ffd77af5bfa3426cdb7c8a1bb..6d656aefb8de3f5209df7c52377d6d77eac7540a 100644 --- a/app/views/admin/communication/websites/posts/static.html.erb +++ b/app/views/admin/communication/websites/posts/static.html.erb @@ -1,6 +1,11 @@ --- title: "<%= @about.title %>" date: "<%= @about.published_at.iso8601 %>" +layout: + full_width: false + toc: + present: <%= @about.show_toc? %> + offcanvas: false <%= render 'admin/application/static/permalink' %> <% if @about.pinned %> weight: 1 diff --git a/app/views/admin/education/diplomas/static.html.erb b/app/views/admin/education/diplomas/static.html.erb index 894edd41403d600e2dd215fe499b13d985d4e5de..99527ec8242295a2513451e1fc57daf9a0c7ae3b 100644 --- a/app/views/admin/education/diplomas/static.html.erb +++ b/app/views/admin/education/diplomas/static.html.erb @@ -7,6 +7,11 @@ short_name: > <%= render 'admin/application/chapo/static' %> level: <%= @about.level_i18n %> ects: <%= @about.ects %> +layout: + full_width: true + toc: + present: <%= @about.show_toc? %> + offcanvas: true duration: > <%= prepare_text_for_static @about.duration %> <%= render 'admin/communication/blocks/static', about: @about %> diff --git a/app/views/admin/education/programs/static.html.erb b/app/views/admin/education/programs/static.html.erb index 4d6adbf4b5553e9f2d3a8f566e791ed9493b0431..2850a16016cc784db4f8cec93820e21b25399849 100644 --- a/app/views/admin/education/programs/static.html.erb +++ b/app/views/admin/education/programs/static.html.erb @@ -10,6 +10,11 @@ administrator_involvements = @about.involvements_through_roles title: > <%= @about.name %> url: <%= @about.path_in_website(@website) %> +layout: + full_width: false + toc: + present: <%= @about.show_toc? %> + offcanvas: true <% if @about.downloadable_summary.attached? %> downloadable_summary: <%= @about.downloadable_summary.blob_id %> <% end %> diff --git a/app/views/admin/university/people/administrators/static.html.erb b/app/views/admin/university/people/administrators/static.html.erb index efa819c710c16cbc5e0f446461b17caf4438812d..a2599f50b25d18b5f7e41c0ebc6c32a5f0697948 100644 --- a/app/views/admin/university/people/administrators/static.html.erb +++ b/app/views/admin/university/people/administrators/static.html.erb @@ -10,4 +10,9 @@ last_name: > <%= @about.last_name %> description: > <%= prepare_text_for_static @about.description %> +layout: + full_width: true + toc: + present: <%= @about.show_toc? %> + offcanvas: true --- diff --git a/app/views/admin/university/people/authors/static.html.erb b/app/views/admin/university/people/authors/static.html.erb index 1515d73efd810260e045a38093f87c028007aad7..1762135611a1c4e12b7ad9065cec4ebe2f7facc7 100644 --- a/app/views/admin/university/people/authors/static.html.erb +++ b/app/views/admin/university/people/authors/static.html.erb @@ -10,4 +10,9 @@ last_name: > <%= @about.last_name %> description: > <%= prepare_text_for_static @about.description %> +layout: + full_width: true + toc: + present: <%= @about.show_toc? %> + offcanvas: true --- diff --git a/app/views/admin/university/people/researchers/static.html.erb b/app/views/admin/university/people/researchers/static.html.erb index fcb6ac9f655eafbdd47827e47c717c008d91585e..d4333567b79a5fc235fefb51037bb88482dcb59e 100644 --- a/app/views/admin/university/people/researchers/static.html.erb +++ b/app/views/admin/university/people/researchers/static.html.erb @@ -10,4 +10,9 @@ last_name: > <%= @about.last_name %> description: > <%= prepare_text_for_static @about.description %> +layout: + full_width: true + toc: + present: <%= @about.show_toc? %> + offcanvas: true --- diff --git a/app/views/admin/university/people/static.html.erb b/app/views/admin/university/people/static.html.erb index 6bbe8ea29909047330bb95c25fa48ac41c98353b..b48c3d79d4dbb9ffc4fce0ec37e309010e36a223 100644 --- a/app/views/admin/university/people/static.html.erb +++ b/app/views/admin/university/people/static.html.erb @@ -22,6 +22,11 @@ image: "<%= @about.best_picture.blob.id %>" description: > <%= prepare_text_for_static @about.description %> <%= render 'admin/application/chapo/static' %> +layout: + full_width: true + toc: + present: <%= @about.show_toc? %> + offcanvas: true roles: <% if @about.author.for_website?(@website) %> - author diff --git a/app/views/admin/university/people/teachers/static.html.erb b/app/views/admin/university/people/teachers/static.html.erb index e5665c0e1aa82f5d7d79ce7c83057f59030a73c4..45a4e5e94411f3a8fe24c2b4dc6c8e0b490baa9e 100644 --- a/app/views/admin/university/people/teachers/static.html.erb +++ b/app/views/admin/university/people/teachers/static.html.erb @@ -10,4 +10,9 @@ last_name: > <%= @about.last_name %> description: > <%= prepare_text_for_static @about.description %> +layout: + full_width: true + toc: + present: <%= @about.show_toc? %> + offcanvas: true ---