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
Also disable submit button when token is missing
Jan Sandbrinkf7ac665c7d07
diff --git a/app/forms/work_packages/types/subject_configuration_form.rb b/app/forms/work_packages/types/subject_configuration_form.rbindex 9faf6d55fae..51cea3c9c34 100644--- a/app/forms/work_packages/types/subject_configuration_form.rb+++ b/app/forms/work_packages/types/subject_configuration_form.rb@@ -67,7 +67,12 @@ module WorkPackages)end- subject_form.submit(name: :submit, label: I18n.t(:button_save), scheme: :primary)+ subject_form.submit(+ name: :submit,+ label: I18n.t(:button_save),+ disabled: !EnterpriseToken.active? && !has_pattern?,+ scheme: :primary+ )endprivatediff --git a/spec/components/work_packages/types/subject_configuration_component_spec.rb b/spec/components/work_packages/types/subject_configuration_component_spec.rbindex 7ac73b1ec0b..bf3ac898891 100644--- a/spec/components/work_packages/types/subject_configuration_component_spec.rb+++ b/spec/components/work_packages/types/subject_configuration_component_spec.rb@@ -54,6 +54,12 @@ RSpec.describe WorkPackages::Types::SubjectConfigurationComponent, type: :componexpect(page.find("input[type=radio][value=manual]")).not_to be_disabledend+ it "enables the submit button" do+ render_component++ expect(page.find("button[type=submit]")).not_to be_disabled+ end+context "when enterprise edition is not activated" dobefore doallow(EnterpriseToken).to receive(:active?).and_return(false)@@ -72,6 +78,12 @@ RSpec.describe WorkPackages::Types::SubjectConfigurationComponent, type: :componexpect(page.find("input[type=radio][value=manual]")).not_to be_disabledend+ it "disables the submit button" do+ render_component++ expect(page.find("button[type=submit]")).to be_disabled+ end+context "and when the subject is already automatically generated" dolet(:type) { create(:type, patterns: { subject: { blueprint: "Hello world", enabled: true } }) }@@ -87,6 +99,12 @@ RSpec.describe WorkPackages::Types::SubjectConfigurationComponent, type: :componexpect(page.find("input[type=radio][value=auto]")).not_to be_disabledexpect(page.find("input[type=radio][value=manual]")).not_to be_disabledend++ it "enables the submit button" do+ render_component++ expect(page.find("button[type=submit]")).not_to be_disabled+ endendendend