Move cards to different columns from the perma
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
class Cards::NotNowsController < ApplicationController
|
||||
include CardScoped
|
||||
|
||||
def create
|
||||
@card.postpone
|
||||
render_card_replacement
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,15 @@
|
||||
class Cards::TriagesController < ApplicationController
|
||||
include CardScoped
|
||||
|
||||
def create
|
||||
column = @card.collection.columns.find(params[:column_id])
|
||||
@card.triage_to(column)
|
||||
|
||||
render_card_replacement
|
||||
end
|
||||
|
||||
def destroy
|
||||
@card.send_back_to_triage
|
||||
render_card_replacement
|
||||
end
|
||||
end
|
||||
@@ -2,6 +2,6 @@ class Collections::Columns::StreamsController < ApplicationController
|
||||
include CollectionScoped
|
||||
|
||||
def show
|
||||
set_page_and_extract_portion_from @collection.cards.untriaged.reverse_chronologically
|
||||
set_page_and_extract_portion_from @collection.cards.awaiting_triage.reverse_chronologically
|
||||
end
|
||||
end
|
||||
|
||||
@@ -8,7 +8,7 @@ class CollectionsController < ApplicationController
|
||||
end
|
||||
|
||||
def show
|
||||
set_page_and_extract_portion_from @collection.cards.untriaged.reverse_chronologically
|
||||
set_page_and_extract_portion_from @collection.cards.awaiting_triage.reverse_chronologically
|
||||
end
|
||||
|
||||
def create
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
module ColumnsHelper
|
||||
def button_to_set_column(card, column)
|
||||
button_to \
|
||||
tag.span(column.name, class: "overflow-ellipsis"),
|
||||
card_triage_path(card, column_id: column),
|
||||
method: :post,
|
||||
class: [ "btn justify-start workflow-stage txt-uppercase", { "workflow-stage--current": column == card.column } ],
|
||||
form_class: "flex align-center gap-half",
|
||||
data: { turbo_frame: "_top" }
|
||||
end
|
||||
end
|
||||
@@ -19,7 +19,7 @@ module Card::Postponable
|
||||
def postpone
|
||||
unless postponed?
|
||||
transaction do
|
||||
update!(column: nil)
|
||||
send_back_to_triage
|
||||
reopen
|
||||
activity_spike&.destroy
|
||||
create_not_now!
|
||||
|
||||
@@ -4,7 +4,7 @@ module Card::Triageable
|
||||
included do
|
||||
belongs_to :column, optional: true
|
||||
|
||||
scope :untriaged, -> { active.where.missing(:column) }
|
||||
scope :awaiting_triage, -> { active.where.missing(:column) }
|
||||
scope :triaged, -> { active.joins(:column) }
|
||||
end
|
||||
|
||||
@@ -12,7 +12,16 @@ module Card::Triageable
|
||||
active? && column.present?
|
||||
end
|
||||
|
||||
def untriaged?
|
||||
!triaged?
|
||||
def awaiting_triage?
|
||||
active? && !triaged?
|
||||
end
|
||||
|
||||
def triage_to(column)
|
||||
raise "The column must belong to the card collection" unless collection == column.collection
|
||||
update! column: column
|
||||
end
|
||||
|
||||
def send_back_to_triage
|
||||
update!(column: nil)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
<%= render "cards/container/title", card: card %>
|
||||
<%= render "cards/display/perma/steps", card: card %>
|
||||
</div>
|
||||
<%= render "cards/stagings/stages", card: card if card.open? %>
|
||||
<%= render "cards/triage/columns", card: card if card.open? %>
|
||||
</div>
|
||||
|
||||
<footer class="card__footer full-width flex align-start gap">
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
<% content_for :header do %>
|
||||
<%= render "filters/menu", user_filtering: @user_filtering %>
|
||||
|
||||
<%= link_to cards_path(collection_ids: [ @card.collection ]), class: "header__title btn borderless txt-large", style: "--btn-padding: 0.25ch 1ch 0.25ch 0.75ch; view-transistion-name: card-collection-title;", data: { controller: "hotkey", action: "keydown.esc@document->hotkey#click" } do %>
|
||||
<%= link_to collection_path(@card.collection), class: "header__title btn borderless txt-large", style: "--btn-padding: 0.25ch 1ch 0.25ch 0.75ch; view-transistion-name: card-collection-title;", data: { controller: "hotkey", action: "keydown.esc@document->hotkey#click" } do %>
|
||||
<span class="overflow-ellipsis">
|
||||
←
|
||||
<strong class="font-black"><%= @card.collection.name %></strong>
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
<div id="<%= dom_id(card, :stages) %>" class="card__stages">
|
||||
<%= button_to "Not now", card_not_now_path(card),
|
||||
class: [ "btn justify-start workflow-stage txt-uppercase", { "workflow-stage--current": card.postponed? } ],
|
||||
form_class: "flex align-center gap-half" %>
|
||||
<%= button_to "The Stream", card_triage_path(card), method: :delete,
|
||||
class: [ "btn justify-start workflow-stage txt-uppercase", { "workflow-stage--current": card.awaiting_triage? } ],
|
||||
form_class: "flex align-center gap-half" %>
|
||||
<% card.collection.columns.each do |column| %>
|
||||
<%= button_to_set_column card, column %>
|
||||
<% end %>
|
||||
<%= button_to "Closed", card_closure_path(card, reason: "Completed"),
|
||||
class: [ "btn justify-start workflow-stage txt-uppercase", { "workflow-stage--current": card.closed? } ],
|
||||
form_class: "flex align-center gap-half" %>
|
||||
</div>
|
||||
@@ -35,6 +35,18 @@ Rails.application.routes.draw do
|
||||
end
|
||||
end
|
||||
|
||||
namespace :columns do
|
||||
resources :cards do
|
||||
scope module: "cards" do
|
||||
namespace :drops do
|
||||
resource :not_now
|
||||
resource :closure
|
||||
resources :columns
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
namespace :cards do
|
||||
resources :previews
|
||||
resources :drops
|
||||
@@ -46,6 +58,8 @@ Rails.application.routes.draw do
|
||||
resource :image
|
||||
resource :pin
|
||||
resource :closure
|
||||
resource :not_now
|
||||
resource :triage
|
||||
resource :publish
|
||||
resource :reading
|
||||
resource :recover
|
||||
|
||||
Reference in New Issue
Block a user