diff --git a/app/controllers/content_controller.rb b/app/controllers/content_controller.rb index 14f90012..11d9ed60 100644 --- a/app/controllers/content_controller.rb +++ b/app/controllers/content_controller.rb @@ -3,7 +3,7 @@ # TODO: we should probably spin off an Api::ContentController for #api_sort and anything else # api-wise we need class ContentController < ApplicationController - layout 'tailwind', only: [:index, :show] + layout 'tailwind', only: [:index, :show, :gallery] before_action :authenticate_user!, except: [:show, :changelog, :api_sort] \ + Rails.application.config.content_types[:all_non_universe].map { |type| type.name.downcase.pluralize.to_sym } @@ -93,6 +93,19 @@ class ContentController < ApplicationController end end + def gallery + content_type = content_type_from_controller(self.class) + return redirect_to(root_path, notice: "That page doesn't exist!") unless valid_content_types.include?(content_type.name) + + @content = content_type.find_by(id: params[:id]) + return redirect_to(root_path, notice: "You don't have permission to view that content.") if @content.nil? + + return redirect_to(root_path) if @content.user.nil? # deleted user's content + return if ENV.key?('CONTENT_BLACKLIST') && ENV['CONTENT_BLACKLIST'].split(',').include?(@content.user.try(:email)) + + @serialized_content = ContentSerializer.new(@content) + end + def new @content = content_type_from_controller(self.class) .new(user: current_user) diff --git a/app/views/content/gallery.html.erb b/app/views/content/gallery.html.erb new file mode 100644 index 00000000..ec600efd --- /dev/null +++ b/app/views/content/gallery.html.erb @@ -0,0 +1,229 @@ +<%= render partial: 'content/tailwind_components/content_image_header', locals: { content: @serialized_content } %> + +
+ + Image description that's provided and might be kind of long so it might have to wrap, so we might as well write this long description here to see if it looks good when it does wrap +
+
+
+
+
+
+
+ 1h
++ Character updated by <%= link_to current_user.display_name, current_user, class: "group-hover:#{User.text_color}" %>. +
+