Skip to content

Commit dca920c

Browse files
committed
Merge branch 'feature/72239-workflows-ux-improvement-select-relevant-statuses' into feature/72924-workflows-ux-improvement-make-saving-changes-more-straightforward-and-less-error-prone
2 parents e291410 + 02d54e5 commit dca920c

File tree

8 files changed

+21
-15
lines changed

8 files changed

+21
-15
lines changed

app/components/workflows/edit_sub_header_component.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ See COPYRIGHT and LICENSE files for more details.
5050
),
5151
form_arguments: {
5252
method: :post,
53-
data: { turbo_stream: true, workflow_role_form: true }
53+
data: { turbo_stream: true, workflow_role_form: true, turbo_frame: "_top" }
5454
}
5555
)
5656
end

app/components/workflows/status_dialog_component.html.erb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ See COPYRIGHT and LICENSE files for more details.
3737
) do |dialog|
3838
dialog.with_header(variant: :large)
3939

40-
dialog.with_body(classes: "Overlay-body_autocomplete_height") do
40+
dialog.with_body(classes: "workflow-status-dialog-body") do
4141
render(
4242
Workflows::StatusFormComponent.new(
4343
all_statuses: @all_statuses,
@@ -61,7 +61,7 @@ See COPYRIGHT and LICENSE files for more details.
6161
type: :submit,
6262
form: Workflows::StatusFormComponent::FORM_ID
6363
)
64-
) { t("admin.workflows.statuses_dialog.apply") }
64+
) { t("button_apply") }
6565
end
6666
end
6767
end

app/components/workflows/status_form_component.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ See COPYRIGHT and LICENSE files for more details.
4242
role: @role,
4343
type: @type,
4444
tab: @tab,
45-
dialog_id: dialog_id
45+
dialog_id:
4646
)
4747
)
4848
end

app/components/workflows/status_removal_danger_dialog_component.html.erb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@ See COPYRIGHT and LICENSE files for more details.
4141
message.with_description_content(t("admin.workflows.statuses_removal_dialog.description"))
4242
end
4343

44+
##
45+
# Do not copy unless absolutely necessary to pass params through a DangerDialog doing a GET!
46+
# The reason this is done here is because the submit is not a DELETE, and GET form submissions
47+
# strip url params
4448
dialog.with_additional_details do
4549
concat(hidden_field_tag(:role_id, @role.id))
4650
concat(hidden_field_tag(:tab, @tab))

app/controllers/workflows_controller.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ def status_dialog
137137
current_statuses = if params[:status_ids].present?
138138
Status.where(id: params[:status_ids].map(&:to_i)).order(:position)
139139
elsif @type && @role
140-
role_type_statuses
140+
statuses_for_role_and_type
141141
else
142142
Status.none
143143
end
@@ -180,18 +180,18 @@ def statuses_for_form
180180
@added_status_ids = []
181181
@statuses = if @type && params[:status_ids].present?
182182
status_ids = params[:status_ids].map(&:to_i)
183-
@added_status_ids = status_ids - role_type_statuses.pluck(:id)
183+
@added_status_ids = status_ids - statuses_for_role_and_type.pluck(:id)
184184
Status.where(id: status_ids).order(:position)
185185
elsif @type && @role
186-
role_type_statuses
186+
statuses_for_role_and_type
187187
elsif @type
188188
@type.statuses
189189
else
190190
Status.all
191191
end
192192
end
193193

194-
def role_type_statuses
194+
def statuses_for_role_and_type
195195
@type.statuses(role: @role, tab: current_tab)
196196
end
197197

config/locales/en.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -410,9 +410,8 @@ en:
410410
title: "Statuses"
411411
label: "Statuses enabled for this type"
412412
caption: "Add or remove statuses you would like to associate with this type. Removing a status will also delete the workflow associated with it."
413-
apply: "Apply"
414413
statuses_removal_dialog:
415-
title: "Remove statuses?"
414+
title: "Remove statuses"
416415
heading:
417416
one: "Remove 1 status?"
418417
other: "Remove %{count} statuses?"

frontend/src/global_styles/content/work_packages/_workflows.sass

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,3 +76,6 @@
7676
right: 0
7777
background: var(--body-background)
7878
z-index: 100
79+
80+
.workflow-status-dialog-body
81+
min-height: 480px

spec/features/workflows/edit_spec.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -443,9 +443,9 @@ def remove_status_via_dialog(status)
443443

444444
remove_status_via_dialog(statuses[1])
445445

446-
expect(page).to have_dialog("Remove statuses?")
446+
expect(page).to have_dialog("Remove statuses")
447447

448-
within_dialog "Remove statuses?" do
448+
within_dialog "Remove statuses" do
449449
expect(page).to have_text("Remove 1 status?")
450450

451451
click_button "Remove"
@@ -475,11 +475,11 @@ def remove_status_via_dialog(status)
475475

476476
remove_status_via_dialog(statuses[1])
477477

478-
within_dialog "Remove statuses?" do
478+
within_dialog "Remove statuses" do
479479
click_button "Cancel"
480480
end
481481

482-
expect(page).to have_no_dialog("Remove statuses?")
482+
expect(page).to have_no_dialog("Remove statuses")
483483

484484
expect(page).to have_field workflow_checkbox(0, 1)
485485
end
@@ -537,7 +537,7 @@ def remove_status_via_dialog(status)
537537

538538
remove_status_via_dialog(statuses[2])
539539

540-
within_dialog "Remove statuses?" do
540+
within_dialog "Remove statuses" do
541541
click_button "Remove"
542542
end
543543

0 commit comments

Comments
 (0)