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 } %> + +
+ +
+ +
+ <% if @serialized_content.class_name == Universe.name %> + <%= render partial: 'content/tailwind_components/universe_context_sidenav', locals: { content: @serialized_content } %> + <% else %> + <%= render partial: 'content/tailwind_components/content_context_sidenav', locals: { content: @serialized_content } %> + <% end %> + +
+
+
+

+ + <%= @serialized_content.name %> + + + by + + <%= link_to @serialized_content.user.display_name, @serialized_content.user %> + + +

+
+ +
+
+
+ + +
+
+ <%# "highlighted" images %> + <% 1.times do %> + <%# we should probably scale size/dimensions based on actual image data (which we have here) %> +
+
+ gallery +
+
+
+
+

Image title

+
+ Uploaded by + @andrew +
+
+

+ 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 +

+
+ 3 weeks ago + · + + 7 kudos + + · + + 42 comments + +
+
+
+ <% end %> +
+
+ +
+
+
+ gallery +
+
+
+
+ gallery +
+
+
+
+ gallery +
+
+
+
+ gallery +
+
+
+
+ gallery +
+
+
+
+ gallery +
+
+
+ + +
+
+ + +
+
+ +
+
+

Page customization

+
+
+ + + + + Only visible to you (maybe its own page?) (maybe slide in/out from Edit mode button?) +
+
+
+
+ + +
+
+ + + + Enable Gallery + to others + +
+
+ + + + Enable Comments + something + +
+
+ + + +
+ + Create page +
Privacy settings [page controls visible only to you!] + +
+ +
+

Recent Activity

+
+
+
    + + <% 4.times do %> + +
  • +
    + +
    +
    +

    Sarah Cena

    +

    1h

    +
    +

    + Character updated by <%= link_to current_user.display_name, current_user, class: "group-hover:#{User.text_color}" %>. +

    +
    +
    +
  • + + <% end %> + + +
+ + +
+

Contributors to this page

+
+ +
+
+ Emily Selman + + Kristin Watson + + Emma Dorsey +
+
+
+
+
+
+
diff --git a/config/routes.rb b/config/routes.rb index 8d076c5c..9c700f39 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -228,6 +228,7 @@ Rails.application.routes.draw do Rails.application.config.content_types[:all_non_universe].each do |content_type| # resources :characters do resources content_type.name.downcase.pluralize.to_sym do + get :gallery, on: :member get :changelog, on: :member get :toggle_archive, on: :member post :toggle_favorite, on: :member