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

Add status button to infoline component

Mir Bhatiaac056ac447ca
diff --git a/modules/meeting/app/components/meetings/header_infoline_component.html.erb b/modules/meeting/app/components/meetings/header_infoline_component.html.erb
index 8c2da294cbf..bd2fde5df8d 100644
--- a/modules/meeting/app/components/meetings/header_infoline_component.html.erb
+++ b/modules/meeting/app/components/meetings/header_infoline_component.html.erb
@@ -1,6 +1,11 @@
<%= render(Primer::BaseComponent.new(tag: :div)) do %>
<% if @series && [email protected]? %>
+ <%= render(Meetings::SidePanel::StatusButtonComponent.new(meeting: @meeting, size: :small)) %>
<%= t("recurring_meeting.occurrence.infoline", title: @series.title) %>
+ <% elsif [email protected]? %>
+ <%= render(Meetings::SidePanel::StatusButtonComponent.new(meeting: @meeting, size: :small)) %>
+ <%= t(:label_meeting_created_by) %>
+ <%= helpers.primer_link_to_user(@meeting.author) %>.
<% else %>
<%= t(:label_meeting_created_by) %>
<%= helpers.primer_link_to_user(@meeting.author) %>.
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 dbd429f0a30..84d9a0fe2ef 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
@@ -7,7 +7,7 @@
when "open"
flex_layout(classes: "op-meeting-sidebar-state") do |open_state|
open_state.with_row do
- render(status_button)
+ status_button
end
open_state.with_row(mt: 3, classes: "hidden-for-mobile") do
@@ -31,7 +31,7 @@
when "closed"
flex_layout(classes: "op-meeting-sidebar-state") do |closed_state|
closed_state.with_row do
- render(status_button)
+ status_button
end
closed_state.with_row(mt: 3, classes: "hidden-for-mobile") do
@@ -54,7 +54,7 @@
when "in_progress"
flex_layout(classes: "op-meeting-sidebar-state") do |in_progress_state|
in_progress_state.with_row do
- render(status_button)
+ status_button
end
in_progress_state.with_row(mt: 3, classes: "hidden-for-mobile") do
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 1cf2af5ae7f..2c53dc11a33 100644
--- a/modules/meeting/app/components/meetings/side_panel/state_component.rb
+++ b/modules/meeting/app/components/meetings/side_panel/state_component.rb
@@ -48,53 +48,7 @@ module Meetings
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" }
- })
+ render(Meetings::SidePanel::StatusButtonComponent.new(meeting: @meeting))
end
end
end
diff --git a/modules/meeting/app/components/meetings/side_panel/status_button_component.rb b/modules/meeting/app/components/meetings/side_panel/status_button_component.rb
index eb170fe4145..1d6457227b3 100644
--- a/modules/meeting/app/components/meetings/side_panel/status_button_component.rb
+++ b/modules/meeting/app/components/meetings/side_panel/status_button_component.rb
@@ -44,10 +44,10 @@ module Meetings
def call
render(OpPrimer::StatusButtonComponent.new(current_status: current_status,
- items: [open_status, in_progress_status, closed_status],
- readonly: !edit_enabled?,
- disabled: !edit_enabled?,
- button_arguments: { title: t("label_meeting_state"), size: @size}))
+ items: [open_status, in_progress_status, closed_status],
+ readonly: !edit_enabled?,
+ disabled: !edit_enabled?,
+ button_arguments: { title: t("label_meeting_state"), size: @size }))
end
private