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

Update meeting sidepanel to use new status button

Mir Bhatia5b1122bdc5cb
diff --git a/modules/meeting/app/components/meetings/side_panel/state_component.html.erb b/modules/meeting/app/components/meetings/side_panel/state_component.html.erb
index 68aa88525aa..f189745701a 100644
--- a/modules/meeting/app/components/meetings/side_panel/state_component.html.erb
+++ b/modules/meeting/app/components/meetings/side_panel/state_component.html.erb
@@ -5,21 +5,13 @@
case @meeting.state
when "open"
- section.with_description(display: [:none, nil, :block]) { t("text_meeting_open_description") }
-
flex_layout(classes: "op-meeting-sidebar-state") do |open_state|
open_state.with_row do
- render(Primer::Beta::State.new(title: "state", scheme: :open)) do
- flex_layout do |open_state_label|
- open_state_label.with_column(mr: 1) do
- render(Primer::Beta::Octicon.new(icon: "issue-opened"))
- end
+ render(status_button)
+ end
- open_state_label.with_column do
- render(Primer::Beta::Text.new) { t("label_meeting_state_open") }
- end
- end
- end
+ open_state.with_row(mt: 3, classes: "hidden-for-mobile") do
+ render(Primer::Beta::Text.new(color: :subtle)) { t("text_meeting_open_description") }
end
if edit_enabled?
@@ -36,21 +28,13 @@
end
end
when "closed"
- section.with_description(display: [:none, nil, :block]) { t("text_meeting_closed_description") }
-
flex_layout(classes: "op-meeting-sidebar-state") do |closed_state|
closed_state.with_row do
- render(Primer::Beta::State.new(title: "state", scheme: :default)) do
- flex_layout do |closed_state_label|
- closed_state_label.with_column(mr: 1) do
- render(Primer::Beta::Octicon.new(icon: "issue-closed"))
- end
+ render(status_button)
+ end
- closed_state_label.with_column do
- render(Primer::Beta::Text.new) { t("label_meeting_state_closed") }
- end
- end
- end
+ closed_state.with_row(mt: 3, classes: "hidden-for-mobile") do
+ render(Primer::Beta::Text.new(color: :subtle)) { t("text_meeting_closed_description") }
end
if edit_enabled?
@@ -66,21 +50,13 @@
end
end
when "in_progress"
- section.with_description(display: [:none, nil, :block]) { t("text_meeting_in_progress_description") }
-
flex_layout(classes: "op-meeting-sidebar-state") do |in_progress_state|
in_progress_state.with_row do
- render(Primer::Beta::State.new(title: "state", scheme: :merged)) do
- flex_layout do |in_progress_state_label|
- in_progress_state_label.with_column(mr: 1) do
- render(Primer::Beta::Octicon.new(icon: "play"))
- end
+ render(status_button)
+ end
- in_progress_state_label.with_column do
- render(Primer::Beta::Text.new) { t("label_meeting_state_in_progress") }
- end
- end
- end
+ in_progress_state.with_row(mt: 3, classes: "hidden-for-mobile") do
+ render(Primer::Beta::Text.new(color: :subtle)) { t("text_meeting_in_progress_description") }
end
if edit_enabled?
diff --git a/modules/meeting/app/components/meetings/side_panel/state_component.rb b/modules/meeting/app/components/meetings/side_panel/state_component.rb
index 00ff58477ab..1cf2af5ae7f 100644
--- a/modules/meeting/app/components/meetings/side_panel/state_component.rb
+++ b/modules/meeting/app/components/meetings/side_panel/state_component.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
#-- copyright
# OpenProject is an open source project management software.
# Copyright (C) the OpenProject GmbH
@@ -45,5 +46,55 @@ module Meetings
def edit_enabled?
User.current.allowed_in_project?(:close_meeting_agendas, @project)
end
+
+ def status_button
+ current_status = case @meeting.state
+ when "open"
+ open_status
+ when "in_progress"
+ in_progress_status
+ when "closed"
+ closed_status
+ end
+
+ OpPrimer::StatusButtonComponent.new(current_status: current_status,
+ items: [open_status, in_progress_status, closed_status],
+ readonly: !edit_enabled?,
+ disabled: !edit_enabled?,
+ button_arguments: { title: "Status", size: :medium })
+ end
+
+ def open_status
+ OpPrimer::StatusButtonOption.new(name: t("label_meeting_state_open"),
+ color: Color.new(hexcode: "#1F883D"),
+ icon: :"issue-opened",
+ tag: :a,
+ href: change_state_project_meeting_path(@project, @meeting, state: "open"),
+ content_arguments: {
+ data: { "turbo-stream": true, "turbo-method": "put" }
+ })
+ end
+
+ def in_progress_status
+ OpPrimer::StatusButtonOption.new(name: t("label_meeting_state_in_progress"),
+ color: Color.new(hexcode: "#9A6700"),
+ icon: :play,
+ tag: :a,
+ href: change_state_project_meeting_path(@project, @meeting, state: "in_progress"),
+ content_arguments: {
+ data: { "turbo-stream": true, "turbo-method": "put" }
+ })
+ end
+
+ def closed_status
+ OpPrimer::StatusButtonOption.new(name: t("label_meeting_state_closed"),
+ color: Color.new(hexcode: "#8250DF"),
+ icon: :"codescan-checkmark",
+ tag: :a,
+ href: change_state_project_meeting_path(@project, @meeting, state: "closed"),
+ content_arguments: {
+ data: { "turbo-stream": true, "turbo-method": "put" }
+ })
+ end
end
end