OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
[51447] Use same headings for permissions report and role forms
Christophe Bliard457268552077
diff --git a/app/helpers/roles_helper.rb b/app/helpers/roles_helper.rbindex 99488e5e100..f6edba5511a 100644--- a/app/helpers/roles_helper.rb+++ b/app/helpers/roles_helper.rb@@ -44,4 +44,13 @@ module RolesHelperperms.group_by { |p| p.project_module.to_s }.slice(*enabled_module_names)end++ def permission_header_for_project_module(mod)+ if mod.blank?+ Project.model_name.human+ else+ I18n.t("permission_header_for_project_module_#{mod}",+ default: [:"project_module_#{mod}", mod.humanize])+ end+ endenddiff --git a/app/views/roles/_permissions.html.erb b/app/views/roles/_permissions.html.erbindex f21be495fdc..ac5ce042e01 100644--- a/app/views/roles/_permissions.html.erb+++ b/app/views/roles/_permissions.html.erb@@ -29,13 +29,13 @@ See COPYRIGHT and LICENSE files for more details.<% permissions.each do |mod, mod_permissions| %><% global_prefix = show_global_role ? 'fieldset--global--' : 'fieldset--' %><% module_name = mod.blank? ? 'fieldset--global--' + Project.model_name.human.downcase.gsub(' ', '_') : global_prefix + l_or_humanize(mod, prefix: 'project_module_').downcase.gsub(' ', '_') %>- <% module_id = module_name.parameterize %>+ <% module_id = module_name.parameterize %><fieldset class="form--fieldset -collapsible" id="<%= module_id %>"><legend class="form--fieldset-legend">- <% if mod.blank? %>- <%= show_global_role ? t(:label_global) : Project.model_name.human %>+ <% if show_global_role && mod.blank? %>+ <%= t(:label_global) %><% else %>- <%= I18n.t("permission_header_for_project_module_#{mod}", default: l_or_humanize(mod, prefix: 'project_module_')) %>+ <%= permission_header_for_project_module(mod) %><% end %></legend><div class="form--toolbar">diff --git a/app/views/roles/report.html.erb b/app/views/roles/report.html.erbindex 0be64fbdca8..0377d2cb95f 100644--- a/app/views/roles/report.html.erb+++ b/app/views/roles/report.html.erb@@ -40,9 +40,9 @@ See COPYRIGHT and LICENSE files for more details.<% group_permissions_by_module(@permissions).each do |mod, mod_permissions| %><% module_name = mod.blank? ? "form--" + I18n.t('attributes.project') : "form--" + l_or_humanize(mod, prefix: 'project_module_').gsub(' ','_') %><% escaped_name = module_name.parameterize %>- <fieldset class="form--fieldset -collapsible" id= "<%= escaped_name %>">- <legend class="form--fieldset-legend" >- <%= mod.blank? ? I18n.t('attributes.project') : l_or_humanize(mod, prefix: 'project_module_') %>+ <fieldset class="form--fieldset -collapsible" id="<%= escaped_name %>">+ <legend class="form--fieldset-legend">+ <%= permission_header_for_project_module(mod) %></legend><div class="form--toolbar"><span class="form--toolbar-item">diff --git a/modules/storages/spec/features/storages_module_spec.rb b/modules/storages/spec/features/storages_module_spec.rbindex 30614eabfc9..0285741a395 100644--- a/modules/storages/spec/features/storages_module_spec.rb+++ b/modules/storages/spec/features/storages_module_spec.rb@@ -44,11 +44,19 @@ RSpec.describe "Storages module", :js, :with_cuprite docurrent_user { user }- shared_examples_for "content section has storages module" do |is_upcase = false|+ shared_examples_for "content section has storages module" doit 'must show "storages" in content section' dowithin "#content" dotext = I18n.t(:project_module_storages)- expect(page).to have_text(is_upcase ? text.upcase : text)+ expect(page).to have_text(text)+ end+ end+ end++ shared_examples_for "content section has storages permission header" do+ it 'must show "Automatically managed project folders" in content section' do+ within "#content" do+ expect(page).to have_text(I18n.t(:permission_header_for_project_module_storages).upcase)endendend@@ -61,10 +69,10 @@ RSpec.describe "Storages module", :js, :with_cuprite doendend- shared_examples_for "has storages module" do |sections: %i[content sidebar], is_upcase: false|+ shared_examples_for "has storages module" do |sections: %i[content sidebar]|before { visit(path) }- include_examples "content section has storages module", is_upcase if sections.include?(:content)+ include_examples "content section has storages module" if sections.include?(:content)include_examples "sidebar has storages module" if sections.include?(:sidebar)end@@ -90,29 +98,21 @@ RSpec.describe "Storages module", :js, :with_cuprite doendcontext "when creating a new role" do- it 'must have appropriate storage permissions header in content section' do- visit new_role_path+ before { visit new_role_path }- within "#content" do- expect(page).to have_text(I18n.t(:permission_header_for_project_module_storages).upcase)- end- end+ include_examples "content section has storages permission header"endcontext "when editing a role" do- it 'must have appropriate storage permissions header in content section' do- visit edit_role_path(role)+ before { visit edit_role_path(role) }- within "#content" do- expect(page).to have_text(I18n.t(:permission_header_for_project_module_storages).upcase)- end- end+ include_examples "content section has storages permission header"end- context "when showing the role permissions report" do- it_behaves_like "has storages module", sections: [:content], is_upcase: true do- let(:path) { report_roles_path(role) }- end+ context "when showing the permissions report" do+ before { visit report_roles_path }++ include_examples "content section has storages permission header"endend