Skip to content

Commit ab3433e

Browse files
authored
Merge pull request #24751 from opf/bug-fnd-217
[FND-217] Use the proper composite name for editing types/variants page title
2 parents b5814aa + c7df111 commit ab3433e

8 files changed

Lines changed: 81 additions & 7 deletions

File tree

app/views/work_package_types/defaults_tab/edit.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ See COPYRIGHT and LICENSE files for more details.
2727
2828
++#%>
2929

30-
<% html_title t(:label_administration), "#{t(:label_edit)} #{t(:label_work_package_types)} #{h @type.name}" %>
30+
<% html_title t(:label_administration), "#{t(:label_edit)} #{t(:label_work_package_types)} #{h @variant.composite_name}" %>
3131

3232
<%= render ::Types::EditPageHeaderComponent.new(type: @type, variant: @variant, tabs: types_tabs) %>
3333

app/views/work_package_types/details_tab/edit.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ See COPYRIGHT and LICENSE files for more details.
2727
2828
++#%>
2929

30-
<% html_title t(:label_administration), "#{t(:label_edit)} #{t(:label_work_package_types)} #{h @type.name}" %>
30+
<% html_title t(:label_administration), "#{t(:label_edit)} #{t(:label_work_package_types)} #{h @variant.composite_name}" %>
3131

3232
<%= render ::Types::EditPageHeaderComponent.new(type: @type, variant: @variant, tabs: types_tabs) %>
3333

app/views/work_package_types/form_configuration_tab/edit.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ See COPYRIGHT and LICENSE files for more details.
2727
2828
++#%>
2929

30-
<% html_title t(:label_administration), "#{t(:label_edit)} #{t(:label_work_package_types)} #{h @type.name}" %>
30+
<% html_title t(:label_administration), "#{t(:label_edit)} #{t(:label_work_package_types)} #{h @variant.composite_name}" %>
3131

3232
<%= render ::Types::EditPageHeaderComponent.new(type: @type, variant: @variant, tabs: types_tabs) %>
3333

app/views/work_package_types/pdf_export_template/edit.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ See COPYRIGHT and LICENSE files for more details.
2727
2828
++#%>
2929

30-
<% html_title t(:label_administration), "#{t(:label_edit)} #{t(:label_work_package_types)} #{h @type.name}" %>
30+
<% html_title t(:label_administration), "#{t(:label_edit)} #{t(:label_work_package_types)} #{h @variant.composite_name}" %>
3131

3232
<%= render ::Types::EditPageHeaderComponent.new(type: @type, variant: @variant, tabs: types_tabs) %>
3333

app/views/work_package_types/project_attributes_tab/edit.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ See COPYRIGHT and LICENSE files for more details.
99
1010
++#%>
1111

12-
<% html_title t(:label_administration), "#{t(:label_edit)} #{t(:label_work_package_types)} #{h @type.name}" %>
12+
<% html_title t(:label_administration), "#{t(:label_edit)} #{t(:label_work_package_types)} #{h @variant.composite_name}" %>
1313

1414
<%= render ::Types::EditPageHeaderComponent.new(type: @type, variant: @variant, tabs: types_tabs) %>
1515

app/views/work_package_types/projects_tab/edit.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ See COPYRIGHT and LICENSE files for more details.
2727
2828
++#%>
2929

30-
<% html_title t(:label_administration), "#{t(:label_edit)} #{t(:label_work_package_types)} #{h @type.name}" %>
30+
<% html_title t(:label_administration), "#{t(:label_edit)} #{t(:label_work_package_types)} #{h @variant.composite_name}" %>
3131

3232
<%= render ::Types::EditPageHeaderComponent.new(type: @type, variant: @variant, tabs: types_tabs) %>
3333

app/views/work_package_types/workflow_tab/edit.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
2626
See COPYRIGHT and LICENSE files for more details.
2727
2828
++#%>
29-
<% html_title t(:label_administration), t(:label_type_plural), @type.name -%>
29+
<% html_title t(:label_administration), t(:label_type_plural), @variant.composite_name -%>
3030

3131
<%= render ::Types::EditPageHeaderComponent.new(type: @type, variant: @variant, tabs: types_tabs) %>
3232

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
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+
require "spec_helper"
32+
33+
RSpec.describe "Work package type tab page titles",
34+
type: :rails_request,
35+
with_flag: { type_variants: true } do
36+
shared_let(:admin) { create(:admin) }
37+
shared_let(:type) { create(:type, name: "Bug") }
38+
shared_let(:variant) { create(:type_variant, type:, variant_name: "Hardware") }
39+
40+
before { login_as admin }
41+
42+
def page_title
43+
response.parsed_body.at_css("title")&.text
44+
end
45+
46+
def tab_paths(args)
47+
{
48+
details: edit_type_details_path(**args),
49+
form_configuration: edit_type_form_configuration_path(**args),
50+
defaults: edit_type_defaults_path(**args),
51+
projects: edit_type_projects_path(**args),
52+
project_attributes: edit_type_project_attributes_path(**args),
53+
workflow: edit_type_workflow_path(**args),
54+
pdf_export: edit_type_pdf_export_template_index_path(**args)
55+
}
56+
end
57+
58+
it "names the variant on every tab", :aggregate_failures do
59+
tab_paths(variant.path_args).each do |tab, path|
60+
get path
61+
62+
expect(page_title).to include("Bug: Hardware"), "expected the #{tab} tab title to name the variant"
63+
end
64+
end
65+
66+
it "names the type on the tabs of its base variant", :aggregate_failures do
67+
tab_paths(type.default_variant.path_args).each do |tab, path|
68+
get path
69+
70+
expect(page_title).to include("Bug"), "expected the #{tab} tab title to name the type"
71+
expect(page_title).not_to include("Bug: "), "expected the #{tab} tab title to omit a variant name"
72+
end
73+
end
74+
end

0 commit comments

Comments
 (0)