|
3 | 3 | # TODO: we should probably spin off an Api::ContentController for #api_sort and anything else |
4 | 4 | # api-wise we need |
5 | 5 | class ContentController < ApplicationController |
6 | | - before_action :authenticate_user!, except: [:show, :changelog, :api_sort] \ |
| 6 | + before_action :authenticate_user!, except: [:show, :changelog, :api_sort, :gallery] \ |
7 | 7 | + Rails.application.config.content_types[:all_non_universe].map { |type| type.name.downcase.pluralize.to_sym } |
8 | 8 |
|
9 | 9 | skip_before_action :cache_most_used_page_information, only: [ |
@@ -430,6 +430,7 @@ def gallery |
430 | 430 | # Get all images for this content with proper ordering |
431 | 431 | # Only show private images to the owner or contributors |
432 | 432 | is_owner_or_contributor = false |
| 433 | + # Check if the user is the owner or a contributor |
433 | 434 | if current_user.present? && (@content.user == current_user || |
434 | 435 | (@content.respond_to?(:universe_id) && |
435 | 436 | @content.universe_id.present? && |
@@ -854,6 +855,21 @@ def set_navbar_actions |
854 | 855 | @navbar_actions = [] |
855 | 856 |
|
856 | 857 | return if [AttributeCategory, AttributeField].include?(content_type) |
| 858 | + |
| 859 | + # Set up navbar actions for gallery specifically |
| 860 | + if action_name == 'gallery' && @content.present? |
| 861 | + # Add a link to view the content page |
| 862 | + @navbar_actions << { |
| 863 | + label: @content.name, |
| 864 | + href: polymorphic_path(@content) |
| 865 | + } |
| 866 | + |
| 867 | + # Add a gallery title indicator |
| 868 | + @navbar_actions << { |
| 869 | + label: 'Gallery', |
| 870 | + href: send("gallery_#{@content.class.name.downcase}_path", @content) |
| 871 | + } |
| 872 | + end |
857 | 873 | end |
858 | 874 |
|
859 | 875 | def set_sidenav_expansion |
|
0 commit comments