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
extract form into an actual form, and include enterprise banner
Bruno Pagnocaccaaa65cb3
diff --git a/app/forms/projects/settings/work_packages/activities/form.rb b/app/forms/projects/settings/work_packages/activities/form.rbnew file mode 100644index 00000000000..8c468c3381c--- /dev/null+++ b/app/forms/projects/settings/work_packages/activities/form.rb@@ -0,0 +1,51 @@+# 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.+#+++module Projects::Settings::WorkPackages::Activities+ class Form < ApplicationForm+ form do |f|+ f.check_box(+ name: :enabled_comments_with_restricted_visibility,+ label: I18n.t("settings.work_packages.activities.enable_comments_with_restricted_visibility"),+ caption: I18n.t("settings.work_packages.activities.helper_text"),+ checked: model.project.enabled_comments_with_restricted_visibility+ )++ f.submit(+ name: :submit,+ label: I18n.t(:button_save),+ scheme: :primary+ )+ end++ def initialize(**_options)+ super()+ end+ end+enddiff --git a/app/views/projects/settings/work_packages/activities/show.html.erb b/app/views/projects/settings/work_packages/activities/show.html.erbindex c8f1b2c66fe..8ec7dbe56c6 100644--- a/app/views/projects/settings/work_packages/activities/show.html.erb+++ b/app/views/projects/settings/work_packages/activities/show.html.erb@@ -29,15 +29,24 @@ See COPYRIGHT and LICENSE files for more details.<%= render(Settings::ProjectWorkPackages::HeaderComponent.new(@project, selected: :activities)) %>-<%=- # this could be exctracted into a Form component- form_for @project,- url: project_settings_work_packages_activities_path(@project),- method: :patch,- html: { id: "activities-form" } do |f|-%>- <%= f.check_box :enabled_comments_with_restricted_visibility %>- <%= f.label :enabled_comments_with_restricted_visibility, "Enable comments with restricted visibility" %>- <p>Helper text here</p>- <%= f.submit "Save" %>+<% if EnterpriseToken.allows_to?(:comments_with_restricted_visibility) %>+ <%=+ primer_form_with(+ model: @project,+ url: project_settings_work_packages_activities_path(@project),+ id: "activities-form"+ ) do |f|+ %>+ <%= render(Projects::Settings::WorkPackages::Activities::Form.new(f)) %>+ <% end %>+<% else %>+ <%=+ render(+ EnterpriseEdition::BannerComponent.new(+ :comments_with_restricted_visibility,+ href: OpenProject::Static::Links.url_for(:user_guides_work_package_activity),+ mb: 3+ )+ )+ %><% end %>diff --git a/config/locales/en.yml b/config/locales/en.ymlindex 42ffa81138b..259f2c27f40 100644--- a/config/locales/en.yml+++ b/config/locales/en.yml@@ -2078,6 +2078,8 @@ en:description: "Customize the form configuration with these additional add-ons:"add_groups: "Add new attribute groups"rename_groups: "Rename attributes groups"+ comments_with_restricted_visibility:+ description: "To be defined"enumeration_activities: "Time tracking activities"enumeration_work_package_priorities: "Work package priorities"@@ -4016,6 +4018,9 @@ en:section_holidays_and_closures: "Holidays and closures"work_packages:not_allowed_text: "You do not have the necessary permissions to view this page."+ activities:+ enable_comments_with_restricted_visibility: "Enable restricted visibility comments"+ helper_text: "Restricted comments allow an internal team to communicate amongst themselves privately. These are only visible to select roles that have the necessary permissions and will not be visible publicly."text_formatting:markdown: "Markdown"diff --git a/spec/features/projects/settings/activities_settings_spec.rb b/spec/features/projects/settings/activities_settings_spec.rbindex 31238e0041b..47023654056 100644--- a/spec/features/projects/settings/activities_settings_spec.rb+++ b/spec/features/projects/settings/activities_settings_spec.rb@@ -42,13 +42,13 @@ RSpec.describe "WorkPackages-Settings-Activities", :js doexpect(page).to have_field(:project_enabled_comments_with_restricted_visibility, checked: false)- check("Enable comments with restricted visibility")+ check("Enable restricted visibility comments")click_link_or_button "Save"expect_and_dismiss_flash(message: "Successful update.")expect(page).to have_field(:project_enabled_comments_with_restricted_visibility, checked: true)- uncheck("Enable comments with restricted visibility")+ uncheck("Enable restricted visibility comments")click_link_or_button "Save"expect_and_dismiss_flash(message: "Successful update.")