diff --git a/app/views/admin/application/connections/_list.html.erb b/app/views/admin/application/connections/_list.html.erb index bcf496e4bb59b790498ee699ae6386e6cda28b53..699fbf3d53b981ed3e06005fb6408431acc2d016 100644 --- a/app/views/admin/application/connections/_list.html.erb +++ b/app/views/admin/application/connections/_list.html.erb @@ -1,7 +1,20 @@ <%= osuny_panel Communication::Website::Connection.model_name.human(count: 2) do %> - <ul class="list-unstyled"> - <% about.websites.each do |website| %> - <li><%= link_to website, [:admin, website] %></li> - <% end %> - </ul> + <table class="table"> + <thead> + <tr> + <th><%= Communication::Website.model_name.human %></th> + <th><%= Communication::Website::Connection.human_attribute_name('direct_source_type') %></th> + <th><%= Communication::Website::Connection.human_attribute_name('direct_source') %></th> + </tr> + </thead> + <tbody> + <% about.connections.each do |connection| %> + <tr> + <td><%= link_to connection.website, [:admin, connection.website] %></td> + <td><%= connection.direct_source_type %><%= connection.direct_source_type.constantize.model_name.human unless connection.direct_source_type.nil? %></td> + <td><%= render 'admin/communication/websites/connections/direct_source', connection: connection %></td> + </tr> + <% end %> + </tbody> + </table> <% end if about.websites.any? %> \ No newline at end of file diff --git a/app/views/admin/communication/websites/connections/_direct_source.html.erb b/app/views/admin/communication/websites/connections/_direct_source.html.erb new file mode 100644 index 0000000000000000000000000000000000000000..4b51b14a65447b22a04d9d3d7df36c3c7f86e609 --- /dev/null +++ b/app/views/admin/communication/websites/connections/_direct_source.html.erb @@ -0,0 +1,16 @@ +<% +source = connection.direct_source +source_name = source.to_s +begin + case connection.direct_source_type + when 'Communication::Website::Page' + source_link = admin_communication_website_page_path(website_id: source.website.id, id: source.id, lang: current_language) + when 'Communication::Website::Post' + source_link = admin_communication_website_post_path(website_id: source.website.id, id: source.id, lang: current_language) + else + source_link = url_for [:admin, source] + end +rescue +end +%> +<%= link_to_if source_link, source_name, source_link %> diff --git a/app/views/admin/communication/websites/connections/_indirect_object.html.erb b/app/views/admin/communication/websites/connections/_indirect_object.html.erb new file mode 100644 index 0000000000000000000000000000000000000000..8c4794ce55e4b3ff70781a7dab69f3da93db8d7a --- /dev/null +++ b/app/views/admin/communication/websites/connections/_indirect_object.html.erb @@ -0,0 +1,10 @@ +<% +object = connection.indirect_object +object_name = object.to_s +object_name = object.id if object.is_a?(ActiveStorage::Blob) +begin + object_link = url_for [:admin, object] +rescue +end +%> +<%= link_to_if object_link, object_name, object_link %> \ No newline at end of file diff --git a/app/views/admin/communication/websites/connections/_list.html.erb b/app/views/admin/communication/websites/connections/_list.html.erb index db0b18e6a3a0ee2fa44ee50a810c8d7c3573929e..98006e373e4f7265612b68dc4e5d19b361ce9093 100644 --- a/app/views/admin/communication/websites/connections/_list.html.erb +++ b/app/views/admin/communication/websites/connections/_list.html.erb @@ -10,30 +10,15 @@ </thead> <tbody> <% connections.each do |connection| %> - <% - object = connection.indirect_object - object_name = object.to_s - object_name = object.id if object.is_a?(ActiveStorage::Blob) - begin - object_link = url_for [:admin, object] - rescue - end - source = connection.direct_source - source_name = source.to_s - begin - source_link = url_for [:admin, source] - rescue - end - %> <tr> <td><%= link_to connection, [:admin, connection] %></td> <td> - <%= link_to_if object_link, object_name, object_link %><br> - <span class="small"><%= connection.indirect_object_type %></span> + <%= render 'admin/communication/websites/connections/indirect_object', connection: connection %> + <br><span class="small"><%= connection.indirect_object_type %></span> </td> <td> - <%= link_to_if source_link, source_name, source_link %><br> - <span class="small"><%= connection.direct_source_type %></span> + <%= render 'admin/communication/websites/connections/direct_source', connection: connection %> + <br><span class="small"><%= connection.direct_source_type %></span> </td> <td><%= l connection.updated_at %></td> </tr> diff --git a/app/views/admin/university/organizations/show.html.erb b/app/views/admin/university/organizations/show.html.erb index dccb51446de3a8d610129d8c7ca84e5fe53b5be7..ad1e87d7bd072ec28c73a940407299cfe71af7e2 100644 --- a/app/views/admin/university/organizations/show.html.erb +++ b/app/views/admin/university/organizations/show.html.erb @@ -82,6 +82,8 @@ <% end %> <%= render 'admin/communication/blocks/list', about: @organization %> + + <%= render 'admin/application/connections/list', about: @organization %> </div> <div class="col-md-4"> @@ -118,8 +120,6 @@ <% end if @organization.logo.attached? || @organization.logo_on_dark_background.attached? %> <%= render 'admin/application/meta_description/show', about: @organization %> - - <%= render 'admin/application/connections/list', about: @organization %> </div> </div> diff --git a/app/views/admin/university/people/show.html.erb b/app/views/admin/university/people/show.html.erb index 485f258b582b51e840b49709353e2089e7ca5581..6ed9080961343f971cd1739edfcee5fef9f41a0c 100644 --- a/app/views/admin/university/people/show.html.erb +++ b/app/views/admin/university/people/show.html.erb @@ -31,6 +31,8 @@ action += link_to t('university.manage_experiences'), <%= render 'admin/university/people/experiences/list', experiences: @person.experiences.ordered %> <% end %> +<%= render 'admin/application/connections/list', about: @person %> + <% content_for :action_bar_left do %> <%= destroy_link @person %> <%= static_link static_admin_university_person_path(@person) %>