diff --git a/app/controllers/collections/columns/not_nows_controller.rb b/app/controllers/collections/columns/not_nows_controller.rb new file mode 100644 index 000000000..0b5658322 --- /dev/null +++ b/app/controllers/collections/columns/not_nows_controller.rb @@ -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 diff --git a/app/controllers/collections/columns/streams_controller.rb b/app/controllers/collections/columns/streams_controller.rb new file mode 100644 index 000000000..e5b9dbb6b --- /dev/null +++ b/app/controllers/collections/columns/streams_controller.rb @@ -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 diff --git a/app/controllers/collections/columns_controller.rb b/app/controllers/collections/columns_controller.rb new file mode 100644 index 000000000..f69a8b80b --- /dev/null +++ b/app/controllers/collections/columns_controller.rb @@ -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 diff --git a/app/controllers/collections_controller.rb b/app/controllers/collections_controller.rb index 7cf673339..60d358857 100644 --- a/app/controllers/collections_controller.rb +++ b/app/controllers/collections_controller.rb @@ -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 ]) diff --git a/app/models/card/postponable.rb b/app/models/card/postponable.rb index eca9a0809..6877a06f7 100644 --- a/app/models/card/postponable.rb +++ b/app/models/card/postponable.rb @@ -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! diff --git a/app/models/card/triageable.rb b/app/models/card/triageable.rb index 5a297b7c9..694845298 100644 --- a/app/models/card/triageable.rb +++ b/app/models/card/triageable.rb @@ -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 diff --git a/app/views/cards/display/_preview.html.erb b/app/views/cards/display/_preview.html.erb index cd5573773..034201131 100644 --- a/app/views/cards/display/_preview.html.erb +++ b/app/views/cards/display/_preview.html.erb @@ -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? %> - <%= card.stage.name %> + <%= card.column.name %> <% end %> diff --git a/app/views/collections/columns/_list.html.erb b/app/views/collections/columns/_list.html.erb new file mode 100644 index 000000000..acd87a9b0 --- /dev/null +++ b/app/views/collections/columns/_list.html.erb @@ -0,0 +1 @@ +<%= render partial: "cards/display/preview", collection: cards, as: :card, locals: { draggable: draggable }, cached: ->(card) { card.cache_invalidation_parts.for_preview } %> diff --git a/app/views/collections/columns/not_nows/show.html.erb b/app/views/collections/columns/not_nows/show.html.erb new file mode 100644 index 000000000..ab257f527 --- /dev/null +++ b/app/views/collections/columns/not_nows/show.html.erb @@ -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? %> +
Drag cards here
+Drag cards here
+Drag cards here
+Drag cards here
+