Skip to content

Commit 6548db3

Browse files
committed
Add new dialogs to manage and remove statuses
1 parent cf24316 commit 6548db3

14 files changed

+566
-21
lines changed
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
<%#-- copyright
2+
OpenProject is an open source project management software.
3+
Copyright (C) the OpenProject GmbH
4+
5+
This program is free software; you can redistribute it and/or
6+
modify it under the terms of the GNU General Public License version 3.
7+
8+
OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
9+
Copyright (C) 2006-2013 Jean-Philippe Lang
10+
Copyright (C) 2010-2013 the ChiliProject Team
11+
12+
This program is free software; you can redistribute it and/or
13+
modify it under the terms of the GNU General Public License
14+
as published by the Free Software Foundation; either version 2
15+
of the License, or (at your option) any later version.
16+
17+
This program is distributed in the hope that it will be useful,
18+
but WITHOUT ANY WARRANTY; without even the implied warranty of
19+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20+
GNU General Public License for more details.
21+
22+
You should have received a copy of the GNU General Public License
23+
along with this program; if not, write to the Free Software
24+
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
25+
26+
See COPYRIGHT and LICENSE files for more details.
27+
28+
++#%>
29+
30+
<%=
31+
render Primer::OpenProject::SubHeader.new do |subheader|
32+
subheader.with_action_button(
33+
tag: :a,
34+
scheme: :secondary,
35+
leading_icon: :plus,
36+
label: t("admin.workflows.status_button"),
37+
href: helpers.status_dialog_workflows_path(role_id: @role&.id, type_id: @type&.id, tab: @tab),
38+
data: { controller: "async-dialog" }
39+
) do
40+
t("admin.workflows.status_button")
41+
end
42+
end
43+
%>
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# frozen_string_literal: true
2+
3+
# -- copyright
4+
# OpenProject is an open source project management software.
5+
# Copyright (C) the OpenProject GmbH
6+
#
7+
# This program is free software; you can redistribute it and/or
8+
# modify it under the terms of the GNU General Public License version 3.
9+
#
10+
# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
11+
# Copyright (C) 2006-2013 Jean-Philippe Lang
12+
# Copyright (C) 2010-2013 the ChiliProject Team
13+
#
14+
# This program is free software; you can redistribute it and/or
15+
# modify it under the terms of the GNU General Public License
16+
# as published by the Free Software Foundation; either version 2
17+
# of the License, or (at your option) any later version.
18+
#
19+
# This program is distributed in the hope that it will be useful,
20+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
21+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22+
# GNU General Public License for more details.
23+
#
24+
# You should have received a copy of the GNU General Public License
25+
# along with this program; if not, write to the Free Software
26+
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
27+
#
28+
# See COPYRIGHT and LICENSE files for more details.
29+
# ++
30+
31+
module Workflows
32+
class EditSubHeaderComponent < ApplicationComponent
33+
include OpPrimer::ComponentHelpers
34+
35+
def initialize(tab:, role: nil, type: nil)
36+
super
37+
@tab = tab
38+
@role = role
39+
@type = type
40+
end
41+
end
42+
end
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
<%#-- copyright
2+
OpenProject is an open source project management software.
3+
Copyright (C) the OpenProject GmbH
4+
5+
This program is free software; you can redistribute it and/or
6+
modify it under the terms of the GNU General Public License version 3.
7+
8+
OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
9+
Copyright (C) 2006-2013 Jean-Philippe Lang
10+
Copyright (C) 2010-2013 the ChiliProject Team
11+
12+
This program is free software; you can redistribute it and/or
13+
modify it under the terms of the GNU General Public License
14+
as published by the Free Software Foundation; either version 2
15+
of the License, or (at your option) any later version.
16+
17+
This program is distributed in the hope that it will be useful,
18+
but WITHOUT ANY WARRANTY; without even the implied warranty of
19+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20+
GNU General Public License for more details.
21+
22+
You should have received a copy of the GNU General Public License
23+
along with this program; if not, write to the Free Software
24+
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
25+
26+
See COPYRIGHT and LICENSE files for more details.
27+
28+
++#%>
29+
30+
<%=
31+
render(
32+
Primer::Alpha::Dialog.new(
33+
id: DIALOG_ID,
34+
title: t("admin.workflows.statuses_dialog.title"),
35+
size: :medium_portrait
36+
)
37+
) do |dialog|
38+
dialog.with_header(variant: :large)
39+
40+
dialog.with_body(classes: "Overlay-body_autocomplete_height") do
41+
render(
42+
Workflows::StatusFormComponent.new(
43+
all_statuses: @all_statuses,
44+
current_statuses: @current_statuses,
45+
role: @role,
46+
type: @type,
47+
tab: @tab
48+
)
49+
)
50+
end
51+
52+
dialog.with_footer do
53+
component_collection do |footer|
54+
footer.with_component(
55+
Primer::Beta::Button.new(data: { "close-dialog-id": DIALOG_ID })
56+
) { t(:button_cancel) }
57+
58+
footer.with_component(
59+
Primer::Beta::Button.new(
60+
scheme: :primary,
61+
type: :submit,
62+
form: Workflows::StatusFormComponent::FORM_ID
63+
)
64+
) { t("admin.workflows.statuses_dialog.apply") }
65+
end
66+
end
67+
end
68+
%>
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# frozen_string_literal: true
2+
3+
# -- copyright
4+
# OpenProject is an open source project management software.
5+
# Copyright (C) the OpenProject GmbH
6+
#
7+
# This program is free software; you can redistribute it and/or
8+
# modify it under the terms of the GNU General Public License version 3.
9+
#
10+
# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
11+
# Copyright (C) 2006-2013 Jean-Philippe Lang
12+
# Copyright (C) 2010-2013 the ChiliProject Team
13+
#
14+
# This program is free software; you can redistribute it and/or
15+
# modify it under the terms of the GNU General Public License
16+
# as published by the Free Software Foundation; either version 2
17+
# of the License, or (at your option) any later version.
18+
#
19+
# This program is distributed in the hope that it will be useful,
20+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
21+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22+
# GNU General Public License for more details.
23+
#
24+
# You should have received a copy of the GNU General Public License
25+
# along with this program; if not, write to the Free Software
26+
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
27+
#
28+
# See COPYRIGHT and LICENSE files for more details.
29+
# ++
30+
31+
module Workflows
32+
class StatusDialogComponent < ApplicationComponent
33+
include OpTurbo::Streamable
34+
include OpPrimer::ComponentHelpers
35+
36+
DIALOG_ID = "workflows-status-dialog"
37+
38+
def initialize(all_statuses:, current_statuses:, role:, type:, tab:)
39+
super
40+
@all_statuses = all_statuses
41+
@current_statuses = current_statuses
42+
@role = role
43+
@type = type
44+
@tab = tab
45+
end
46+
end
47+
end
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
<%#-- copyright
2+
OpenProject is an open source project management software.
3+
Copyright (C) the OpenProject GmbH
4+
5+
This program is free software; you can redistribute it and/or
6+
modify it under the terms of the GNU General Public License version 3.
7+
8+
OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
9+
Copyright (C) 2006-2013 Jean-Philippe Lang
10+
Copyright (C) 2010-2013 the ChiliProject Team
11+
12+
This program is free software; you can redistribute it and/or
13+
modify it under the terms of the GNU General Public License
14+
as published by the Free Software Foundation; either version 2
15+
of the License, or (at your option) any later version.
16+
17+
This program is distributed in the hope that it will be useful,
18+
but WITHOUT ANY WARRANTY; without even the implied warranty of
19+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20+
GNU General Public License for more details.
21+
22+
You should have received a copy of the GNU General Public License
23+
along with this program; if not, write to the Free Software
24+
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
25+
26+
See COPYRIGHT and LICENSE files for more details.
27+
28+
++#%>
29+
30+
<%=
31+
primer_form_with(
32+
url: helpers.confirm_statuses_workflows_path,
33+
method: :post,
34+
id: FORM_ID,
35+
data: { turbo_frame: "workflow-table" }
36+
) do |f|
37+
render(
38+
Workflows::StatusSelectForm.new(
39+
f,
40+
all_statuses: @all_statuses,
41+
current_statuses: @current_statuses,
42+
role: @role,
43+
type: @type,
44+
tab: @tab,
45+
dialog_id: dialog_id
46+
)
47+
)
48+
end
49+
%>
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# frozen_string_literal: true
2+
3+
# -- copyright
4+
# OpenProject is an open source project management software.
5+
# Copyright (C) the OpenProject GmbH
6+
#
7+
# This program is free software; you can redistribute it and/or
8+
# modify it under the terms of the GNU General Public License version 3.
9+
#
10+
# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
11+
# Copyright (C) 2006-2013 Jean-Philippe Lang
12+
# Copyright (C) 2010-2013 the ChiliProject Team
13+
#
14+
# This program is free software; you can redistribute it and/or
15+
# modify it under the terms of the GNU General Public License
16+
# as published by the Free Software Foundation; either version 2
17+
# of the License, or (at your option) any later version.
18+
#
19+
# This program is distributed in the hope that it will be useful,
20+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
21+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22+
# GNU General Public License for more details.
23+
#
24+
# You should have received a copy of the GNU General Public License
25+
# along with this program; if not, write to the Free Software
26+
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
27+
#
28+
# See COPYRIGHT and LICENSE files for more details.
29+
# ++
30+
31+
module Workflows
32+
class StatusFormComponent < ApplicationComponent
33+
FORM_ID = "status-selection-form"
34+
35+
def initialize(all_statuses:, current_statuses:, role:, type:, tab:)
36+
super
37+
@all_statuses = all_statuses
38+
@current_statuses = current_statuses
39+
@role = role
40+
@type = type
41+
@tab = tab
42+
end
43+
44+
def dialog_id
45+
StatusDialogComponent::DIALOG_ID
46+
end
47+
end
48+
end
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
<%#-- copyright
2+
OpenProject is an open source project management software.
3+
Copyright (C) the OpenProject GmbH
4+
5+
This program is free software; you can redistribute it and/or
6+
modify it under the terms of the GNU General Public License version 3.
7+
8+
OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
9+
Copyright (C) 2006-2013 Jean-Philippe Lang
10+
Copyright (C) 2010-2013 the ChiliProject Team
11+
12+
This program is free software; you can redistribute it and/or
13+
modify it under the terms of the GNU General Public License
14+
as published by the Free Software Foundation; either version 2
15+
of the License, or (at your option) any later version.
16+
17+
This program is distributed in the hope that it will be useful,
18+
but WITHOUT ANY WARRANTY; without even the implied warranty of
19+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20+
GNU General Public License for more details.
21+
22+
You should have received a copy of the GNU General Public License
23+
along with this program; if not, write to the Free Software
24+
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
25+
26+
See COPYRIGHT and LICENSE files for more details.
27+
28+
++#%>
29+
30+
<%=
31+
render(
32+
Primer::OpenProject::DangerDialog.new(
33+
id: DIALOG_ID,
34+
title: t("admin.workflows.statuses_removal_dialog.title"),
35+
confirm_button_text: t("admin.workflows.statuses_removal_dialog.confirm"),
36+
form_arguments: { action: helpers.edit_workflows_path, method: :get, data: { turbo_frame: "workflow-table" } }
37+
)
38+
) do |dialog|
39+
dialog.with_confirmation_message do |message|
40+
message.with_heading(tag: :h2) { t("admin.workflows.statuses_removal_dialog.heading", count: @removed_count) }
41+
message.with_description_content(t("admin.workflows.statuses_removal_dialog.description"))
42+
end
43+
44+
dialog.with_additional_details do
45+
concat(hidden_field_tag(:role_id, @role.id))
46+
concat(hidden_field_tag(:type_id, @type.id))
47+
concat(hidden_field_tag(:tab, @tab))
48+
@status_ids.each { |id| concat(hidden_field_tag("status_ids[]", id)) }
49+
end
50+
end
51+
%>

0 commit comments

Comments
 (0)