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
lint settings_helper
ulferts36baf76bc1c4
diff --git a/app/helpers/settings_helper.rb b/app/helpers/settings_helper.rbindex 682b7d888d5..7f479f97877 100644--- a/app/helpers/settings_helper.rb+++ b/app/helpers/settings_helper.rb@@ -56,7 +56,7 @@ module SettingsHelper},{name: 'repositories',- controller:'/admin/settings/repositories_settings',+ controller: '/admin/settings/repositories_settings',label: :label_repository_plural}]@@ -85,7 +85,7 @@ module SettingsHelperhidden +choices.map do |choice|setting_multiselect_choice(setting, choice, options)- end.join.html_safe+ end.join.html_safe # rubocop:disable Rails/OutputSafetyendend@@ -194,10 +194,10 @@ module SettingsHelperprivatedef wrap_field_outer(options, &block)- if options[:label] != false- content_tag(:span, class: 'form--field-container', &block)- else+ if options[:label] == falseblock.call+ else+ content_tag(:span, class: 'form--field-container', &block)endend@@ -210,7 +210,7 @@ module SettingsHelperhidden_field_tag("settings[#{setting}][]", '') +I18n.t("setting_#{setting}")end- end.join.html_safe+ end.join.html_safe # rubocop:disable Rails/OutputSafetyendend@@ -221,17 +221,21 @@ module SettingsHelperexceptions = Array(choice[:except]).compactcontent_tag(:tr, class: 'form--matrix-row') docontent_tag(:td, caption, class: 'form--matrix-cell') +- settings.map do |setting|- content_tag(:td, class: 'form--matrix-checkbox-cell') do- unless exceptions.include?(setting)- styled_check_box_tag("settings[#{setting}][]", value,- Setting.send(setting).include?(value),- disabled_setting_option(setting).merge(id: "#{setting}_#{value}"))- end- end- end.join.html_safe+ settings_matrix_tds(settings, exceptions, value)end- end.join.html_safe+ end.join.html_safe # rubocop:disable Rails/OutputSafety+ end++ def settings_matrix_tds(settings, exceptions, value)+ settings.map do |setting|+ content_tag(:td, class: 'form--matrix-checkbox-cell') do+ unless exceptions.include?(setting)+ styled_check_box_tag("settings[#{setting}][]", value,+ Setting.send(setting).include?(value),+ disabled_setting_option(setting).merge(id: "#{setting}_#{value}"))+ end+ end+ end.join.html_safe # rubocop:disable Rails/OutputSafetyenddef setting_multiselect_choice(setting, choice, options)@@ -244,7 +248,6 @@ module SettingsHelpercontent_tag(:label, class: 'form--label-with-check-box') dostyled_check_box_tag("settings[#{setting}][]", value,Setting.send(setting).include?(value), choice_options) + text.to_s-endenddiff --git a/spec/helpers/settings_helper_spec.rb b/spec/helpers/settings_helper_spec.rbindex 61230bf4e17..429152e06d5 100644--- a/spec/helpers/settings_helper_spec.rb+++ b/spec/helpers/settings_helper_spec.rb@@ -115,7 +115,7 @@ describe SettingsHelper, type: :helper doendit 'is disabled and has no hidden field' do- expect(output).not_to have_selector 'input[type="hidden"][value="''"]', visible: :all+ expect(output).not_to have_selector 'input[type="hidden"][value=""]', visible: :allexpect(output).to have_selector 'input[type="checkbox"][disabled="disabled"].form--check-box', count: 3endend