Adapt public collections/cards to the new columns model
This commit is contained in:
@@ -7,6 +7,6 @@ module PublicCollectionScoped
|
||||
|
||||
private
|
||||
def set_collection
|
||||
@collection = Collection.find_by_published_key(params[:id] || params[:collection_id])
|
||||
@collection = Collection.find_by_published_key(params[:collection_id] || params[:id])
|
||||
end
|
||||
end
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
class Public::Collections::Columns::ClosedsController < ApplicationController
|
||||
include PublicCollectionScoped
|
||||
|
||||
allow_unauthenticated_access only: :show
|
||||
|
||||
layout "public"
|
||||
|
||||
def show
|
||||
set_page_and_extract_portion_from @collection.cards.closed.recently_closed_first
|
||||
|
||||
# To enable caching at intermediate proxies during traffic spikes
|
||||
expires_in 5.seconds, public: true
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,14 @@
|
||||
class Public::Collections::Columns::NotNowsController < ApplicationController
|
||||
include PublicCollectionScoped
|
||||
|
||||
allow_unauthenticated_access only: :show
|
||||
|
||||
layout "public"
|
||||
|
||||
def show
|
||||
set_page_and_extract_portion_from @collection.cards.postponed.reverse_chronologically
|
||||
|
||||
# To enable caching at intermediate proxies during traffic spikes
|
||||
expires_in 5.seconds, public: true
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,14 @@
|
||||
class Public::Collections::Columns::StreamsController < ApplicationController
|
||||
include PublicCollectionScoped
|
||||
|
||||
allow_unauthenticated_access only: :show
|
||||
|
||||
layout "public"
|
||||
|
||||
def show
|
||||
set_page_and_extract_portion_from @collection.cards.awaiting_triage.reverse_chronologically
|
||||
|
||||
# To enable caching at intermediate proxies during traffic spikes
|
||||
expires_in 5.seconds, public: true
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,21 @@
|
||||
class Public::Collections::ColumnsController < ApplicationController
|
||||
include ActionView::RecordIdentifier, PublicCollectionScoped
|
||||
|
||||
allow_unauthenticated_access only: :show
|
||||
|
||||
layout "public"
|
||||
|
||||
before_action :set_column, only: :show
|
||||
|
||||
def show
|
||||
set_page_and_extract_portion_from @column.cards.active.reverse_chronologically
|
||||
|
||||
# To enable caching at intermediate proxies during traffic spikes
|
||||
expires_in 5.seconds, public: true
|
||||
end
|
||||
|
||||
private
|
||||
def set_column
|
||||
@column = @collection.columns.find(params[:id])
|
||||
end
|
||||
end
|
||||
@@ -6,10 +6,7 @@ class Public::CollectionsController < ApplicationController
|
||||
layout "public"
|
||||
|
||||
def show
|
||||
# @considering = current_page_from @collection.cards.considering.latest, per_page: CardsController::PAGE_SIZE
|
||||
# @on_deck = current_page_from @collection.cards.on_deck.latest, per_page: CardsController::PAGE_SIZE
|
||||
# @doing = current_page_from @collection.cards.doing.latest, per_page: CardsController::PAGE_SIZE
|
||||
# @closed = current_page_from @collection.cards.closed.recently_closed_first, per_page: CardsController::PAGE_SIZE
|
||||
set_page_and_extract_portion_from @collection.cards.awaiting_triage.reverse_chronologically
|
||||
|
||||
# To enable caching at intermediate proxies during traffic spikes
|
||||
expires_in 5.seconds, public: true
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
</h3>
|
||||
</div>
|
||||
|
||||
<%= render "cards/display/preview/stages", card: card %>
|
||||
<%= render "cards/display/preview/columns", card: card %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
</h1>
|
||||
</div>
|
||||
|
||||
<%= render "cards/display/public_preview/stages", card: card if card.doing? %>
|
||||
<%= render "cards/display/public_preview/columns", card: card if card.triaged? %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
|
||||
<%= render "cards/display/common/background", card: card %>
|
||||
|
||||
<%= link_to published_card_path(card), class: "card__link", title: card_title_tag(card) do %>
|
||||
<%= link_to published_card_path(card), class: "card__link", title: card_title_tag(card), data: { turbo_frame: "_top" } do %>
|
||||
<span class="for-screen-reader"><%= card.title %></span>
|
||||
<% end %>
|
||||
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
<div class="card__stages">
|
||||
<% card.collection.columns.each do |column| %>
|
||||
<%= tag.span column.name, class: ["workflow-stage btn overflow-ellipsis", { "workflow-stage--current": column == card.column }] %>
|
||||
<% end %>
|
||||
</div>
|
||||
@@ -1,7 +0,0 @@
|
||||
<% if workflow = card.workflow %>
|
||||
<div class="card__stages">
|
||||
<% workflow.stages.each do |stage| %>
|
||||
<%= tag.span stage.name, class: ["workflow-stage btn overflow-ellipsis", { "workflow-stage--current": stage == card.stage }] %>
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
@@ -0,0 +1,6 @@
|
||||
<div id="<%= dom_id(card, :stages) %>" class="card__stages">
|
||||
<% card.collection.columns.each do |column| %>
|
||||
<%= tag.div column.name,
|
||||
class: ["workflow-stage overflow-ellipsis flex align-center gap-half btn non-clickable no-hover", { "workflow-stage--current": column == card.column }] %>
|
||||
<% end %>
|
||||
</div>
|
||||
@@ -1,8 +0,0 @@
|
||||
<% if workflow = card.workflow %>
|
||||
<div id="<%= dom_id(card, :stages) %>" class="card__stages">
|
||||
<% workflow.stages.each do |stage| %>
|
||||
<%= tag.div stage.name,
|
||||
class: ["workflow-stage overflow-ellipsis flex align-center gap-half btn non-clickable no-hover", { "workflow-stage--current": stage == card.stage }] %>
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
@@ -1,5 +1,5 @@
|
||||
<%= link_to event.notifiable_target,
|
||||
class: "event event--#{ event.action } #{ "golden-effect" if event.card.golden? && card.doing? } center-block flex flex-column full-width align-start justify-start position-relative",
|
||||
class: "event event--#{ event.action } #{ "golden-effect" if event.card.golden? } center-block flex flex-column full-width align-start justify-start position-relative",
|
||||
style: "--card-color: #{ card.closed? ? "var(--color-card-complete)" : card.color };",
|
||||
data: { related_element_target: "related",
|
||||
related_element_group_value: card.id,
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
|
||||
<div class="card__body justify-space-between">
|
||||
<%= render "public/cards/show/title", card: @card %>
|
||||
<%= render "cards/display/public_preview/stages", card: @card %>
|
||||
<%= render "cards/display/public_preview/columns", card: @card if @card.open? %>
|
||||
</div>
|
||||
|
||||
<%= render "public/cards/show/steps", card: @card %>
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
<%= render partial: "cards/display/public_preview", collection: cards, as: :card, cached: ->(card) { card.cache_invalidation_parts.for_preview } %>
|
||||
@@ -0,0 +1,11 @@
|
||||
<%= turbo_frame_tag :closed_column do %>
|
||||
<% if @page.used? %>
|
||||
<%= with_manual_pagination :closed_column, @page do %>
|
||||
<%= render "public/collections/columns/list", cards: @page.records %>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<div class="card blank-slate blank-slate--card">
|
||||
<p class="txt-align-center txt-normal">No cards here</p>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
@@ -0,0 +1,11 @@
|
||||
<%= turbo_frame_tag :not_now_column do %>
|
||||
<% if @page.used? %>
|
||||
<%= with_manual_pagination :not_now_column, @page do %>
|
||||
<%= render "public/collections/columns/list", cards: @page.records %>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<div class="card blank-slate blank-slate--card">
|
||||
<p class="txt-align-center txt-normal">No cards here</p>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
@@ -0,0 +1,11 @@
|
||||
<%= turbo_frame_tag dom_id(@column, :cards) do %>
|
||||
<% if @page.used? %>
|
||||
<%= with_manual_pagination dom_id(@column, :cards), @page do %>
|
||||
<%= render "public/collections/columns/list", cards: @page.records %>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<div class="card blank-slate blank-slate--card">
|
||||
<p class="txt-align-center txt-normal">No cards here</p>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
@@ -0,0 +1,11 @@
|
||||
<%= turbo_frame_tag :stream_column do %>
|
||||
<% if @page.used? %>
|
||||
<%= with_manual_pagination :stream_column, @page do %>
|
||||
<%= render "public/collections/columns/list", cards: @page.records %>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<div class="card blank-slate blank-slate--card">
|
||||
<p class="txt-align-center txt-normal">No cards here</p>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
@@ -24,10 +24,4 @@
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<div class="card-columns">
|
||||
<%= render "public/collections/show/on_deck", collection: @collection, page: @on_deck %>
|
||||
<%= render "public/collections/show/considering", collection: @collection, page: @considering %>
|
||||
<%= render "public/collections/show/doing", collection: @collection, page: @doing %>
|
||||
</div>
|
||||
|
||||
<%= render "public/collections/show/closed", collection: @collection, page: @closed %>
|
||||
<%= render "public/collections/show/columns", page: @page, collection: @collection %>
|
||||
|
||||
@@ -1,13 +1,9 @@
|
||||
<section id="closed-cards" class="cards cards--closed pad-block">
|
||||
<% if page.used? %>
|
||||
<%= render partial: "cards/display/public_preview", collection: page.records, as: :card, cached: true %>
|
||||
<section id="closed-cards" class="cards cards--on-deck is-collapsed" style="--card-color: var(--color-card-complete);"
|
||||
data-collapsible-columns-target="column"
|
||||
data-action="turbo:before-morph-attribute->collapsible-columns#preventToggle"
|
||||
>
|
||||
|
||||
<% unless page.last? %>
|
||||
<div class="full-width">
|
||||
<%= public_collection_cards_next_page_link collection, "closed-cards", fetch_on_visible: true, page: page %>
|
||||
</div>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<p class="txt-medium translucent">Nothing here</p>
|
||||
<% end %>
|
||||
<%= render "collections/show/expander", title: "Done", count: collection.cards.closed.count, column_id: "closed-cards" %>
|
||||
|
||||
<%= column_frame_tag :closed_column, src: public_collection_columns_closed_path(collection.publication.key) %>
|
||||
</section>
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
<section id="<%= dom_id(column) %>"
|
||||
class="cards cards--doing is-collapsed" style="--card-color: <%= column.color %>;"
|
||||
data-collapsible-columns-target="column"
|
||||
data-controller="clicker"
|
||||
data-action="turbo:before-morph-attribute->collapsible-columns#preventToggle"
|
||||
>
|
||||
<%= render "collections/show/expander", title: column.name, count: column.cards.active.count, column_id: dom_id(column) %>
|
||||
|
||||
<%= column_frame_tag dom_id(column, :cards), src: public_collection_column_path(column.collection.publication.key, column) %>
|
||||
</section>
|
||||
@@ -0,0 +1,15 @@
|
||||
<%= turbo_frame_tag :cards_container do %>
|
||||
<div class="card-columns" data-controller="collapsible-columns" data-collapsible-columns-collapsed-class="is-collapsed">
|
||||
|
||||
<div class="card-columns__left">
|
||||
<%= render "public/collections/show/not_now", collection: collection %>
|
||||
</div>
|
||||
|
||||
<%= render "public/collections/show/stream", collection: collection, page: page %>
|
||||
|
||||
<div class="card-columns__right">
|
||||
<%= render partial: "public/collections/show/column", collection: collection.columns, cached: true %>
|
||||
<%= render "public/collections/show/closed", collection: collection %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
@@ -0,0 +1,9 @@
|
||||
<section id="not-now" class="cards cards--on-deck is-collapsed" style="--card-color: var(--color-card-complete);"
|
||||
data-collapsible-columns-target="column"
|
||||
data-action="turbo:before-morph-attribute->collapsible-columns#preventToggle"
|
||||
>
|
||||
|
||||
<%= render "collections/show/expander", title: "Not Now", count: collection.cards.postponed.count, column_id: "not-now" %>
|
||||
|
||||
<%= column_frame_tag :not_now_column, src: public_collection_columns_not_now_path(collection.publication.key) %>
|
||||
</section>
|
||||
@@ -0,0 +1,12 @@
|
||||
<section id="the-stream" class="cards cards--considering"
|
||||
data-action="turbo:before-morph-attribute->collapsible-columns#preventToggle">
|
||||
<div class="cards__decoration"></div>
|
||||
|
||||
<% if page.used? %>
|
||||
<%= with_manual_pagination "the-stream", @page do %>
|
||||
<%= render "public/collections/columns/list", cards: page.records %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
<div class="cards__decoration cards__decoration--end"></div>
|
||||
</section>
|
||||
@@ -168,6 +168,14 @@ Rails.application.routes.draw do
|
||||
resources :collections do
|
||||
scope module: :collections do
|
||||
resources :card_previews
|
||||
|
||||
namespace :columns do
|
||||
resource :not_now, only: :show
|
||||
resource :stream, only: :show
|
||||
resource :closed, only: :show
|
||||
end
|
||||
|
||||
resources :columns, only: :show
|
||||
end
|
||||
|
||||
resources :cards, only: :show
|
||||
|
||||
Reference in New Issue
Block a user