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

support starting with sections only for conceptual testing, refactoring of code required

Jonas Jabari7cc5b27f535f
diff --git a/modules/meeting/app/components/meeting_agenda_items/new_button_component.html.erb b/modules/meeting/app/components/meeting_agenda_items/new_button_component.html.erb
index 496bdd629fe..f950248b5fc 100644
--- a/modules/meeting/app/components/meeting_agenda_items/new_button_component.html.erb
+++ b/modules/meeting/app/components/meeting_agenda_items/new_button_component.html.erb
@@ -21,7 +21,7 @@
data: { "turbo-stream": true }
}
)
- unless @meeting_section || @meeting.sections.empty?
+ unless @meeting_section
component.with_item(
label: "Section",
tag: :a,
diff --git a/modules/meeting/app/components/meeting_sections/show_component.rb b/modules/meeting/app/components/meeting_sections/show_component.rb
index e3014290cf3..fc190c32fdd 100644
--- a/modules/meeting/app/components/meeting_sections/show_component.rb
+++ b/modules/meeting/app/components/meeting_sections/show_component.rb
@@ -56,11 +56,13 @@ module MeetingSections
end
def hide_section?
- @meeting.sections.count == 1 && @meeting_agenda_items.empty?
+ false
+ # @meeting.sections.count == 1 && @meeting_agenda_items.empty? && @meeting_section.untitled?
end
def render_section_wrapper?
- @meeting_section.meeting.sections.count > 1
+ # true
+ !@meeting_section.untitled? || @meeting.sections.count > 1
end
def render_new_button_in_section?
diff --git a/modules/meeting/app/controllers/meeting_sections_controller.rb b/modules/meeting/app/controllers/meeting_sections_controller.rb
index e5c0e2dee31..3c5e7ca744d 100644
--- a/modules/meeting/app/controllers/meeting_sections_controller.rb
+++ b/modules/meeting/app/controllers/meeting_sections_controller.rb
@@ -61,7 +61,8 @@ class MeetingSectionsController < ApplicationController
.new(user: current_user)
.call(
{
- meeting_id: @meeting.id
+ meeting_id: @meeting.id,
+ title: "New Section"
}
)
diff --git a/modules/meeting/app/forms/meeting_section/title.rb b/modules/meeting/app/forms/meeting_section/title.rb
index 788698479c2..41e71e5ccc2 100644
--- a/modules/meeting/app/forms/meeting_section/title.rb
+++ b/modules/meeting/app/forms/meeting_section/title.rb
@@ -46,7 +46,7 @@ class MeetingSection::Title < ApplicationForm
private
def init_value(meeting_section_form)
- if meeting_section_form.builder.object.has_default_title?
+ if meeting_section_form.builder.object.has_default_title? || meeting_section_form.builder.object.untitled?
"" # will be set to "Untitled" in the model if left empty
else
meeting_section_form.builder.object.title
diff --git a/modules/meeting/app/models/meeting_agenda_item.rb b/modules/meeting/app/models/meeting_agenda_item.rb
index abc2a61df89..d69ae64c049 100644
--- a/modules/meeting/app/models/meeting_agenda_item.rb
+++ b/modules/meeting/app/models/meeting_agenda_item.rb
@@ -69,7 +69,7 @@ class MeetingAgendaItem < ApplicationRecord
item.duration_in_minutes_previously_changed? || item.position_previously_changed?
}
after_destroy :trigger_meeting_agenda_item_time_slots_calculation
- after_destroy :delete_meeting_section_if_empty
+ # after_destroy :delete_meeting_section_if_empty
def add_to_latest_meeting_section
if meeting_section_id.nil?
@@ -87,13 +87,13 @@ class MeetingAgendaItem < ApplicationRecord
meeting.calculate_agenda_item_time_slots
end
- def delete_meeting_section_if_empty
- # we need to delete the last existing section if the last meeting agenda item is deleted
- # as we don't render the section (including the section menu) if only one section exists
- # thus the section would silently exist in the database when the very last agenda item was deleted
- # which makes UI rendering inconsistent
- meeting_section.destroy if meeting_section.agenda_items.empty? && meeting.sections.count == 1
- end
+ # def delete_meeting_section_if_empty
+ # # we need to delete the last existing section if the last meeting agenda item is deleted
+ # # as we don't render the section (including the section menu) if only one section exists
+ # # thus the section would silently exist in the database when the very last agenda item was deleted
+ # # which makes UI rendering inconsistent
+ # meeting_section.destroy if meeting_section.agenda_items.empty? && meeting.sections.count == 1
+ # end
def linked_work_package?
item_type == "work_package" && work_package.present?
diff --git a/modules/meeting/app/models/meeting_section.rb b/modules/meeting/app/models/meeting_section.rb
index 6cea75cfc43..3ac9fa419df 100644
--- a/modules/meeting/app/models/meeting_section.rb
+++ b/modules/meeting/app/models/meeting_section.rb
@@ -49,6 +49,10 @@ class MeetingSection < ApplicationRecord
end
def has_default_title?
+ title == "New Section" # TODO: I18n
+ end
+
+ def untitled?
title == "Untitled" # TODO: I18n
end