Skip to content

Space indication on index + show pages - #1349

Open
fbacall wants to merge 2 commits into
masterfrom
copilot/write-tests-for-space-info-display
Open

Space indication on index + show pages#1349
fbacall wants to merge 2 commits into
masterfrom
copilot/write-tests-for-space-info-display

Conversation

@fbacall

@fbacall fbacall commented Jul 28, 2026

Copy link
Copy Markdown
Member

Summary of changes

  • Add a label on index pages to resources from a space that is not the current/default space.
  • Add space info to the sidebar on show pages when viewing resources from another space, with a link to go to the resource in its "home" space.

Motivation and context

Was not clear where resources were coming from when searching across all spaces.

Screenshots

image image

Checklist

  • I have read and followed the CONTRIBUTING guide.
  • I confirm that I have the authority necessary to make this contribution on behalf of its copyright owner and agree to license it to the TeSS codebase under the BSD license.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds clearer cross-space provenance cues in the UI so users can tell when a resource shown in search/browse belongs to a different (non-default) space, and provides a direct link to view that resource in its “home” space.

Changes:

  • Adds a “space” label on index/list cards for resources that belong to a different space (space_tag helper used across multiple masonry partials).
  • Adds a reusable sidebar partial (common/_space_info) to show space details + a “View in space” link on show pages.
  • Adds controller tests for the new Materials show-page space sidebar behavior, and adjusts layout CSS.

Reviewed changes

Copilot reviewed 19 out of 19 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
test/controllers/materials_controller_test.rb Adds tests covering when the space sidebar should/shouldn’t render on Materials show pages.
config/locales/en.yml Adds i18n string for the “View in space” link.
app/views/workflows/show.html.erb Displays space info inline on workflow show when viewing from another space.
app/views/workflows/_workflow.html.erb Adds space_tag label to workflow index cards.
app/views/sources/show.html.erb Renders the shared space sidebar partial on Source show pages.
app/views/sources/_source.html.erb Adds space_tag label to source index cards.
app/views/materials/show.html.erb Renders the shared space sidebar partial on Material show pages.
app/views/materials/_material.html.erb Adds space_tag label to material index cards.
app/views/learning_paths/show.html.erb Renders the shared space sidebar partial on Learning Path show pages.
app/views/learning_paths/_learning_path.html.erb Adds space_tag label to learning path index cards (within a cached fragment).
app/views/learning_path_topics/show.html.erb Renders the shared space sidebar partial on Learning Path Topic show pages.
app/views/learning_path_topics/_learning_path_topic.html.erb Adds space_tag label to learning path topic index cards.
app/views/events/show.html.erb Renders the shared space sidebar partial on Event show pages.
app/views/events/_event.html.erb Adds space_tag label to event index cards.
app/views/common/_space_info.erb Introduces the shared sidebar UI for displaying space details and linking to the resource in its home space.
app/views/collections/show.html.erb Renders the shared space sidebar partial on Collection show pages.
app/views/collections/_collection.html.erb Adds space_tag label to collection index cards.
app/helpers/spaces_helper.rb Adds space_tag(resource) helper used by index/list card partials.
app/assets/stylesheets/application.scss Removes overflow: hidden from #content (layout change to allow overflow).
Comments suppressed due to low confidence (1)

app/views/common/_space_info.erb:11

  • This link opens a new tab (target: _blank) but does not set rel="noopener", which allows reverse-tabnabbing via window.opener. Use external_link/external_link_button, or add rel: 'noopener' to the link options.
      <%= link_to space.title, space.url, class: 'h5', target: :_blank %>

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

<h4 class="nav-heading"><%= Space.model_name.human %></h4>
<div class="nav-block" id="space-info">
<p>
<%= link_to(image_tag(get_image_url_for(space), class: 'medium-avatar', style: (theme_colour ? "background-color: #{theme_colour}" : nil)), space.url, target: :_blank) %>
@@ -1,5 +1,6 @@
<% cache(learning_path, expires_in: 1.hour) do %>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants