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
Use custom items to meeting autocompleter
Oliver Günther0680ecce217b
diff --git a/frontend/src/app/shared/components/autocompleter/meeting-autocompleter/meeting-autocompleter-template.component.html b/frontend/src/app/shared/components/autocompleter/meeting-autocompleter/meeting-autocompleter-template.component.htmlindex f6fbc2624eb..c8e99288364 100644--- a/frontend/src/app/shared/components/autocompleter/meeting-autocompleter/meeting-autocompleter-template.component.html+++ b/frontend/src/app/shared/components/autocompleter/meeting-autocompleter/meeting-autocompleter-template.component.html@@ -1,4 +1,5 @@<ng-template #optionTemplate let-item>- <div>{{ item.label }}</div>- <div>ID: {{ item.value }}</div>+ <div>{{ item.name }}</div>+ <div>ID: {{ item.id }}</div>+ <div>time: {{ item.start_time }}</div></ng-template>diff --git a/modules/meeting/app/forms/meeting_agenda_item/meeting_form.rb b/modules/meeting/app/forms/meeting_agenda_item/meeting_form.rbindex efb26304e5e..1990da2a3d8 100644--- a/modules/meeting/app/forms/meeting_agenda_item/meeting_form.rb+++ b/modules/meeting/app/forms/meeting_agenda_item/meeting_form.rb@@ -39,26 +39,15 @@ class MeetingAgendaItem::MeetingForm < ApplicationFormcaption: I18n.t("label_meeting_selection_caption"),autocomplete_options: {component: "opce-meeting-autocompleter",+ items: meeting_options,+ # Do not try to load data from API (it will look for a "resource")+ defaultData: false,+ bindLabel: "name",+ bindValue: "id",multiple: false,- decorated: true,append_to: append_to_container}- ) do |select|- MeetingAgendaItems::CreateContract- .assignable_meetings(User.current)- .where("meetings.start_time + (interval '1 hour' * meetings.duration) >= ?", Time.zone.now)- .order("meetings.start_time")- .includes(:project)- .each do |meeting|- select.option(- label: "#{meeting.project.name}: " \- "#{meeting.title} " \- "#{format_date(meeting.start_time)} " \- "#{format_time(meeting.start_time, include_date: false)}",- value: meeting.id- )- end- end+ )enddef initialize(disabled: false, wrapper_id: nil)@@ -67,6 +56,21 @@ class MeetingAgendaItem::MeetingForm < ApplicationForm@wrapper_id = wrapper_idend+ def meeting_options+ MeetingAgendaItems::CreateContract+ .assignable_meetings(User.current)+ .where("meetings.start_time + (interval '1 hour' * meetings.duration) >= ?", Time.zone.now)+ .order("meetings.start_time")+ .includes(:project)+ .map do |meeting|+ {+ id: meeting.id,+ name: meeting.title,+ start_time: format_time(meeting.start_time)+ }+ end+ end+def append_to_container@wrapper_id.nil? ? "body" : "##{@wrapper_id}"end