Skip to content

Commit 7375bef

Browse files
authored
Merge pull request #24681 from opf/implementation/comms-844-implement-the-admin-switch-to-enable-multiple-versions
[COMMS-844] Admin switch to enable multiple target versions
2 parents 7bb2555 + 25b1ff6 commit 7375bef

19 files changed

Lines changed: 1437 additions & 0 deletions
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<%#
2+
-- copyright
3+
OpenProject is an open source project management software.
4+
Copyright (C) the OpenProject GmbH
5+
6+
This program is free software; you can redistribute it and/or
7+
modify it under the terms of the GNU General Public License version 3.
8+
9+
OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
10+
Copyright (C) 2006-2013 Jean-Philippe Lang
11+
Copyright (C) 2010-2013 the ChiliProject Team
12+
13+
This program is free software; you can redistribute it and/or
14+
modify it under the terms of the GNU General Public License
15+
as published by the Free Software Foundation; either version 2
16+
of the License, or (at your option) any later version.
17+
18+
This program is distributed in the hope that it will be useful,
19+
but WITHOUT ANY WARRANTY; without even the implied warranty of
20+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21+
GNU General Public License for more details.
22+
23+
You should have received a copy of the GNU General Public License
24+
along with this program; if not, write to the Free Software
25+
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
26+
27+
See COPYRIGHT and LICENSE files for more details.
28+
29+
++#
30+
%>
31+
32+
<%= render(WorkPackages::Admin::Settings::NoticeBoxComponent.new(heading: scoped_t(:"planned_changes.heading"))) do |box| %>
33+
<% box.with_row(icon: :info) { scoped_t(:"planned_changes.renamed") } %>
34+
<% box.with_row(icon: :info) { scoped_t(:"planned_changes.single_value") } %>
35+
<% box.with_row(icon: :hourglass) { scoped_t(:"planned_changes.upcoming_choice") } %>
36+
<% end %>
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
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 WorkPackages
32+
module Admin
33+
module Settings
34+
class CategoriesSectionComponent < ApplicationComponent
35+
private
36+
37+
def scoped_t(key, **)
38+
t(key, scope: "admin.settings.versions_and_categories.categories", **)
39+
end
40+
end
41+
end
42+
end
43+
end
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
<%#
2+
-- copyright
3+
OpenProject is an open source project management software.
4+
Copyright (C) the OpenProject GmbH
5+
6+
This program is free software; you can redistribute it and/or
7+
modify it under the terms of the GNU General Public License version 3.
8+
9+
OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
10+
Copyright (C) 2006-2013 Jean-Philippe Lang
11+
Copyright (C) 2010-2013 the ChiliProject Team
12+
13+
This program is free software; you can redistribute it and/or
14+
modify it under the terms of the GNU General Public License
15+
as published by the Free Software Foundation; either version 2
16+
of the License, or (at your option) any later version.
17+
18+
This program is distributed in the hope that it will be useful,
19+
but WITHOUT ANY WARRANTY; without even the implied warranty of
20+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21+
GNU General Public License for more details.
22+
23+
You should have received a copy of the GNU General Public License
24+
along with this program; if not, write to the Free Software
25+
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
26+
27+
See COPYRIGHT and LICENSE files for more details.
28+
29+
++#
30+
%>
31+
32+
<%=
33+
render(
34+
Primer::OpenProject::DangerDialog.new(
35+
id: "enable-multiple-versions-dialog",
36+
title: scoped_t(:title),
37+
confirm_button_text: scoped_t(:confirm_button),
38+
cancel_button_text: t(:button_close),
39+
size: :large,
40+
form_arguments: {
41+
action: enable_multiple_versions_admin_settings_versions_and_categories_path,
42+
method: :post
43+
}
44+
)
45+
) do |dialog|
46+
dialog.with_confirmation_message do |message|
47+
message.with_heading(tag: :h2) { scoped_t(:heading) }
48+
49+
message.with_description do
50+
safe_join(
51+
[
52+
scoped_t(:description_html, link: documentation_url),
53+
render(Primer::Beta::Text.new(font_weight: :bold, display: :block, mt: 2)) do
54+
scoped_t(:irreversible_notice)
55+
end
56+
]
57+
)
58+
end
59+
end
60+
61+
dialog.with_confirmation_check_box_content(scoped_t(:checkbox_label))
62+
end
63+
%>
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
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 WorkPackages
32+
module Admin
33+
module Settings
34+
class EnableMultipleVersionsDialogComponent < ApplicationComponent
35+
include OpTurbo::Streamable
36+
37+
private
38+
39+
def scoped_t(key, **)
40+
t(key, scope: "admin.settings.versions_and_categories.dialog", **)
41+
end
42+
43+
def documentation_url
44+
OpenProject::Static::Links.url_for(:multiple_versions_documentation)
45+
end
46+
end
47+
end
48+
end
49+
end
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<%#
2+
-- copyright
3+
OpenProject is an open source project management software.
4+
Copyright (C) the OpenProject GmbH
5+
6+
This program is free software; you can redistribute it and/or
7+
modify it under the terms of the GNU General Public License version 3.
8+
9+
OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
10+
Copyright (C) 2006-2013 Jean-Philippe Lang
11+
Copyright (C) 2010-2013 the ChiliProject Team
12+
13+
This program is free software; you can redistribute it and/or
14+
modify it under the terms of the GNU General Public License
15+
as published by the Free Software Foundation; either version 2
16+
of the License, or (at your option) any later version.
17+
18+
This program is distributed in the hope that it will be useful,
19+
but WITHOUT ANY WARRANTY; without even the implied warranty of
20+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21+
GNU General Public License for more details.
22+
23+
You should have received a copy of the GNU General Public License
24+
along with this program; if not, write to the Free Software
25+
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
26+
27+
See COPYRIGHT and LICENSE files for more details.
28+
29+
++#
30+
%>
31+
32+
<%= render(OpPrimer::InsetBoxComponent.new(**system_arguments)) do %>
33+
<%= render(Primer::Beta::Heading.new(tag: :h4)) { heading } %>
34+
<% rows.each do |row| %>
35+
<%= row %>
36+
<% end %>
37+
<% end %>
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
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 WorkPackages
32+
module Admin
33+
module Settings
34+
class NoticeBoxComponent < ApplicationComponent
35+
renders_many :rows, "RowComponent"
36+
37+
def initialize(heading:, **system_arguments)
38+
super()
39+
@heading = heading
40+
@system_arguments = system_arguments
41+
end
42+
43+
private
44+
45+
attr_reader :heading, :system_arguments
46+
47+
class RowComponent < Primer::Component
48+
def initialize(icon:, color: :muted)
49+
super()
50+
@icon = icon
51+
@color = color
52+
end
53+
54+
# The text is one flex item so that inline markup inside it keeps the
55+
# surrounding spaces; separate items would have theirs discarded.
56+
def call
57+
render(Primer::Box.new(display: :flex, mt: 2)) do
58+
render(Primer::Beta::Octicon.new(icon: @icon, mr: 2, color: @color)) +
59+
render(Primer::Beta::Text.new) { content }
60+
end
61+
end
62+
end
63+
end
64+
end
65+
end
66+
end
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
<%#
2+
-- copyright
3+
OpenProject is an open source project management software.
4+
Copyright (C) the OpenProject GmbH
5+
6+
This program is free software; you can redistribute it and/or
7+
modify it under the terms of the GNU General Public License version 3.
8+
9+
OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
10+
Copyright (C) 2006-2013 Jean-Philippe Lang
11+
Copyright (C) 2010-2013 the ChiliProject Team
12+
13+
This program is free software; you can redistribute it and/or
14+
modify it under the terms of the GNU General Public License
15+
as published by the Free Software Foundation; either version 2
16+
of the License, or (at your option) any later version.
17+
18+
This program is distributed in the hope that it will be useful,
19+
but WITHOUT ANY WARRANTY; without even the implied warranty of
20+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21+
GNU General Public License for more details.
22+
23+
You should have received a copy of the GNU General Public License
24+
along with this program; if not, write to the Free Software
25+
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
26+
27+
See COPYRIGHT and LICENSE files for more details.
28+
29+
++#
30+
%>
31+
32+
<%= component_wrapper(**wrapper_data_attrs) do %>
33+
<% if action_required? %>
34+
<%= render(WorkPackages::Admin::Settings::NoticeBoxComponent.new(heading: scoped_t(:"planned_changes.heading"))) do |box| %>
35+
<% box.with_row(icon: :info) { scoped_t(:"planned_changes.renamed") } %>
36+
<% box.with_row(icon: :info) { scoped_t(:"planned_changes.single_value") } %>
37+
<% end %>
38+
39+
<%= render(WorkPackages::Admin::Settings::NoticeBoxComponent.new(heading: scoped_t(:"action_required.heading"), mt: 3)) do |box| %>
40+
<% if multiple_versions_writable? %>
41+
<% box.with_row(icon: :tools) { scoped_t(:"action_required.manual_conversion_hint") } %>
42+
<% else %>
43+
<% box.with_row(icon: :alert) { scoped_t(:"action_required.not_writable_hint") } %>
44+
<% end %>
45+
<% end %>
46+
47+
<% if multiple_versions_writable? %>
48+
<%=
49+
render(
50+
Primer::Beta::Button.new(
51+
tag: :a,
52+
scheme: :secondary,
53+
mt: 3,
54+
href: confirm_dialog_admin_settings_versions_and_categories_path,
55+
data: { turbo_stream: true }
56+
)
57+
) { scoped_t(:"action_required.button") }
58+
%>
59+
<% end %>
60+
<% elsif in_progress? %>
61+
<%= render(OpPrimer::InsetBoxComponent.new) do %>
62+
<%= render(Primer::Box.new(display: :flex, align_items: :center)) do %>
63+
<%= render(Primer::Beta::Spinner.new(size: :small, mr: 2)) %>
64+
<%= render(Primer::Beta::Text.new(font_weight: :bold)) { scoped_t(:"in_progress.heading") } %>
65+
<% end %>
66+
<% end %>
67+
<% else %>
68+
<%= render(WorkPackages::Admin::Settings::NoticeBoxComponent.new(heading: scoped_t(:"recent_changes.heading"))) do |box| %>
69+
<% box.with_row(icon: :check, color: :success) { scoped_t(:"recent_changes.renamed") } %>
70+
<% box.with_row(icon: :check, color: :success) { scoped_t(:"recent_changes.multiple_values") } %>
71+
<% box.with_row(icon: :info) { scoped_t(:"recent_changes.documentation_html", link: documentation_url) } %>
72+
<% end %>
73+
<% end %>
74+
<% end %>

0 commit comments

Comments
 (0)