Remove workflows code, remove more unused code
This commit is contained in:
@@ -27,7 +27,6 @@ class Filter < ApplicationRecord
|
||||
result = result.assigned_to(assignees.ids) if assignees.present?
|
||||
result = result.where(creator_id: creators.ids) if creators.present?
|
||||
result = result.where(collection: collections.ids) if collections.present?
|
||||
result = result.in_stage(stages.ids) if stages.present?
|
||||
result = result.tagged_with(tags.ids) if tags.present?
|
||||
result = result.where("cards.created_at": creation_window) if creation_window
|
||||
result = result.closed_at_window(closure_window) if closure_window
|
||||
|
||||
@@ -43,7 +43,7 @@ module Filter::Params
|
||||
|
||||
def used?(ignore_collections: false)
|
||||
tags.any? || assignees.any? || creators.any? || closers.any? ||
|
||||
stages.any? || terms.any? || card_ids&.any? || (!ignore_collections && collections.present?) ||
|
||||
terms.any? || card_ids&.any? || (!ignore_collections && collections.present?) ||
|
||||
assignment_status.unassigned? || !indexed_by.all? || !sorted_by.latest?
|
||||
end
|
||||
|
||||
@@ -59,7 +59,6 @@ module Filter::Params
|
||||
params[:terms] = terms
|
||||
params[:tag_ids] = tags.ids
|
||||
params[:collection_ids] = collections.ids
|
||||
params[:stage_ids] = stages.ids
|
||||
params[:card_ids] = card_ids
|
||||
params[:assignee_ids] = assignees.ids
|
||||
params[:creator_ids] = creators.ids
|
||||
|
||||
@@ -4,7 +4,6 @@ module Filter::Resources
|
||||
included do
|
||||
has_and_belongs_to_many :tags
|
||||
has_and_belongs_to_many :collections
|
||||
has_and_belongs_to_many :stages, class_name: "Workflow::Stage", join_table: "filters_stages"
|
||||
has_and_belongs_to_many :assignees, class_name: "User", join_table: "assignees_filters", association_foreign_key: "assignee_id"
|
||||
has_and_belongs_to_many :creators, class_name: "User", join_table: "creators_filters", association_foreign_key: "creator_id"
|
||||
has_and_belongs_to_many :closers, class_name: "User", join_table: "closers_filters", association_foreign_key: "closer_id"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
module Filter::Summarized
|
||||
def summary
|
||||
[ index_summary, sort_summary, tag_summary, assignee_summary, creator_summary, stage_summary, terms_summary ].compact.to_sentence
|
||||
[ index_summary, sort_summary, tag_summary, assignee_summary, creator_summary, terms_summary ].compact.to_sentence
|
||||
end
|
||||
|
||||
private
|
||||
@@ -30,12 +30,6 @@ module Filter::Summarized
|
||||
end
|
||||
end
|
||||
|
||||
def stage_summary
|
||||
if stages.any?
|
||||
"staged in #{stages.pluck(:name).to_choice_sentence}"
|
||||
end
|
||||
end
|
||||
|
||||
def terms_summary
|
||||
if terms.any?
|
||||
"matching #{terms.map { |term| %Q("#{term}") }.to_sentence}"
|
||||
|
||||
@@ -3,12 +3,6 @@
|
||||
<% content_for :header do %>
|
||||
<%= render "filters/menu", user_filtering: @user_filtering %>
|
||||
<h1 class="header__title"><%= @page_title %></h1>
|
||||
<div class="header__actions header__actions--end">
|
||||
<%= link_to workflows_path, class: "btn" do %>
|
||||
<%= icon_tag "bolt" %>
|
||||
<span class="for-screen-reader">Workflows</span>
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<section class="settings">
|
||||
|
||||
@@ -1,30 +0,0 @@
|
||||
<%= turbo_frame_tag @collection, :workflows do %>
|
||||
<header>
|
||||
<h2 class="divider txt-large">Workflows</h2>
|
||||
<div>Use a Workflow to track progress in this Collection</div>
|
||||
</header>
|
||||
|
||||
<div class="flex flex-wrap gap justify-center">
|
||||
<% Workflow.all.each do |workflow| %>
|
||||
<div class="workflow-preview txt-align-start border-radius <%= 'workflow-preview--selected' if workflow == collection.workflow %>">
|
||||
<% confirmation_message = workflow_switch_confirmation_message(workflow, collection) %>
|
||||
<%= button_to collection_workflow_path(collection), method: :patch,
|
||||
aria: { label: workflow == collection.workflow ? "Stop using this workflow" : "Use this workflow" },
|
||||
data: confirmation_message ? { turbo_confirm: confirmation_message } : {} do %>
|
||||
<%= hidden_field_tag "collection[workflow_id]", workflow == collection.workflow ? "" : workflow.id %>
|
||||
<strong class="txt-small overflow-ellipsis flex-item-no-shrink"><%= workflow.name %></strong>
|
||||
<ul class="list-style-none txt-xx-small margin-none flex flex-column gap-half">
|
||||
<% workflow.stages.each do |stage| %>
|
||||
<li class="overflow-ellipsis flex align-center gap-half min-width">
|
||||
<span class="workflow-preview__swatch btn btn--circle" style="--btn-background: <%= stage.color.present? ? stage.color : Card::Colored::DEFAULT_COLOR %>;"></span>
|
||||
<span class="overflow-ellipsis"><%= stage.name %></span>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<%= link_to "Manage workflows", workflows_path, class: "btn btn--plain txt-link", data: { turbo_frame: "_top" } %>
|
||||
<% end %>
|
||||
@@ -3,5 +3,4 @@
|
||||
<%= filter_place_menu_item user_path(Current.user), "My Profile", "person" %>
|
||||
<%= filter_place_menu_item notifications_path, "Notifications", "bell" %>
|
||||
<%= filter_place_menu_item notifications_settings_path, "Notification Settings", "settings" %>
|
||||
<%= filter_place_menu_item workflows_path, "Workflows", "bolt" %>
|
||||
<% end %>
|
||||
|
||||
@@ -1,33 +0,0 @@
|
||||
<%= turbo_frame_tag workflow do %>
|
||||
<article class="panel" style="--panel-size: 40ch;" style="view-transition-name: <%= dom_id(workflow) %>">
|
||||
<div class="flex gap-half align-center">
|
||||
<%= turbo_frame_tag dom_id(workflow, :header) do %>
|
||||
<%= link_to edit_workflow_path(workflow) do %>
|
||||
<h3 class="txt-large txt-nowrap margin-none overflow-ellipsis"><%= workflow.name %></h3>
|
||||
<% end %>
|
||||
|
||||
<%= button_to workflow_path(workflow), method: :delete, class: "btn txt-small borderless txt-subtle",
|
||||
data: { turbo_frame: "_top", turbo_confirm: "Are you sure you want to delete this Workflow? #{ dependent_collections_sentence(workflow) }" },
|
||||
form: { class: "flex-item-justify-end" } do %>
|
||||
<%= icon_tag "trash" %>
|
||||
<span class="for-screen-reader">Delete <%= workflow.name %></span>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<hr class="separator--horizontal flex-item-grow" style="--border-color: var(--color-ink-medium);" aria-hidden="true">
|
||||
|
||||
<div class="flex flex-column gap-half margin-block-start">
|
||||
<%= turbo_frame_tag dom_id(workflow, :stages) do %>
|
||||
<%= render partial: "workflows/stages/stage", collection: workflow.stages %>
|
||||
|
||||
<%= turbo_frame_tag dom_id(workflow, :new_stage) do %>
|
||||
<%= link_to new_workflow_stage_path(workflow), class: "btn txt-small" do %>
|
||||
<%= icon_tag "add" %>
|
||||
<span class="for-screen-reader">New stage</span>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
</article>
|
||||
<% end %>
|
||||
@@ -1,6 +0,0 @@
|
||||
json.cache! workflow do
|
||||
json.(workflow, :id, :name)
|
||||
|
||||
json.created_at workflow.created_at.utc
|
||||
json.updated_at workflow.updated_at.utc
|
||||
end
|
||||
@@ -1,21 +0,0 @@
|
||||
<%= turbo_frame_tag dom_id(@workflow, :header) do %>
|
||||
<div class="flex align-center gap-half">
|
||||
<%= form_with model: @workflow, url: workflow_path(@workflow), id: dom_id(@workflow, :form), class: "full-width", data: { controller: "form" } do |form| %>
|
||||
<h3 class="txt-large margin-none">
|
||||
<%= form.text_field :name, required: true, autofocus: true, class: "input full-width",
|
||||
style: "--input-padding: 0.2em 0.5em;", data: { action: "keydown.esc@document->form#cancel focus->form#select" } %>
|
||||
</h3>
|
||||
<%= link_to "Cancel", workflow_path(@workflow), data: { form_target: "cancel", turbo_frame: dom_id(@workflow) }, hidden: true %>
|
||||
<% end %>
|
||||
|
||||
<%= tag.button type: :submit, class: "btn txt-small btn--positive", form: dom_id(@workflow, :form) do %>
|
||||
<%= icon_tag "check" %>
|
||||
<span class="for-screen-reader">Save</span>
|
||||
<% end %>
|
||||
|
||||
<%= link_to workflow_path(@workflow), class: "btn txt-small", data: { turbo_frame: dom_id(@workflow) } do %>
|
||||
<%= icon_tag "remove-med" %>
|
||||
<span class="for-screen-reader">Cancel</span>
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
@@ -1,30 +0,0 @@
|
||||
<% @page_title = "Workflows" %>
|
||||
|
||||
<% content_for :header do %>
|
||||
<%= render "filters/menu", user_filtering: @user_filtering %>
|
||||
<h1 class="header__title"><%= @page_title %></h1>
|
||||
<div class="header__actions header__actions--end">
|
||||
<%= link_to new_workflow_path, class: "btn" do %>
|
||||
<%= icon_tag "add" %>
|
||||
<span class="for-screen-reader">Create a new workflow</span>
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<section class="center justify-center flex flex-wrap gap">
|
||||
<% if @workflows.any? %>
|
||||
<%= render partial: "workflows/workflow", collection: @workflows %>
|
||||
<% else %>
|
||||
<div>
|
||||
<p class="txt-medium txt-align-center">
|
||||
Workflows are for organizing Cards you're working on into stages.
|
||||
</p>
|
||||
<p class="txt-medium txt-align-center">
|
||||
<%= link_to new_workflow_path, class: "btn btn--link" do %>
|
||||
<%= icon_tag "add" %>
|
||||
<span>Create a new workflow</span>
|
||||
<% end %>
|
||||
</p>
|
||||
</div>
|
||||
<% end %>
|
||||
</section>
|
||||
@@ -1,20 +0,0 @@
|
||||
<% @page_title = "Workflows" %>
|
||||
|
||||
<% content_for :header do %>
|
||||
<%= render "filters/menu", user_filtering: @user_filtering %>
|
||||
<h1 class="header__title"><%= @page_title %></h1>
|
||||
<% end %>
|
||||
|
||||
<article class="panel center" style="--panel-size: 40ch;" style="view-transition-name: <%= dom_id(@workflow) %>">
|
||||
<div class="flex gap-half align-center justify-starts">
|
||||
<%= form_with model: @workflow, url: workflows_path, data: { controller: "form" } do |form| %>
|
||||
<h2 class="txt-large margin-none">
|
||||
<%= form.text_field :name, required: true, autofocus: true, class: "input", placeholder: "Name your Workflow…", data: { action: "keydown.esc@document->form#cancel" } %>
|
||||
</h2>
|
||||
<%= form.button type: :submit, class: "btn btn--reversed center margin-block-start txt-medium" do %>
|
||||
<span>Create Workflow</span>
|
||||
<% end %>
|
||||
<%= link_to "Go back", workflows_path, data: { form_target: "cancel" }, hidden: true %>
|
||||
<% end %>
|
||||
</div>
|
||||
</article>
|
||||
@@ -1 +0,0 @@
|
||||
<%= render "workflows/workflow", workflow: @workflow %>
|
||||
@@ -1,25 +0,0 @@
|
||||
<div class="position-relative" data-controller="dialog" data-action="keydown.esc->dialog#close">
|
||||
<button class="workflow__swatch-btn btn btn--reversed txt-small borderless" data-action="dialog#open:stop" style="--btn-background: <%= stage_color(stage) %>">
|
||||
<%= icon_tag "art" %>
|
||||
<span class="for-screen-reader">Change color</span>
|
||||
</button>
|
||||
|
||||
<dialog class="color-picker shadow" data-dialog-target="dialog" data-action="keydown.esc->dialog#close click@document->dialog#closeOnClickOutside">
|
||||
<form method="dialog">
|
||||
<button class="btn txt-small tooltip">
|
||||
<%= icon_tag "remove" %>
|
||||
<span class="for-screen-reader">Close (esc)</span>
|
||||
</button>
|
||||
</form>
|
||||
|
||||
<%= form_with model: stage, url: workflow_stage_path(stage.workflow, stage), class: "color-picker__colors", data: { controller: "form", action: "change->form#submit" } do |form| %>
|
||||
<% Card::COLORS.each do |color| %>
|
||||
<label class="btn btn--circle txt-small borderless" style="--btn-background: <%= color %>" title="<%= color %>">
|
||||
<%= form.radio_button :color, color %>
|
||||
<%= icon_tag "check", class: "checked" %>
|
||||
<span class="for-screen-reader"><%= color %></span>
|
||||
</label>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</dialog>
|
||||
</div>
|
||||
@@ -1,9 +0,0 @@
|
||||
<div class="flex gap-half align-center min-width max-width">
|
||||
<%= render "workflows/stages/color", stage: stage %>
|
||||
|
||||
<%= turbo_frame_tag stage do %>
|
||||
<%= link_to edit_workflow_stage_path(stage.workflow, stage), class: "txt-link overflow-ellipsis" do %>
|
||||
<strong><%= stage.name %></strong>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
@@ -1,9 +0,0 @@
|
||||
json.cache! stage do
|
||||
json.(stage, :id, :name, :color)
|
||||
|
||||
json.created_at stage.created_at.utc
|
||||
|
||||
json.workflow do
|
||||
json.partial! "workflows/workflow", workflow: stage.workflow
|
||||
end
|
||||
end
|
||||
@@ -1,27 +0,0 @@
|
||||
<%= turbo_frame_tag @stage do %>
|
||||
<%= form_with model: @stage, url: workflow_stage_path(@stage.workflow, @stage), id: dom_id(@stage, :form), class: "full-width", data: { controller: "form" } do |form| %>
|
||||
<%= form.text_field :name, required: true, autofocus: true, class: "input full-width",
|
||||
data: { action: "keydown.esc@document->form#cancel focus->form#select" } %>
|
||||
<%= link_to "Cancel", workflow_path(@workflow), data: { form_target: "cancel", turbo_frame: dom_id(@workflow) }, hidden: true %>
|
||||
<% end %>
|
||||
|
||||
<div class="flex align-center gap-half">
|
||||
<%= tag.button type: :submit, class: "btn txt-small btn--positive", form: dom_id(@stage, :form) do %>
|
||||
<%= icon_tag "check" %>
|
||||
<span class="for-screen-reader">Save</span>
|
||||
<% end %>
|
||||
|
||||
<%= link_to workflow_path(@workflow), class: "btn txt-small", data: { turbo_frame: dom_id(@workflow) } do %>
|
||||
<%= icon_tag "remove-med" %>
|
||||
<span class="for-screen-reader">Cancel</span>
|
||||
<% end %>
|
||||
|
||||
<% if @stage.workflow.stages.many? %>
|
||||
<%= button_to workflow_stage_path(@stage.workflow, @stage), method: :delete, class: "btn btn--negative txt-small",
|
||||
data: { turbo_frame: dom_id(@workflow), turbo_confirm: "Are you sure you want to delete this stage?" } do %>
|
||||
<%= icon_tag "minus" %>
|
||||
<span class="for-screen-reader">Delete <%= @stage.name %></span>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
@@ -1,13 +0,0 @@
|
||||
<%= turbo_frame_tag dom_id(@stage.workflow, :new_stage) do %>
|
||||
<%= form_with model: @stage, url: workflow_stages_path(@stage.workflow), class: "flex align-center gap-half", data: { controller: "form", turbo_frame: dom_id(@stage.workflow, :stages) } do |form| %>
|
||||
<%= form.text_field :name, required: true, autofocus: true, class: "input", data: { action: "keydown.esc@document->form#cancel" } %>
|
||||
<%= form.button type: :submit, class: "btn btn--positive txt-small" do %>
|
||||
<%= icon_tag "check" %>
|
||||
<span class="for-screen-reader">Add stage</span>
|
||||
<% end %>
|
||||
<%= link_to workflow_path(@workflow), class: "btn txt-small", data: { form_target: "cancel", controller: "hotkey", action: "keydown.esc@document->hotkey#click" } do %>
|
||||
<%= icon_tag "remove-med" %>
|
||||
<span class="for-screen-reader">Cancel</span>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
@@ -17,9 +17,6 @@ class FilterTest < ActiveSupport::TestCase
|
||||
filter = users(:david).filters.new creator_ids: [ users(:david).id ], tag_ids: [ tags(:mobile).id ]
|
||||
assert_equal [ cards(:layout) ], filter.cards
|
||||
|
||||
filter = users(:david).filters.new stage_ids: [ workflow_stages(:qa_on_hold).id ]
|
||||
assert_equal [ cards(:logo), cards(:layout), @new_card, cards(:text) ], filter.cards
|
||||
|
||||
filter = users(:david).filters.new assignment_status: "unassigned", collection_ids: [ @new_collection.id ]
|
||||
assert_equal [ @new_card ], filter.cards
|
||||
|
||||
@@ -116,10 +113,7 @@ class FilterTest < ActiveSupport::TestCase
|
||||
test "summary" do
|
||||
assert_equal "Newest, #mobile, and assigned to JZ", filters(:jz_assignments).summary
|
||||
|
||||
filters(:jz_assignments).update!(stages: workflow_stages(:qa_triage, :qa_in_progress))
|
||||
assert_equal "Newest, #mobile, assigned to JZ, and staged in Triage or In progress", filters(:jz_assignments).summary
|
||||
|
||||
filters(:jz_assignments).update!(stages: [], assignees: [], tags: [], collections: [ collections(:writebook) ])
|
||||
filters(:jz_assignments).update!(assignees: [], tags: [], collections: [ collections(:writebook) ])
|
||||
assert_equal "Newest", filters(:jz_assignments).summary
|
||||
|
||||
filters(:jz_assignments).update!(indexed_by: "stalled", sorted_by: "latest")
|
||||
|
||||
Reference in New Issue
Block a user