From 1d6763008d813e97e0f5e77d930993614731d9c1 Mon Sep 17 00:00:00 2001 From: Arnaud Levy <contact@arnaudlevy.com> Date: Mon, 13 Feb 2023 16:03:33 +0100 Subject: [PATCH] fix --- app/controllers/admin/education/diplomas_controller.rb | 7 +------ app/views/admin/education/diplomas/_programs.html.erb | 2 +- app/views/admin/education/diplomas/static.html.erb | 7 ++++++- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/app/controllers/admin/education/diplomas_controller.rb b/app/controllers/admin/education/diplomas_controller.rb index 19c764174..0898fac6f 100644 --- a/app/controllers/admin/education/diplomas_controller.rb +++ b/app/controllers/admin/education/diplomas_controller.rb @@ -14,12 +14,7 @@ class Admin::Education::DiplomasController < Admin::Education::ApplicationContro def static @about = @diploma @website = @diploma.websites&.first - if @website.nil? - redirect_to [:admin, @diploma] - else - @programs = @website.education_programs.root.ordered - render layout: false - end + render layout: false end def new diff --git a/app/views/admin/education/diplomas/_programs.html.erb b/app/views/admin/education/diplomas/_programs.html.erb index b7797ebc5..45c74bd2c 100644 --- a/app/views/admin/education/diplomas/_programs.html.erb +++ b/app/views/admin/education/diplomas/_programs.html.erb @@ -9,6 +9,6 @@ indentation = ' ' * depth <% children = program.children.ordered %> <% if children.any? %> <%= indentation %> children: -<%= render 'programs', programs: program.children.ordered, depth: depth + 4 %> +<%= render 'admin/education/diplomas/programs', programs: program.children.ordered, depth: depth + 4 %> <% end %> <% end %> diff --git a/app/views/admin/education/diplomas/static.html.erb b/app/views/admin/education/diplomas/static.html.erb index 569e6db89..38deaae71 100644 --- a/app/views/admin/education/diplomas/static.html.erb +++ b/app/views/admin/education/diplomas/static.html.erb @@ -1,10 +1,15 @@ --- title: > <%= prepare_text_for_static @about.name %> -<%= render 'admin/application/static/permalink' %> +<%= render 'admin/application/static/permalink' if @website %> <%= render 'admin/application/static/design', full_width: true, toc_offcanvas: true %> +<% +if @website + @programs = @website.education_programs.root.ordered +%> programs: <%= render 'admin/education/diplomas/programs', programs: @programs, depth: 2 %> +<% end %> short_name: > <%= prepare_text_for_static @about.short_name %> <%= render 'admin/application/summary/static' %> -- GitLab