From 264eec42fda3102b44430d545f6cc797acc59bef Mon Sep 17 00:00:00 2001 From: drusepth Date: Mon, 28 Nov 2022 14:31:14 -0800 Subject: [PATCH] collection feed design --- app/views/page_collections/show.html.erb | 465 +++++++---------------- 1 file changed, 143 insertions(+), 322 deletions(-) diff --git a/app/views/page_collections/show.html.erb b/app/views/page_collections/show.html.erb index 4ea414b2..ee7914d2 100644 --- a/app/views/page_collections/show.html.erb +++ b/app/views/page_collections/show.html.erb @@ -24,16 +24,40 @@
-
-
About this Collection
-
- <%= simple_format @page_collection.description %> +
+
About this Collection
+
+ <%= simple_format @page_collection.description.presence || "No description" %>
+ <% if @page_collection.user == current_user %> +
+ <%= link_to 'Edit collection', edit_page_collection_path(@page_collection), class: 'text-notebook-blue text-sm' %> +
+ <% end %>
- +
+
+
+
+
Accepting submissions
+
+ This Collection is currently accepting submissions of your + <%= @page_collection.page_types.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" %> + +
+
+
+
+
@@ -87,349 +111,146 @@

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

- <%= link_to 'Follow', '#', class: "text-white #{PageCollection.color} py-2 px-4 rounded hover:shadow hover:bg-brown-500 transition" %> + <% 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 %> + <%= link_to 'Follow', '#', class: "text-white #{PageCollection.color} py-2 px-8 rounded hover:shadow hover:bg-brown-500 transition" %> + <% end %>
- -
-

Published content

-
    -
  • -
    - -
    -
    - + <% if @pages.any? %> +

    + Sort + Published content +

    - - <%= Creature.icon %> - -
    -
    -
    -
    - Andrew Brown - published a Creature from - Cool Test Guy - · - 6h ago -
    -

    - - Oh, you know, just testing submitting stuff and whatnot. Disregard this. -

    -
    -
    - <%= link_to '#', class: '' do %> -
    -
    - <%= image_tag Character.last.random_image_including_private, class: 'w-full h-full rounded-l' %> -
    -
    -

    - <%= Creature.icon %> - Spooky Ghost Boi -

    - The spookiest in all the lands -
    -
    - <% end %> -
    -
    -
    -
    -
  • - -
  • -
    - -
    -
    -
    +
      + <% @pages.each do |submission| %> +
    • +
      + +
      - + <%= link_to submission.user do %> + <%= image_tag submission.user.image_url(40), class: "h-10 w-10 rounded-full #{User.color} flex items-center justify-center ring-4 ring-white", alt: "" %> + <% end %> - <%= User.icon %> + + <%= content_class_from_name(submission.content_type).icon %> +
      -
      -
      -
      -
      - Dr. Evil - followed - Bob "Bob" Bobson - · - 2d ago -
      -
      -
    -
    -
  • - -
  • -
    - -
    -
    -
    -
    - - - - forum - -
    -
    -
    -
    -
    - - Dr. Evil - started a forum discussion - - · - 2d ago - -
    -
    -
    -
    -
  • - -
  • -
    -
    -
    - - - - <%= Document.icon %> - -
    -
    -
    - Jason Meyers - shared a Document - · - 5d ago -
    -
    - <%= link_to '#', class: '' do %> -
    -
    - <%= image_tag Character.last.random_image_including_private, class: 'w-full h-full rounded-l' %> -
    -
    -

    - <%= Document.icon %> - Document name -

    - Details or description here +
    +
    +
    + <%= link_to @page_collection.user.display_name, @page_collection.user, class: 'font-medium text-gray-900' %> + published a <%= submission.content_type %> by + <%= link_to submission.user.display_name, submission.user, class: 'font-medium text-gray-900' %> + · + <%= time_ago_in_words submission.accepted_at %> ago
    + <% if submission.explanation? %> +

    + + <%= submission.explanation %> +

    + <% end %>
    - <% end %> +
    + <%= link_to submission.content, class: '' do %> +
    +
    + <%= image_tag submission.content.random_image_including_private, class: 'w-full h-full rounded-l' %> +
    +
    +

    + + <%= content_class_from_name(submission.content_type).icon %> + +
    <%= submission.cached_content_name %>
    + <% if submission.content.universe %> +
    + from <%= link_to submission.content.universe.name, submission.content.universe, class: Universe.text_color %> +
    + <% else %> +
    + by <%= link_to submission.user.display_name, submission.user, class: User.text_color %> +
    + <% end %> +

    + +

    + <%= submission.content.description %> +

    +
    +
    + <% end %> +
    +
    +
  • + <% end %> +
+ + <% else %> +
+
+
+ <%= PageCollection.icon %> +

+ Nothing published here yet +

+

+ ...but submissions are open! +

- - + +
+ <% end %>
- - - - - - - -<%= content_for :full_width_page_header do %> - <%= render partial: 'content/components/collection_header', locals: { collection: @page_collection } %> -<% end %> - -
-
-
-
-
- <% if user_signed_in? %> - <% if current_user != @page_collection.user %> - <% if @page_collection.followed_by?(current_user) %> - <%= link_to unfollow_page_collection_path(@page_collection), class: "btn #{PageCollection.color} lighten-2 right" do %> - <%= PageCollection.icon %> - Unfollow - <% end %> - - <% else %> - <%= link_to follow_page_collection_path(@page_collection), class: "btn #{PageCollection.color} right" do %> - <%= PageCollection.icon %> - Follow for updates - <% end %> - <% end %> - <% else %> - <%= link_to 'Edit collection', edit_page_collection_path(@page_collection), class: 'btn btn-flat right' %> - - <% end %> - <% else %> - <%= link_to '#', class: "btn #{PageCollection.color} lighten-2 right disabled" do %> - <%= PageCollection.icon %> - Follow - <% end %> - <% end %> - - About this collection -
-
- <% if user_signed_in? && @page_collection.user == current_user %> - <%= form_for @page_collection do |f| %> -
- <%= f.text_area :description, class: 'materialize-textarea' %> - <%= f.label :description, 'Collection Description' %> -
You can add details for this collection to explain what kinds of pages you'd like it to contain.
-
- <%= f.submit 'Save changes', class: 'btn right blue white-text' %> -
- - <% end %> - <% else %> - <% if @page_collection.description? %> -
- <%= simple_format @page_collection.description %> -
- <% end %> - <% end %> - -
-
-
-
- - <% if user_signed_in? && @page_collection.user_id == current_user.id %> - <% if @page_collection.pending_submissions.count > 0 %> - <%= - link_to page_collection_pending_submissions_path(page_collection_id: @page_collection.id), - class: "#{PageCollection.color} white-text btn btn-large", - style: "width: 100%" do - %> - notifications_active -
- <%= pluralize(@page_collection.pending_submissions.count, 'pending submission') %> -
- <% end %> - <% end %> - <% end %> - - <%# render partial: 'page_collections/quick_add' %> - <% if user_signed_in? %> - - <% else %> - - <% end %> - <%= PageCollection.icon %> -
- <%= 'Sign in to' unless user_signed_in? %> - <%= @page_collection.user == current_user ? 'Add' : 'Submit' %> a page - - to this Collection - -
-
-

- -
Published pages
- -
- <% @page_collection.page_types.each do |pt| %> - <% klass = content_class_from_name(pt) %> - <%= link_to(send(pt.downcase.pluralize + '_page_collection_path', @page_collection), class: "collection-item #{klass.color} white-text") do %> - <%= klass.icon %> - <%= pt.pluralize %> - <%= @page_collection.accepted_submissions.where(content_type: pt).count %> - <% end %> - <% end %> - <% if @page_collection.page_types.count > 1 %> - <%= link_to @page_collection, class: "collection-item #{PageCollection.text_color}" do %> - <%= PageCollection.icon %> - All Pages - <%= @page_collection.accepted_submissions.count %> - <% end %> - <% end %> -
- -
Curator
-
- <%= link_to @page_collection.user, class: "#{User.text_color}" do %> - <%= image_tag @page_collection.user.image_url(size=20), class: 'left circle', style: 'margin-right: 8px;' %> - <%= @page_collection.user.display_name %> - <% end %> -
- - <% if @page_collection.contributors.any? %> -
-
Contributors
- <% @page_collection.contributors.each do |user| %> -
- <%= link_to user, class: "#{User.text_color}" do %> - <%= image_tag user.image_url(size=20), class: 'left circle', style: 'margin-right: 8px;' %> - <%= user.display_name %> - <% end %> -
- <% end %> -
- <% end %> - - -
-
- <% if @pages.empty? %>