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

Render base component conditionally

Mir Bhatiabd4e2ed3148c
diff --git a/modules/meeting/app/components/meeting_agenda_items/outcomes/base_component.html.erb b/modules/meeting/app/components/meeting_agenda_items/outcomes/base_component.html.erb
index 42c4dec8119..454f7296e7c 100644
--- a/modules/meeting/app/components/meeting_agenda_items/outcomes/base_component.html.erb
+++ b/modules/meeting/app/components/meeting_agenda_items/outcomes/base_component.html.erb
@@ -1,17 +1,19 @@
<%=
component_wrapper do
- grid_layout("op-meeting-outcome", tag: :div, id: "outcome-#{@meeting_agenda_item.id}", mt: conditional_margin_top) do |grid|
- if @edit
- grid.with_area(:notes) do
- render(MeetingAgendaItems::Outcomes::InputComponent.new(meeting: @meeting, meeting_agenda_item: @meeting_agenda_item, meeting_outcome: @meeting_outcome))
- end
- elsif @meeting_outcome.present?
- grid.with_area(:notes) do
- render(MeetingAgendaItems::Outcomes::ShowNotesComponent.new(meeting_outcome: @meeting_outcome))
- end
- else
- grid.with_area(:button) do
- render(MeetingAgendaItems::Outcomes::NewButtonComponent.new(meeting: @meeting, meeting_agenda_item: @meeting_agenda_item))
+ if show_outcome?
+ grid_layout("op-meeting-outcome", tag: :div, id: "outcome-#{@meeting_agenda_item.id}", mt: 2) do |grid|
+ if @edit
+ grid.with_area(:notes) do
+ render(MeetingAgendaItems::Outcomes::InputComponent.new(meeting: @meeting, meeting_agenda_item: @meeting_agenda_item, meeting_outcome: @meeting_outcome))
+ end
+ elsif @meeting_outcome.present?
+ grid.with_area(:notes) do
+ render(MeetingAgendaItems::Outcomes::ShowNotesComponent.new(meeting_outcome: @meeting_outcome))
+ end
+ else
+ grid.with_area(:button) do
+ render(MeetingAgendaItems::Outcomes::NewButtonComponent.new(meeting: @meeting, meeting_agenda_item: @meeting_agenda_item))
+ end
end
end
end
diff --git a/modules/meeting/app/components/meeting_agenda_items/outcomes/base_component.rb b/modules/meeting/app/components/meeting_agenda_items/outcomes/base_component.rb
index 15084a7093d..312d4990f95 100644
--- a/modules/meeting/app/components/meeting_agenda_items/outcomes/base_component.rb
+++ b/modules/meeting/app/components/meeting_agenda_items/outcomes/base_component.rb
@@ -54,12 +54,8 @@ module MeetingAgendaItems
end
end
- def conditional_margin_top
- if @meeting.in_progress? || @meeting_outcome.present?
- 2
- else
- 0
- end
+ def show_outcome?
+ @meeting.in_progress? || @meeting_outcome.present?
end
end
end