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
[#55789] added validation message to toggle switch
Eric Schubert4f97ae9cc745
diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rbindex 561d2e1b6d8..60e78cf76b3 100644--- a/app/controllers/projects_controller.rb+++ b/app/controllers/projects_controller.rb@@ -99,9 +99,9 @@ class ProjectsController < ApplicationController.call(deactivate_work_package_attachments: params[:value] != "1")if call.failure?- return render_403 if call.errors.map(&:type).include?(:error_unauthorized)-- render_error({ message: call.errors.full_messages.join("\n") })+ render json: call.errors.full_messages.join(" "), status: :unprocessable_entity+ else+ head :no_contentendenddiff --git a/modules/storages/app/views/storages/project_settings/attachments.html.erb b/modules/storages/app/views/storages/project_settings/attachments.html.erbindex 3d41c9e4b86..52948d755aa 100644--- a/modules/storages/app/views/storages/project_settings/attachments.html.erb+++ b/modules/storages/app/views/storages/project_settings/attachments.html.erb@@ -55,29 +55,24 @@ See COPYRIGHT and LICENSE files for more details.end%>-<%= render(Primer::OpenProject::FlexLayout.new(p: 3)) do |l|- l.with_row(flex_layout: true, align_items: :center, justify_content: :space_between) do |row|- row.with_column do- render(Primer::Beta::Text.new(font_weight: :bold)) do- t("storages.show_attachments_toggle.label")- end- end- row.with_column do- checked = if @project.deactivate_work_package_attachments.nil?- Setting.show_work_package_attachments- else- [email protected]_work_package_attachments- end- render(Primer::Alpha::ToggleSwitch.new(src: deactivate_work_package_attachments_project_path(@project),- csrf_token: form_authenticity_token,- status_label_position: :start,- checked:))- end- end- l.with_row do- render(Primer::Beta::Text.new(color: :muted)) do- t("storages.show_attachments_toggle.description")- end- end+<%=+ render(Primer::OpenProject::FlexLayout.new(p: 3)) do |container|+ container.with_row do+ checked = if @project.deactivate_work_package_attachments.nil?+ Setting.show_work_package_attachments+ else+ [email protected]_work_package_attachments+ end++ render(Primer::Forms::ToggleSwitchForm.new(+ name: "deactivate_work_package_attachments",+ label: t("storages.show_attachments_toggle.label"),+ caption: t("storages.show_attachments_toggle.description"),+ src: deactivate_work_package_attachments_project_path(@project),+ csrf_token: form_authenticity_token,+ status_label_position: :start,+ checked:+ ))end+ end%>