diff --git a/app/assets/stylesheets/article-show.scss b/app/assets/stylesheets/article-show.scss index fb154ea6e..6e033bf3f 100644 --- a/app/assets/stylesheets/article-show.scss +++ b/app/assets/stylesheets/article-show.scss @@ -319,10 +319,6 @@ article { color: var(--body-color-inverted); } - &.coming-soon { - pointer-events: none; - color: lighten($black, 78%); - } &.collection-link-hidden { display: none; } diff --git a/app/assets/stylesheets/views/article.scss b/app/assets/stylesheets/views/article.scss index b3e7f72e8..a4c15c9f5 100644 --- a/app/assets/stylesheets/views/article.scss +++ b/app/assets/stylesheets/views/article.scss @@ -568,10 +568,6 @@ color: var(--body-color-inverted); } - &.coming-soon { - pointer-events: none; - color: var(--base-80); - } &.collection-link-hidden { display: none; } diff --git a/app/controllers/articles_controller.rb b/app/controllers/articles_controller.rb index a7aa26848..ba20052af 100644 --- a/app/controllers/articles_controller.rb +++ b/app/controllers/articles_controller.rb @@ -112,7 +112,8 @@ class ArticlesController < ApplicationController def create authorize Article - article = Articles::Creator.call(current_user, article_params_json) + @user = current_user + article = Articles::Creator.call(@user, article_params_json) render json: if article.persisted? { id: article.id, current_state_path: article.decorate.current_state_path }.to_json diff --git a/app/controllers/collections_controller.rb b/app/controllers/collections_controller.rb new file mode 100644 index 000000000..e44c48618 --- /dev/null +++ b/app/controllers/collections_controller.rb @@ -0,0 +1,12 @@ +class CollectionsController < ApplicationController + def index + @user = User.find_by!(username: params[:username]) + @collections = @user.collections.order(created_at: :desc) + end + + def show + @collection = Collection.find(params[:id]) + @user = @collection.user + @articles = @collection.articles.published.order(Arel.sql("COALESCE(crossposted_at, published_at) ASC")) + end +end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index a2fea830e..5f5e4af7e 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -193,6 +193,13 @@ module ApplicationHelper "#{start_year} - #{current_year}" end + def collection_link(collection, **kwargs) + size_string = "#{collection.articles.published.size} Part Series" + body = collection.slug.present? ? "#{collection.slug} (#{size_string})" : size_string + + link_to body, collection.path, **kwargs + end + def email_link(type = :default, text: nil, additional_info: nil) # The allowed types for type is :default, :business, :privacy, and members. # These options can be found in field :email_addresses of models/site_config.rb diff --git a/app/helpers/articles_helper.rb b/app/helpers/articles_helper.rb index 3cddec25a..95ea06888 100644 --- a/app/helpers/articles_helper.rb +++ b/app/helpers/articles_helper.rb @@ -17,14 +17,6 @@ module ArticlesHelper article.comments_blob.include?("youtube") end - def collection_link_class(current_article, linked_article) - if current_article.id == linked_article.id - "current-article" - elsif !linked_article.published - "coming-soon" - end - end - def image_tag_or_inline_svg_tag(service_name, width: nil, height: nil) name = "#{service_name}-logo.svg" diff --git a/app/models/collection.rb b/app/models/collection.rb index f2e0e4c76..fd6f52431 100644 --- a/app/models/collection.rb +++ b/app/models/collection.rb @@ -12,6 +12,10 @@ class Collection < ApplicationRecord Collection.find_or_create_by(slug: slug, user: user) end + def path + "/#{user.username}/series/#{id}" + end + private def touch_articles diff --git a/app/views/articles/_collection.html.erb b/app/views/articles/_collection.html.erb index 0c7d79d01..2fd9d54a4 100644 --- a/app/views/articles/_collection.html.erb +++ b/app/views/articles/_collection.html.erb @@ -3,11 +3,8 @@ <% if collection && collection_size > 1 %>