From c66a2cf842cce30e735b66ae7f8ba6abe9764ee2 Mon Sep 17 00:00:00 2001 From: Finn Bacall Date: Tue, 28 Jul 2026 15:50:52 +0100 Subject: [PATCH 1/3] When viewing resources from another space, show space info On index pages and show page. --- app/assets/stylesheets/application.scss | 1 - app/helpers/spaces_helper.rb | 8 ++++++++ app/views/collections/_collection.html.erb | 1 + app/views/collections/show.html.erb | 1 + app/views/common/_space_info.erb | 18 ++++++++++++++++++ app/views/events/_event.html.erb | 1 + app/views/events/show.html.erb | 1 + .../_learning_path_topic.html.erb | 1 + app/views/learning_path_topics/show.html.erb | 1 + .../learning_paths/_learning_path.html.erb | 1 + app/views/learning_paths/show.html.erb | 1 + app/views/materials/_material.html.erb | 1 + app/views/materials/show.html.erb | 1 + app/views/sources/_source.html.erb | 1 + app/views/sources/show.html.erb | 1 + app/views/workflows/_workflow.html.erb | 1 + app/views/workflows/show.html.erb | 7 +++++++ config/locales/en.yml | 4 +++- 18 files changed, 49 insertions(+), 2 deletions(-) create mode 100644 app/views/common/_space_info.erb diff --git a/app/assets/stylesheets/application.scss b/app/assets/stylesheets/application.scss index 18ed1be58..ad52cc80c 100644 --- a/app/assets/stylesheets/application.scss +++ b/app/assets/stylesheets/application.scss @@ -138,7 +138,6 @@ div.wrapper { #content { flex-grow: 1; - overflow: hidden; } #sidebar { diff --git a/app/helpers/spaces_helper.rb b/app/helpers/spaces_helper.rb index 4a57101f3..5bc7dd50c 100644 --- a/app/helpers/spaces_helper.rb +++ b/app/helpers/spaces_helper.rb @@ -4,6 +4,14 @@ def spaces_info I18n.t('info.spaces.description') end + def space_tag(resource) + if TeSS::Config.feature['spaces'] && resource.space && !resource.space.default? && resource.space != current_space + content_tag(:span, class: 'label label-info space-tag', style: 'position: absolute; right: -5px; top: -5px;') do + content_tag(:i, '', class: 'fa fa-share-square') + ' ' + resource.space.title + end + end + end + def space_feature_options Space::FEATURES.select do |f| TeSS::Config.feature[f] diff --git a/app/views/collections/_collection.html.erb b/app/views/collections/_collection.html.erb index b757b5ffb..e01bb5a6a 100644 --- a/app/views/collections/_collection.html.erb +++ b/app/views/collections/_collection.html.erb @@ -1,4 +1,5 @@
  • + <%= space_tag(collection) %> <%= link_to collection, class: 'link-overlay' do %>

    <%= title_with_privacy(collection) %>

    diff --git a/app/views/collections/show.html.erb b/app/views/collections/show.html.erb index 7b3525c40..7dda504a3 100644 --- a/app/views/collections/show.html.erb +++ b/app/views/collections/show.html.erb @@ -1,5 +1,6 @@
    diff --git a/app/views/common/_space_info.erb b/app/views/common/_space_info.erb new file mode 100644 index 000000000..521f756c9 --- /dev/null +++ b/app/views/common/_space_info.erb @@ -0,0 +1,18 @@ +<% space = resource.space %> +<% if TeSS::Config.feature['spaces'] && space && !space.default? && space != current_space %> + <% theme_colour = TeSS::Config.themes[space.theme]&.dig('primary') %> + + +<% end %> diff --git a/app/views/events/_event.html.erb b/app/views/events/_event.html.erb index ce6c72eb1..8bf1fd2b0 100644 --- a/app/views/events/_event.html.erb +++ b/app/views/events/_event.html.erb @@ -1,6 +1,7 @@ <% learning_path_topic_item ||= nil %> <% collection_item ||= learning_path_topic_item %>
  • + <%= space_tag(event) %> <%= link_to event, class: 'link-overlay with-left-icon' do %> <%= item_order_badge(collection_item) if collection_item %>
    diff --git a/app/views/events/show.html.erb b/app/views/events/show.html.erb index c760c1e26..e263ed2b8 100644 --- a/app/views/events/show.html.erb +++ b/app/views/events/show.html.erb @@ -2,6 +2,7 @@ <%# SIDEBAR %>
  • + <%= space_tag(learning_path_topic) %> <%= link_to learning_path_topic, class: 'link-overlay' do %>

    <%= learning_path_topic.title %>

    diff --git a/app/views/learning_path_topics/show.html.erb b/app/views/learning_path_topics/show.html.erb index 8d151812e..28737a6cc 100644 --- a/app/views/learning_path_topics/show.html.erb +++ b/app/views/learning_path_topics/show.html.erb @@ -1,5 +1,6 @@