Skip to content

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

Use params["value"] to set the publicstate

Klaus Zanders5fc970d75b89
diff --git a/app/components/shares/project_queries/public_flag_component.html.erb b/app/components/shares/project_queries/public_flag_component.html.erb
index aec171db24e..289cbd3a65a 100644
--- a/app/components/shares/project_queries/public_flag_component.html.erb
+++ b/app/components/shares/project_queries/public_flag_component.html.erb
@@ -8,7 +8,8 @@ container.with_row do
csrf_token: form_authenticity_token,
status_label_position: :start,
checked: published?,
- enabled: can_publish?
+ enabled: can_publish?,
+ data: { turbo: true }
))
end
%>
diff --git a/app/controllers/projects/queries_controller.rb b/app/controllers/projects/queries_controller.rb
index 7d2d17c7103..253985d51ab 100644
--- a/app/controllers/projects/queries_controller.rb
+++ b/app/controllers/projects/queries_controller.rb
@@ -73,7 +73,7 @@ class Projects::QueriesController < ApplicationController
end
def toggle_public # rubocop:disable Metrics/AbcSize
- to_be_public = [email protected]?
+ to_be_public = ActiveRecord::Type::Boolean.new.cast(params["value"])
i18n_key = to_be_public ? "lists.publish" : "lists.unpublish"
call = Queries::Projects::ProjectQueries::PublishService