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
Implement the publish button
Klaus Zanders58156a46d89c
diff --git a/app/components/shares/project_queries/public_flag_component.html.erb b/app/components/shares/project_queries/public_flag_component.html.erbindex 3dbc32862bc..d218a2774b2 100644--- a/app/components/shares/project_queries/public_flag_component.html.erb+++ b/app/components/shares/project_queries/public_flag_component.html.erb@@ -1 +1,15 @@-<%= container.with_row { "Hallo, das ist ein Test" } %>+<%=+container.with_row(mt: 3) do+ render(Primer::Forms::ToggleSwitchForm.new(+ name: "publish_project_query",+ # TODO: Proper translations+ label: "Make the query public",+ caption: "All users will have access",+ src: toggle_public_flag_link,+ csrf_token: form_authenticity_token,+ status_label_position: :start,+ checked:,+ enabled: can_publish?+ ))+end+%>diff --git a/app/components/shares/project_queries/public_flag_component.rb b/app/components/shares/project_queries/public_flag_component.rbindex 4dad89356b6..0c00669ce60 100644--- a/app/components/shares/project_queries/public_flag_component.rb+++ b/app/components/shares/project_queries/public_flag_component.rb@@ -44,6 +44,18 @@ module Sharesprivateattr_reader :strategy, :container++ def toggle_public_flag_link+ toggle_public_project_query_path(strategy.entity)+ end++ def checked+ strategy.entity.public?+ end++ def can_publish?+ User.current.allowed_globally?(:manage_public_project_queries)+ endendendend