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
include specs and translations
Bruno Pagno0ee282dae70a
diff --git a/app/components/settings/project_work_packages/header_component.html.erb b/app/components/settings/project_work_packages/header_component.html.erbindex 978e1831198..ac9cce34495 100644--- a/app/components/settings/project_work_packages/header_component.html.erb+++ b/app/components/settings/project_work_packages/header_component.html.erb@@ -33,17 +33,17 @@ See COPYRIGHT and LICENSE files for more details.header.with_tab_nav(label: nil) do |tab_nav|if show_types?tab_nav.with_tab(selected: selected?(:types), href: project_settings_types_path) do |tab|- tab.with_text { "Types" }+ tab.with_text { t("settings.work_packages.types_tab") }endendif show_categories?tab_nav.with_tab(selected: selected?(:categories), href: project_settings_categories_path) do |tab|- tab.with_text { "Categories" }+ tab.with_text { t("settings.work_packages.categories_tab") }endendif show_custom_fields?tab_nav.with_tab(selected: selected?(:custom_fields), href: project_settings_custom_fields_path) do |tab|- tab.with_text { "Custom Fields" }+ tab.with_text { t("settings.work_packages.custom_fields_tab") }endendenddiff --git a/app/views/projects/settings/work_packages/show.html.erb b/app/views/projects/settings/work_packages/show.html.erbindex ef674952ec3..faf53e6873f 100644--- a/app/views/projects/settings/work_packages/show.html.erb+++ b/app/views/projects/settings/work_packages/show.html.erb@@ -37,4 +37,4 @@ See COPYRIGHT and LICENSE files for more details.end%>-<%= t("settings.work_packages.not_allowed_text") %>+<span><%= t("settings.work_packages.not_allowed_text") %></span>diff --git a/config/locales/en.yml b/config/locales/en.ymlindex d7d629cdf1d..0fe01c3b167 100644--- a/config/locales/en.yml+++ b/config/locales/en.yml@@ -3984,6 +3984,9 @@ en:section_work_week: "Work week"section_holidays_and_closures: "Holidays and closures"work_packages:+ categories_tab: "Categories"+ custom_fields_tab: "Custom Fields"+ types_tab: "Types"not_allowed_text: "You do not have the necessary permissions to view this page."text_formatting:diff --git a/spec/features/projects/work_packages_settings_spec.rb b/spec/features/projects/work_packages_settings_spec.rbnew file mode 100644index 00000000000..b46f37a4a48--- /dev/null+++ b/spec/features/projects/work_packages_settings_spec.rb@@ -0,0 +1,86 @@+# frozen_string_literal: true++#-- copyright+# OpenProject is an open source project management software.+# Copyright (C) the OpenProject GmbH+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License version 3.+#+# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:+# Copyright (C) 2006-2013 Jean-Philippe Lang+# Copyright (C) 2010-2013 the ChiliProject Team+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License+# as published by the Free Software Foundation; either version 2+# of the License, or (at your option) any later version.+#+# This program is distributed in the hope that it will be useful,+# but WITHOUT ANY WARRANTY; without even the implied warranty of+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+# GNU General Public License for more details.+#+# You should have received a copy of the GNU General Public License+# along with this program; if not, write to the Free Software+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.+#+# See COPYRIGHT and LICENSE files for more details.+#++++require "spec_helper"++RSpec.describe "Projects", "work packages settings menu", :js do+ let!(:project) { create(:project) }+ let(:work_packages_settings_page) { Pages::Projects::Settings::WorkPackages.new(project) }++ describe "view settings page" do+ context "when the user has access to types tab" do+ let(:permissions) { %i(edit_project view_work_packages manage_types) }++ current_user { create(:user, member_with_permissions: { project => permissions }) }++ it "displays the types tab" do+ work_packages_settings_page.visit!+ expect(page).to have_css(".tabnav-tab", text: I18n.t("settings.work_packages.types_tab"))+ expect(page).to have_css("#types-form")+ end+ end++ context "when the user has access to the categories tab" do+ let(:permissions) { %i(edit_project view_work_packages manage_categories) }++ current_user { create(:user, member_with_permissions: { project => permissions }) }++ it "displays the categories tab" do+ work_packages_settings_page.visit!+ expect(page).to have_css(".tabnav-tab", text: I18n.t("settings.work_packages.categories_tab"))+ expect(page).to have_css("span", text: I18n.t("projects.settings.categories.no_results_title_text"))+ end+ end++ context "when the user has access to the custom fields tab" do+ let(:permissions) { %i(edit_project view_work_packages select_custom_fields) }++ current_user { create(:user, member_with_permissions: { project => permissions }) }++ it "displays the custom fields tab" do+ work_packages_settings_page.visit!+ expect(page).to have_css(".tabnav-tab", text: I18n.t("settings.work_packages.custom_fields_tab"))+ expect(page).to have_css("span", text: I18n.t("projects.settings.custom_fields.no_results_title_text"))+ end+ end++ context "when the user does not have access to any tabs" do+ let(:permissions) { %i(edit_project view_work_packages) }++ current_user { create(:user, member_with_permissions: { project => permissions }) }++ it "does not display any tabs" do+ work_packages_settings_page.visit!+ expect(page).to have_no_css(".tabnav-tab")+ expect(page).to have_css("span", text: I18n.t("settings.work_packages.not_allowed_text"))+ end+ end+ end+end