Skip to content

Commit

Permalink
Set default title
Browse files Browse the repository at this point in the history
  • Loading branch information
oliverguenther committed May 16, 2024
1 parent 4309650 commit 3a9c3e8
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,7 @@ def editable?
end

def render_section_wrapper?
# true
!@meeting_section.untitled? || @meeting.sections.count > 1
!@meeting_section.has_default_title? || @meeting.sections.count > 1
end

def render_new_button_in_section?
Expand Down
2 changes: 1 addition & 1 deletion modules/meeting/app/forms/meeting_section/title.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class MeetingSection::Title < ApplicationForm
private

def init_value(meeting_section_form)
if meeting_section_form.builder.object.has_default_title? || meeting_section_form.builder.object.untitled?
if meeting_section_form.builder.object.has_default_title?
"" # will be set to "Untitled" in the model if left empty
else
meeting_section_form.builder.object.title
Expand Down
6 changes: 1 addition & 5 deletions modules/meeting/app/models/meeting_section.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,18 +52,14 @@ def trigger_meeting_agenda_item_time_slots_calculation

def set_default_title
if title.blank?
self.title = I18n.t("meeting_section.untitled_title")
self.title = I18n.t("meeting_section.default_title")
end
end

def has_default_title?
title == I18n.t("meeting_section.default_title")
end

def untitled?
title == I18n.t("meeting_section.untitled_title")
end

def editable?
!meeting&.closed?
end
Expand Down

0 comments on commit 3a9c3e8

Please sign in to comment.