From 14f10d1d43c5286dd4e0b613d93789ef346d08f4 Mon Sep 17 00:00:00 2001 From: drusepth Date: Mon, 28 Nov 2022 17:30:45 -0800 Subject: [PATCH] more collection#show design --- .../page_collections_controller.rb | 2 + app/views/main/dashboard.html.erb | 3 +- app/views/page_collections/_sort_bar.html.erb | 26 +++---- app/views/page_collections/show.html.erb | 78 +++++++++++-------- 4 files changed, 60 insertions(+), 49 deletions(-) diff --git a/app/controllers/page_collections_controller.rb b/app/controllers/page_collections_controller.rb index 24908da0..13a284f5 100644 --- a/app/controllers/page_collections_controller.rb +++ b/app/controllers/page_collections_controller.rb @@ -38,6 +38,8 @@ class PageCollectionsController < ApplicationController @page_title = "#{@page_collection.name} - a Collection" @pages = @page_collection.accepted_submissions.includes({content: [:universe, :user], user: []}) + @contributors = User.where(id: @pages.to_a.map(&:user_id) - [@page_collection.user_id]) + sort_pages end diff --git a/app/views/main/dashboard.html.erb b/app/views/main/dashboard.html.erb index 0eee24a5..44fe0d9b 100644 --- a/app/views/main/dashboard.html.erb +++ b/app/views/main/dashboard.html.erb @@ -7,11 +7,10 @@
<%= link_to current_user do %> - <%= image_tag current_user.image_url, class: 'hidden h-16 w-16 rounded-full sm:block border-2 border-green-700' %> + <%= image_tag current_user.image_url, class: "h-16 w-16 rounded-full #{User.color} ring-2 ring-green-700 hover:opacity-90 transition" %> <% end %>
-

Welcome back, <%= link_to current_user.display_name, current_user, class: User.text_color %>!

diff --git a/app/views/page_collections/_sort_bar.html.erb b/app/views/page_collections/_sort_bar.html.erb index 6dcdf878..214f7d74 100644 --- a/app/views/page_collections/_sort_bar.html.erb +++ b/app/views/page_collections/_sort_bar.html.erb @@ -1,24 +1,24 @@ -
+
- <%= link_to params.permit(:sort).merge({sort: 'alphabetical'}), class: 'btn btn-flat tooltipped', data: { tooltip: "Show pages in this collection alphabetically, by name" } do %> - sort + <%= link_to params.permit(:sort).merge({sort: 'alphabetical'}), class: 'inline-block text-gray-400 hover:text-gray-500', data: { tooltip: "Show pages in this collection alphabetically, by name" } do %> + sort Alphabetical <% end %> - <%= link_to params.permit(:sort).merge({sort: 'chronological'}), class: 'btn btn-flat tooltipped', data: { tooltip: "Show pages in this collection in the order they were added" } do %> - sort + <%= link_to params.permit(:sort).merge({sort: 'chronological'}), class: 'inline-block text-gray-400 hover:text-gray-500', data: { tooltip: "Show pages in this collection in the order they were added" } do %> + sort Chronological <% end %> - <%= link_to params.permit(:sort).merge({sort: 'recent'}), class: 'btn btn-flat tooltipped', data: { tooltip: "Sort pages in this collection most-recently-added-first" } do %> - sort + <%= link_to params.permit(:sort).merge({sort: 'recent'}), class: 'inline-block text-gray-400 hover:text-gray-500', data: { tooltip: "Sort pages in this collection most-recently-added-first" } do %> + sort Recently added <% end %> - <%= link_to params.permit(:sort).merge({sort: 'shuffle'}), class: 'btn btn-flat tooltipped', data: { tooltip: "Show pages in this collection in a random order" } do %> - sort + <%= link_to params.permit(:sort).merge({sort: 'shuffle'}), class: 'inline-block text-gray-400 hover:text-gray-500', data: { tooltip: "Show pages in this collection in a random order" } do %> + sort Shuffle <% end %> -
\ No newline at end of file +
diff --git a/app/views/page_collections/show.html.erb b/app/views/page_collections/show.html.erb index ee7914d2..fd01af40 100644 --- a/app/views/page_collections/show.html.erb +++ b/app/views/page_collections/show.html.erb @@ -1,4 +1,4 @@ -
+
@@ -13,9 +13,11 @@ <% submittable_class = content_class_from_name(submittable_class_name) %> <%# todo click on any to filter posts to just this type, hover effect %> <%# todo tooltips %> - - <%= submittable_class.icon %> - + <%= link_to send("#{submittable_class_name.downcase.pluralize}_page_collection_path", @page_collection.id) do %> + + <%= submittable_class.icon %> + + <% end %> <% end %>
@@ -43,16 +45,15 @@
Accepting submissions
-
- This Collection is currently accepting submissions of your - <%= @page_collection.page_types.to_sentence %>. +
+ This Collection is currently accepting submissions of + <%= @page_collection.page_types.map(&:pluralize).to_sentence %>. <% if @page_collection.auto_accept? %> Pages submitted at this time will be automatically accepted. <% end %> <%= link_to 'Submit a page', '#', class: "#{PageCollection.color} hover:bg-brown-500 hover:shadow transition text-white text-center block mt-4 py-2 rounded" %> -
@@ -67,10 +68,10 @@
- + <%= image_tag @page_collection.user.image_url(60), class: "inline-block h-14 w-14 rounded-full #{User.color}" %>
-

Not Tim Cook

+

<%= @page_collection.user.display_name %>

Curator

@@ -78,42 +79,50 @@
- + +
+ <% end %>
Posts
-
1,234
+
+ <%= number_with_delimiter @pages.count %> +
-
+

Follow this Collection to get a site notification each time something new is published or when submissions open.

-
+
<% if @page_collection.followed_by?(current_user) %> <%= link_to 'Unfollow', '#', class: "text-white #{PageCollection.color} py-2 px-8 rounded hover:shadow hover:bg-brown-500 transition" %> <% else %> @@ -128,7 +137,7 @@
<% if @pages.any? %>

- Sort + <%= render partial: 'page_collections/sort_bar' %> Published content

@@ -251,6 +260,8 @@ + + <% if @pages.empty? %>
@@ -273,14 +284,13 @@
<% else %> - <%= render partial: 'page_collections/sort_bar' %> <% if !!@show_contributor_highlight %> <%= render partial: 'page_collections/contributor_highlight_bar', locals: { contributor: @highlighted_contributor } %> <% end %> <% if !!@show_page_type_highlight %> <%= render partial: 'page_collections/page_type_highlight_bar', locals: { page_type: @page_type } %> <% end %> - <%= render partial: 'page_collections/tiles', locals: { pages: @pages } %> + <%# render partial: 'page_collections/tiles', locals: { pages: @pages } %> <% end %> <%= form_for PageCollectionSubmission.new do |f| %>