Space indication on index + show pages - #1349
Open
fbacall wants to merge 2 commits into
Open
Conversation
On index pages and show page.
Contributor
There was a problem hiding this comment.
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_taghelper 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 setrel="noopener", which allows reverse-tabnabbing viawindow.opener. Useexternal_link/external_link_button, or addrel: '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 %> | |||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary of changes
Motivation and context
Was not clear where resources were coming from when searching across all spaces.
Screenshots
Checklist