diff --git a/app/models/communication/website/page.rb b/app/models/communication/website/page.rb index badd0b135c70deec239552b2088e3382237740fd..ad4e22bd9ef15307423e01999ed6457684374a37 100644 --- a/app/models/communication/website/page.rb +++ b/app/models/communication/website/page.rb @@ -126,7 +126,7 @@ class Communication::Website::Page < ApplicationRecord dependencies += website.education_programs if kind_education_programs? dependencies += [parent] if has_parent? dependencies += [website.config_permalinks] if is_special_page? - dependencies + dependencies.flatten end def git_destroy_dependencies(website) diff --git a/app/views/admin/application/_dependencies.html.erb b/app/views/admin/application/_dependencies.html.erb new file mode 100644 index 0000000000000000000000000000000000000000..2247b2c3983cad8bd8fcd0f762c0b8403716acd0 --- /dev/null +++ b/app/views/admin/application/_dependencies.html.erb @@ -0,0 +1,58 @@ +<% +expanded ||= false +%> +<% if current_user.server_admin? %> + <div class="card flex-fill w-100"> + <div class="card-header"> + <div class="card-actions float-end"> + <button class="accordion-button bg-transparent <%= 'collapsed' unless expanded %> mt-n1" + type="button" + data-bs-toggle="collapse" + data-bs-target="#dependencies" + aria-expanded="<%= expanded %>" + aria-controls="dependencies"> + </button> + </div> + <h2 class="card-title mb-0 h5">Dependencies</h2> + </div> + <div class="card-body collapse <%= 'show' if expanded %>" id="dependencies"> + <h2 class="h5">git_dependencies</h2> + <table class="table"> + <thead> + <tr> + <th>Id</th> + <th>Class</th> + <th>Name</th> + </tr> + </thead> + <tbody> + <% git_dependencies.each do |dependency| %> + <tr> + <td><%= dependency.id %></td> + <td><%= dependency.class %></td> + <td><%= dependency.to_s %></td> + </tr> + <% end %> + </tbody> + </table> + + <h2 class="h5 mt-5">active_storage_blobs</h2> + <table class="table"> + <thead> + <tr> + <th>Id</th> + <th>Filename</th> + </tr> + </thead> + <tbody> + <% active_storage_blobs.each do |blob| %> + <tr> + <td><%= blob.id %></td> + <td><%= blob.filename %></td> + </tr> + <% end %> + </tbody> + </table> + </div> + </div> +<% end %> \ No newline at end of file diff --git a/app/views/admin/communication/blocks/show.html.erb b/app/views/admin/communication/blocks/show.html.erb index 6b358527c2bc1d1de25e1741831aeae6837305ef..42dcbe027f2c599ba34cf4f1ef9cbd9d2dc5e796 100644 --- a/app/views/admin/communication/blocks/show.html.erb +++ b/app/views/admin/communication/blocks/show.html.erb @@ -1,42 +1,9 @@ <% content_for :title, @block %> -<h2>git_dependencies</h2> -<table class="table"> - <thead> - <tr> - <th>Id</th> - <th>Class</th> - <th>Name</th> - </tr> - </thead> - <tbody> - <% @block.template.git_dependencies.each do |dependency| %> - <tr> - <td><%= dependency.id %></td> - <td><%= dependency.class %></td> - <td><%= dependency.to_s %></td> - </tr> - <% end %> - </tbody> -</table> - -<h2>active_storage_blobs</h2> -<table class="table"> - <thead> - <tr> - <th>Id</th> - <th>Filename</th> - </tr> - </thead> - <tbody> - <% @block.template.active_storage_blobs.each do |blob| %> - <tr> - <td><%= blob.id %></td> - <td><%= blob.filename %></td> - </tr> - <% end %> - </tbody> -</table> +<%= render 'admin/application/dependencies', + git_dependencies: @block.template.git_dependencies, + active_storage_blobs: @block.template.active_storage_blobs, + expanded: true %> <% content_for :action_bar_right do %> <%= edit_link @block %> diff --git a/app/views/admin/communication/websites/pages/show.html.erb b/app/views/admin/communication/websites/pages/show.html.erb index fb7289a8af95548992dcce722c1e19bc43c6410b..bad7daf9c86e566b09b225c022c2b809f09d87da 100644 --- a/app/views/admin/communication/websites/pages/show.html.erb +++ b/app/views/admin/communication/websites/pages/show.html.erb @@ -28,6 +28,9 @@ </div> </div> <%= render 'admin/communication/blocks/list', about: @page %> + <%= render 'admin/application/dependencies', + git_dependencies: @page.git_dependencies(@page.website), + active_storage_blobs: @page.active_storage_blobs %> </div> <div class="col-md-4"> <%= render 'admin/application/a11y/widget', about: @page %>