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
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
changed attribute name to to be consistent, fixed section header layout
Jonas Jabaric816788a9ff9
diff --git a/frontend/src/stimulus/controllers/dynamic/meeting-section-form.controller.ts b/frontend/src/stimulus/controllers/dynamic/meeting-section-form.controller.tsindex 91be719c9c6..285b73b18d1 100644--- a/frontend/src/stimulus/controllers/dynamic/meeting-section-form.controller.ts+++ b/frontend/src/stimulus/controllers/dynamic/meeting-section-form.controller.ts@@ -43,12 +43,12 @@ export default class extends Controller {}focusInput():void {- const nameInput = this.element.querySelector('input[name="meeting_section[name]"]');+ const titleInput = this.element.querySelector('input[name="meeting_section[title]"]');setTimeout(() => {this.element.scrollIntoView({ block: 'center' });- (nameInput as HTMLInputElement).focus();- this.setCursorAtEnd(nameInput as HTMLInputElement);+ (titleInput as HTMLInputElement).focus();+ this.setCursorAtEnd(titleInput as HTMLInputElement);}, 100);}diff --git a/modules/meeting/app/components/_index.sass b/modules/meeting/app/components/_index.sassindex 7655e791146..30244d389ce 100644--- a/modules/meeting/app/components/_index.sass+++ b/modules/meeting/app/components/_index.sass@@ -1,5 +1,6 @@@import "./meeting_agenda_items/item_component/show_component.sass"@import "./meeting_agenda_items/form_component.sass"+@import "./meeting_sections/header_component.sass"@import "./meetings/sidebar/state_component.sass"@import "./meetings/sidebar/participants_component.sass"@import "./meetings/sidebar/details_component.sass"diff --git a/modules/meeting/app/components/meeting_sections/header_component.html.erb b/modules/meeting/app/components/meeting_sections/header_component.html.erbindex cd964d5e27c..2dcb7910544 100644--- a/modules/meeting/app/components/meeting_sections/header_component.html.erb+++ b/modules/meeting/app/components/meeting_sections/header_component.html.erb@@ -1,45 +1,41 @@<%=component_wrapper(class: "op-meeting-section-container", data: { test_selector: "meeting-section-container-#{@meeting_section.id}" }) doif @state == :show- flex_layout(justify_content: :space_between, align_items: :center) do |section_header_container|- section_header_container.with_column(flex_layout: true, align_items: :center) do |content_container|- content_container.with_column(mr: editable? ? 2 : 4) do- if editable?- render(Primer::OpenProject::DragHandle.new(classes: 'handle'))- end+ grid_layout('op-meeting-section', tag: :div) do |grid|+ grid.with_area(:'drag-handle', tag: :div) do+ if editable?+ render(Primer::OpenProject::DragHandle.new(classes: 'handle'))end- content_container.with_column do- render(Primer::Beta::Text.new(font_weight: :bold)) do- @meeting_section.name- end+ end+ grid.with_area(:content, tag: :span) do+ render(Primer::Beta::Text.new(font_weight: :bold, mr: 2)) do+ @meeting_section.titleend- if @meeting_section.agenda_items_sum_duration_in_minutes > 0- content_container.with_column(ml: 2) do- render(Primer::Beta::Text.new(font_size: :small, font_weight: :normal, color: :subtle)) do- render(OpenProject::Common::DurationComponent.new(@meeting_section.agenda_items_sum_duration_in_minutes, :minutes, abbreviated: true))- end+ end+ if @meeting_section.agenda_items_sum_duration_in_minutes > 0+ grid.with_area(:duration, Primer::Beta::Text, color: :subtle, mr: 1, font_size: :small) do+ render(Primer::Beta::Text.new(font_size: :small, font_weight: :normal, color: :subtle)) do+ render(OpenProject::Common::DurationComponent.new(@meeting_section.agenda_items_sum_duration_in_minutes, :minutes, abbreviated: true))endendend- if editable?- section_header_container.with_column(flex_layout: true, justify_content: :flex_end) do |actions_container|- actions_container.with_column do- render(Primer::Alpha::ActionMenu.new(data: { test_selector: "meeting-section-action-menu" })) do |menu|- menu.with_show_button(icon: "kebab-horizontal", 'aria-label': t("settings.project_attributes.label_section_actions"), scheme: :invisible)- edit_action_item(menu)- unless first? && last?- menu.with_divider- move_actions(menu)- end- menu.with_divider- add_agenda_item_action(menu)- add_work_package_action(menu)- menu.with_divider- if @meeting_agenda_items.empty?- delete_action_item(menu)- else- disabled_delete_action_item(menu)- end+ grid.with_area(:actions, tag: :div, justify_self: :end) do+ if editable?+ render(Primer::Alpha::ActionMenu.new(data: { test_selector: "meeting-section-action-menu" })) do |menu|+ menu.with_show_button(icon: "kebab-horizontal", 'aria-label': t("settings.project_attributes.label_section_actions"), scheme: :invisible)+ edit_action_item(menu)+ unless first? && last?+ menu.with_divider+ move_actions(menu)+ end+ menu.with_divider+ add_agenda_item_action(menu)+ add_work_package_action(menu)+ menu.with_divider+ if @meeting_agenda_items.empty?+ delete_action_item(menu)+ else+ disabled_delete_action_item(menu)endendend@@ -57,8 +53,8 @@}) do |f|flex_layout do |editable_title_form|- editable_title_form.with_column(flex: 1, mr: 2, pl: 3) do- render(MeetingSection::Name.new(f))+ editable_title_form.with_column(flex: 1, mr: 2, pl: 2) do+ render(MeetingSection::Title.new(f))endeditable_title_form.with_column(mr: 2) dodiff --git a/modules/meeting/app/components/meeting_sections/header_component.rb b/modules/meeting/app/components/meeting_sections/header_component.rbindex eeea4ed7b56..a68219c747e 100644--- a/modules/meeting/app/components/meeting_sections/header_component.rb+++ b/modules/meeting/app/components/meeting_sections/header_component.rb@@ -156,23 +156,5 @@ module MeetingSectionsitem.with_leading_visual_icon(icon: :trash)endend-- def first?- @first ||=- if @first_and_last.first- @first_and_last.first == @meeting_section- else- @meeting_section.first?- end- end-- def last?- @last ||=- if @first_and_last.last- @first_and_last.last == @meeting_section- else- @meeting_section.last?- end- endendenddiff --git a/modules/meeting/app/components/meeting_sections/header_component.sass b/modules/meeting/app/components/meeting_sections/header_component.sassnew file mode 100644index 00000000000..e855233a9e5--- /dev/null+++ b/modules/meeting/app/components/meeting_sections/header_component.sass@@ -0,0 +1,23 @@+@import 'helpers'++.op-meeting-section+ display: grid+ grid-template-columns: 20px auto 1fr fit-content(40px)+ grid-template-areas: "drag-handle content duration actions"++ &--drag-handle,+ &--duration,+ &--content+ align-self: center++ &--actions+ justify-self: end++ &--duration+ white-space: nowrap++ &--content+ @include text-shortener++ @media screen and (max-width: $breakpoint-lg)+ grid-template-columns: 20px auto 1fr 50pxdiff --git a/modules/meeting/app/contracts/meeting_sections/base_contract.rb b/modules/meeting/app/contracts/meeting_sections/base_contract.rbindex 22d37b633d8..ffac0b4d627 100644--- a/modules/meeting/app/contracts/meeting_sections/base_contract.rb+++ b/modules/meeting/app/contracts/meeting_sections/base_contract.rb@@ -36,7 +36,7 @@ module MeetingSectionsattribute :meeting- attribute :name+ attribute :titleattribute :positionendenddiff --git a/modules/meeting/app/controllers/concerns/meetings/agenda_component_streams.rb b/modules/meeting/app/controllers/concerns/meetings/agenda_component_streams.rbindex f47eac31830..accf2c901fc 100644--- a/modules/meeting/app/controllers/concerns/meetings/agenda_component_streams.rb+++ b/modules/meeting/app/controllers/concerns/meetings/agenda_component_streams.rb@@ -249,24 +249,27 @@ module Meetings# Note: The `remove_component` and the `component` are pointing to the same# component, but we still need to instantiate them separately, otherwise re-adding# of the item will render and empty component.- remove_component = MeetingAgendaItems::ItemComponent.new(state: :show, meeting_agenda_item:)- remove_via_turbo_stream(component: remove_component)+ # remove_component = MeetingAgendaItems::ItemComponent.new(state: :show, meeting_agenda_item:)+ # remove_via_turbo_stream(component: remove_component)- component = MeetingAgendaItems::ItemComponent.new(state: :show, meeting_agenda_item:)- target_component =- if @meeting_agenda_item.lower_item- MeetingAgendaItems::ItemComponent.new(- state: :show,- meeting_agenda_item: @meeting_agenda_item.lower_item- )- else- MeetingSections::ShowComponent.new(- meeting_section: @meeting_agenda_item.meeting_section- )- # MeetingAgendaItems::ListComponent.new(meeting: @meeting)- end- add_before_via_turbo_stream(component:, target_component:)- update_show_items_via_turbo_stream+ # component = MeetingAgendaItems::ItemComponent.new(state: :show, meeting_agenda_item:)+ # target_component =+ # if @meeting_agenda_item.lower_item+ # MeetingAgendaItems::ItemComponent.new(+ # state: :show,+ # meeting_agenda_item: @meeting_agenda_item.lower_item+ # )+ # else+ # MeetingSections::ShowComponent.new(+ # meeting_section: @meeting_agenda_item.meeting_section+ # )+ # # MeetingAgendaItems::ListComponent.new(meeting: @meeting)+ # end+ # add_before_via_turbo_stream(component:, target_component:)+ # update_show_items_via_turbo_stream++ # TODO: review above implementation and adapt properly to section based approach+ update_section_via_turbo_stream(meeting_section: meeting_agenda_item.meeting_section)enddef render_base_error_in_flash_message_via_turbo_stream(errors)diff --git a/modules/meeting/app/controllers/meeting_agenda_items_controller.rb b/modules/meeting/app/controllers/meeting_agenda_items_controller.rbindex c93a6601a94..1c94b71951c 100644--- a/modules/meeting/app/controllers/meeting_agenda_items_controller.rb+++ b/modules/meeting/app/controllers/meeting_agenda_items_controller.rb@@ -185,17 +185,6 @@ class MeetingAgendaItemsController < ApplicationControllerrespond_with_turbo_streamsend- # Primer's autocomplete displays the ID of a user when selected instead of the name- # this cannot be changed at the moment as the component uses a simple text field which- # can't differentiate between a display and submit value- # thus, we can't use it- # leaving the code here for future reference- # def author_autocomplete_index- # @users = User.active.like(params[:q]).limit(10)-- # render(Authors::AutocompleteItemComponent.with_collection(@users), layout: false)- # end-privatedef set_meetingdiff --git a/modules/meeting/app/controllers/meeting_sections_controller.rb b/modules/meeting/app/controllers/meeting_sections_controller.rbindex f2e74828a5d..e5c0e2dee31 100644--- a/modules/meeting/app/controllers/meeting_sections_controller.rb+++ b/modules/meeting/app/controllers/meeting_sections_controller.rb@@ -90,8 +90,8 @@ class MeetingSectionsController < ApplicationControllerenddef cancel_edit- if @meeting_section.has_default_name? && @meeting_section.agenda_items.empty?- # if the section has the default name and no agenda items, we can safely delete it+ if @meeting_section.has_default_title? && @meeting_section.agenda_items.empty?+ # if the section has the default title and no agenda items, we can safely delete itdestroy and returnelseupdate_section_header_via_turbo_stream(state: :show)@@ -162,17 +162,6 @@ class MeetingSectionsController < ApplicationControllerrespond_with_turbo_streamsend- # Primer's autocomplete displays the ID of a user when selected instead of the name- # this cannot be changed at the moment as the component uses a simple text field which- # can't differentiate between a display and submit value- # thus, we can't use it- # leaving the code here for future reference- # def author_autocomplete_index- # @users = User.active.like(params[:q]).limit(10)-- # render(Authors::AutocompleteItemComponent.with_collection(@users), layout: false)- # end-privatedef set_meeting@@ -191,7 +180,7 @@ class MeetingSectionsController < ApplicationControllerdef meeting_section_paramsparams.require(:meeting_section)- .permit(:name)+ .permit(:title)enddef generic_call_failure_response(call)diff --git a/modules/meeting/app/forms/meeting_section/name.rb b/modules/meeting/app/forms/meeting_section/title.rbsimilarity index 90%rename from modules/meeting/app/forms/meeting_section/name.rbrename to modules/meeting/app/forms/meeting_section/title.rbindex 81718c9b2ed..695566bbf5e 100644--- a/modules/meeting/app/forms/meeting_section/name.rb+++ b/modules/meeting/app/forms/meeting_section/title.rb@@ -26,10 +26,10 @@# See COPYRIGHT and LICENSE files for more details.#++-class MeetingSection::Name < ApplicationForm+class MeetingSection::Title < ApplicationFormform do |meeting_section_form|meeting_section_form.text_field(- name: :name,+ name: :title,placeholder: Meeting.human_attribute_name(:title),label: Meeting.human_attribute_name(:title),value: init_value(meeting_section_form),@@ -45,10 +45,10 @@ class MeetingSection::Name < ApplicationFormprivatedef init_value(meeting_section_form)- if meeting_section_form.builder.object.has_default_name?+ if meeting_section_form.builder.object.has_default_title?"" # will be set to "Untitled" in the model if left emptyelse- meeting_section_form.builder.object.name+ meeting_section_form.builder.object.titleendendenddiff --git a/modules/meeting/app/models/meeting_agenda_item.rb b/modules/meeting/app/models/meeting_agenda_item.rbindex 5bc4d92df30..abc2a61df89 100644--- a/modules/meeting/app/models/meeting_agenda_item.rb+++ b/modules/meeting/app/models/meeting_agenda_item.rb@@ -76,7 +76,7 @@ class MeetingAgendaItem < ApplicationRecordmeeting_section = meeting.sections.order(position: :asc).lastif meeting_section.nil?- meeting_section = meeting.sections.create!(name: "Untitled")+ meeting_section = meeting.sections.create!(title: "Untitled")endself.meeting_section_id = meeting_section.iddiff --git a/modules/meeting/app/models/meeting_section.rb b/modules/meeting/app/models/meeting_section.rbindex 29194fe83a4..6cea75cfc43 100644--- a/modules/meeting/app/models/meeting_section.rb+++ b/modules/meeting/app/models/meeting_section.rb@@ -34,22 +34,22 @@ class MeetingSection < ApplicationRecordhas_many :agenda_items, dependent: :destroy, class_name: "MeetingAgendaItem"has_one :project, through: :meeting- validates :name, presence: true+ validates :title, presence: true- before_validation :set_default_name+ before_validation :set_default_titleacts_as_list scope: :meetingdefault_scope { order(:position) }- def set_default_name- if name.blank?- self.name = "Untitled" # TODO: I18n+ def set_default_title+ if title.blank?+ self.title = "Untitled" # TODO: I18nendend- def has_default_name?- name == "Untitled" # TODO: I18n+ def has_default_title?+ title == "Untitled" # TODO: I18nenddef editable?diff --git a/db/migrate/20240405131352_create_meeting_sections.rb b/modules/meeting/db/migrate/20240405131352_create_meeting_sections.rbsimilarity index 79%rename from db/migrate/20240405131352_create_meeting_sections.rbrename to modules/meeting/db/migrate/20240405131352_create_meeting_sections.rbindex 62326500f0c..dd4a2688759 100644--- a/db/migrate/20240405131352_create_meeting_sections.rb+++ b/modules/meeting/db/migrate/20240405131352_create_meeting_sections.rb@@ -2,7 +2,7 @@ class CreateMeetingSections < ActiveRecord::Migration[7.1]def upcreate_table :meeting_sections do |t|t.integer :position- t.string :name+ t.string :titlet.references :meeting, null: false, foreign_key: truet.timestamps@@ -16,6 +16,8 @@ class CreateMeetingSections < ActiveRecord::Migration[7.1]def downremove_reference :meeting_agenda_items, :meeting_sectiondrop_table :meeting_sections+ # TODO: positions of agenda items are now not valid anymore as they have been scoped to sections+ # Do we need to catch this?endprivate@@ -24,7 +26,7 @@ class CreateMeetingSections < ActiveRecord::Migration[7.1]StructuredMeeting.includes(:agenda_items).find_each do |meeting|section = MeetingSection.create!(meeting:,- name: "Untitled"+ title: "Untitled")meeting.agenda_items.update_all(meeting_section_id: section.id)end