Render a collection resource (WIP)
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
class Collections::Columns::NotNowsController < ApplicationController
|
||||
include CollectionScoped
|
||||
|
||||
def show
|
||||
set_page_and_extract_portion_from @collection.cards.postponed.reverse_chronologically
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,7 @@
|
||||
class Collections::Columns::StreamsController < ApplicationController
|
||||
include CollectionScoped
|
||||
|
||||
def show
|
||||
set_page_and_extract_portion_from @collection.cards.untriaged.reverse_chronologically
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,14 @@
|
||||
class Collections::ColumnsController < ApplicationController
|
||||
include CollectionScoped
|
||||
|
||||
before_action :set_column
|
||||
|
||||
def show
|
||||
set_page_and_extract_portion_from @column.cards.active.reverse_chronologically
|
||||
end
|
||||
|
||||
private
|
||||
def set_column
|
||||
@column = @collection.columns.find(params[:id])
|
||||
end
|
||||
end
|
||||
@@ -7,6 +7,10 @@ class CollectionsController < ApplicationController
|
||||
@collection = Collection.new
|
||||
end
|
||||
|
||||
def show
|
||||
set_page_and_extract_portion_from @collection.cards.untriaged.reverse_chronologically
|
||||
end
|
||||
|
||||
def create
|
||||
@collection = Collection.create! collection_params.with_defaults(all_access: true)
|
||||
redirect_to cards_path(collection_ids: [ @collection ])
|
||||
|
||||
@@ -4,8 +4,8 @@ module Card::Postponable
|
||||
included do
|
||||
has_one :not_now, dependent: :destroy, class_name: "Card::NotNow"
|
||||
|
||||
scope :not_now, -> { joins(:not_now) }
|
||||
scope :active, -> { where.missing(:not_now) }
|
||||
scope :postponed, -> { open.joins(:not_now) }
|
||||
scope :active, -> { open.where.missing(:not_now) }
|
||||
end
|
||||
|
||||
def postponed?
|
||||
@@ -19,6 +19,7 @@ module Card::Postponable
|
||||
def postpone
|
||||
unless postponed?
|
||||
transaction do
|
||||
update!(column: nil)
|
||||
reopen
|
||||
activity_spike&.destroy
|
||||
create_not_now!
|
||||
|
||||
@@ -4,7 +4,15 @@ module Card::Triageable
|
||||
included do
|
||||
belongs_to :column, optional: true
|
||||
|
||||
scope :untriaged, -> { where.missing(:column) }
|
||||
scope :triaged, -> { joins(:column) }
|
||||
scope :untriaged, -> { active.where.missing(:column) }
|
||||
scope :triaged, -> { active.joins(:column) }
|
||||
end
|
||||
|
||||
def triaged?
|
||||
active? && column.present?
|
||||
end
|
||||
|
||||
def untriaged?
|
||||
!triaged?
|
||||
end
|
||||
end
|
||||
|
||||
@@ -8,9 +8,9 @@
|
||||
<%= render "cards/display/preview/steps", card: card %>
|
||||
<%= icon_tag "attachment", class: "card__attachments-indicator translucent txt-x-small" if card.has_attachments? %>
|
||||
|
||||
<% if card.staged? && card.doing? %>
|
||||
<% if card.triaged? %>
|
||||
<span class="btn justify-start workflow-stage workflow-stage--current txt-uppercase min-width max-width">
|
||||
<span class="overflow-ellipsis "><%= card.stage.name %></span>
|
||||
<span class="overflow-ellipsis "><%= card.column.name %></span>
|
||||
</span>
|
||||
<% end %>
|
||||
</header>
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
<%= render partial: "cards/display/preview", collection: cards, as: :card, locals: { draggable: draggable }, cached: ->(card) { card.cache_invalidation_parts.for_preview } %>
|
||||
@@ -0,0 +1,15 @@
|
||||
<%= turbo_frame_tag :not_now_column do %>
|
||||
|
||||
<% if @page.used? %>
|
||||
<%= render "collections/columns/list", cards: @page.records, draggable: true %>
|
||||
|
||||
<% unless @page.last? %>
|
||||
<div class="full-width">
|
||||
</div>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<div class="card blank-slate blank-slate--card">
|
||||
<p class="txt-align-center txt-normal">Drag cards here</p>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
@@ -0,0 +1,14 @@
|
||||
<%= turbo_frame_tag dom_id(@column, :cards) do %>
|
||||
<% if @page.used? %>
|
||||
<%= render "collections/columns/list", cards: @page.records, draggable: true %>
|
||||
|
||||
<% unless @page.last? %>
|
||||
<div class="full-width">
|
||||
</div>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<div class="card blank-slate blank-slate--card">
|
||||
<p class="txt-align-center txt-normal">Drag cards here</p>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
@@ -0,0 +1,14 @@
|
||||
<%= turbo_frame_tag :stream_column do %>
|
||||
<% if @page.used? %>
|
||||
<%= render "collections/columns/list", cards: @page.records, draggable: true %>
|
||||
|
||||
<% unless @page.last? %>
|
||||
<div class="full-width">
|
||||
</div>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<div class="card blank-slate blank-slate--card">
|
||||
<p class="txt-align-center txt-normal">Drag cards here</p>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
@@ -0,0 +1,38 @@
|
||||
<% @page_title = @collection.name %>
|
||||
<% turbo_exempts_page_from_cache %>
|
||||
|
||||
<% content_for :head do %>
|
||||
<%= tag.meta property: "og:title", content: @page_title %>
|
||||
<%= tag.meta property: "og:description", content: Account.sole.name %>
|
||||
<%= tag.meta property: "og:url", content: collection_url(@collection) %>
|
||||
<% end %>
|
||||
|
||||
<% content_for :header do %>
|
||||
<div class="header__actions header__actions--start">
|
||||
<%= render "cards/webhooks", collection: @collection if Current.user.admin? %>
|
||||
</div>
|
||||
|
||||
<h1 class="header__title divider divider--fade full-width">
|
||||
<span class="overflow-ellipsis"><%= @collection.name %></span>
|
||||
</h1>
|
||||
|
||||
<div class="header__actions header__actions--end">
|
||||
<%= render "cards/collection_settings", collection: @collection %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<%= render "filters/settings", user_filtering: @user_filtering %>
|
||||
|
||||
<%= tag.div data: {
|
||||
controller: "drag-and-drop",
|
||||
drag_and_drop_dragged_item_class: "drag-and-drop__dragged-item",
|
||||
drag_and_drop_hover_container_class: "drag-and-drop__hover-container",
|
||||
drag_and_drop_url_value: cards_drops_path(**@filter.as_params),
|
||||
action: "
|
||||
dragstart->drag-and-drop#dragStart
|
||||
dragover->drag-and-drop#dragOver
|
||||
drop->drag-and-drop#drop
|
||||
dragend->drag-and-drop#dragEnd" } do %>
|
||||
|
||||
<%= render "collections/show/columns", page: @page, collection: @collection %>
|
||||
<% end %>
|
||||
@@ -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-drag-and-drop-target="container"
|
||||
data-drop-target="doing"
|
||||
>
|
||||
<%= cards_expander column.name, column.cards.active.count %>
|
||||
|
||||
<%= turbo_frame_tag dom_id(column, :cards), src: collection_column_path(column.collection, column) %>
|
||||
</section>
|
||||
@@ -0,0 +1,20 @@
|
||||
<%= turbo_frame_tag :card_columns do %>
|
||||
<div class="card-columns" data-controller="collapsible-columns" data-collapsible-columns-collapsed-class="is-collapsed">
|
||||
|
||||
<div class="card-columns__left">
|
||||
<%= render "collections/show/not_now", collection: collection %>
|
||||
</div>
|
||||
|
||||
<%= render "collections/show/stream", page: page %>
|
||||
|
||||
<div class="card-columns__right">
|
||||
<%= render partial: "collections/show/column", collection: collection.columns, cached: true %>
|
||||
<%= render "collections/show/closed", collection: collection %>
|
||||
|
||||
<button class="btn btn--circle txt-x-small borderless">
|
||||
<%= icon_tag "menu-dots-horizontal" %>
|
||||
<span class="for-screen-reader">Add a new column, etc.</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
@@ -0,0 +1,9 @@
|
||||
<section id="on-deck-cards" class="cards cards--on-deck is-collapsed" style="--card-color: var(--color-card-complete);"
|
||||
data-collapsible-columns-target="column"
|
||||
data-drag-and-drop-target="container"
|
||||
data-drop-target="on_deck">
|
||||
|
||||
<%= cards_expander "Not Now", collection.cards.postponed.count %>
|
||||
|
||||
<%= turbo_frame_tag :not_now_column, src: collection_columns_not_now_path(collection) %>
|
||||
</section>
|
||||
@@ -0,0 +1,18 @@
|
||||
<section id="considering-cards" class="cards cards--considering"
|
||||
data-drag-and-drop-target="container"
|
||||
data-drop-target="considering">
|
||||
<div class="cards__decoration"></div>
|
||||
|
||||
<% if page.used? %>
|
||||
<%= render "collections/columns/list", cards: @page.records, draggable: true %>
|
||||
|
||||
<% unless page.last? %>
|
||||
<div class="full-width">
|
||||
</div>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<div class="card blank-slate blank-slate--card">
|
||||
<p class="txt-align-center txt-normal">Drag cards here</p>
|
||||
</div>
|
||||
<% end %>
|
||||
</section>
|
||||
@@ -17,6 +17,13 @@ Rails.application.routes.draw do
|
||||
resource :involvement
|
||||
resource :publication
|
||||
resource :entropy_configuration
|
||||
|
||||
namespace :columns do
|
||||
resource :not_now
|
||||
resource :stream
|
||||
end
|
||||
|
||||
resources :columns
|
||||
end
|
||||
|
||||
resources :cards, only: %i[ create ]
|
||||
|
||||
Reference in New Issue
Block a user