Self-hosted project management for devs and their clients: tickets, time tracking, docs and meetings, with an AI assistant that cites its sources. AGPL-3.0.
Ruby agplai-assistantdockerdsgvogdprhotwireissue-trackerjira-alternativeknowledge-basellmmcp-servermeeting-notesopen-sourceproject-managementredmine-alternativeruby-on-railsself-hostedticketingtime-tracking
Pass the picker wiring its organisation and view instead of reading instance variables
Guido Boyke8913ef166ce5
diff --git a/app/helpers/meetings_helper.rb b/app/helpers/meetings_helper.rbindex 3301abe..29fac1a 100644--- a/app/helpers/meetings_helper.rb+++ b/app/helpers/meetings_helper.rb@@ -49,42 +49,48 @@ module MeetingsHelperendend+ # The placeholders column_picker_controller fills in itself, passed through+ # the translation as they are.+ COLUMN_PICKER_NAME_TOKEN = '%{name}' # rubocop:disable Style/FormatStringToken+ COLUMN_PICKER_POSITION_TOKEN = '%{position}' # rubocop:disable Style/FormatStringToken+# The column picker's wiring on a meetings list page, the element that# carries data-controller="column-picker": where a change is saved, which# frame it reloads, and its words. project nil is "Alle Meetings". A change# goes into the open saved view, else into the base view of this list.- def meeting_column_picker_data(project:, frame_id:)+ def meeting_column_picker_data(organisation:, project:, active_view:, frame_id:){column_picker_frame_value: frame_id,column_picker_required_value: ViewConfiguration.required_columns_for('meetings').to_json,column_picker_fixed_width_value: ViewConfiguration::COLUMN_MIN_WIDTH_PX['title'],- column_picker_save_url_value: meeting_columns_save_url(project),+ column_picker_save_url_value: meeting_columns_save_url(organisation: organisation, project: project, active_view: active_view),# Only an org-wide TICKET view needs to name a project; a meeting view# belongs to its list, so none is sent from "Alle Meetings".column_picker_project_id_value: project&.id,- column_picker_editable_value: (@active_smart_folder.nil? || policy(@active_smart_folder).update?).to_s,+ column_picker_editable_value: (active_view.nil? || policy(active_view).update?).to_s,column_picker_error_label_value: t('components.column_picker.save_failed'),- column_picker_moved_template_value: t('components.column_picker.moved', name: '%{name}', position: '%{position}'),- column_picker_pin_label_on_value: t('components.column_picker.pin_label_on', name: '%{name}'),- column_picker_pin_label_off_value: t('components.column_picker.pin_label_off', name: '%{name}'),+ column_picker_moved_template_value: t('components.column_picker.moved', name: COLUMN_PICKER_NAME_TOKEN,+ position: COLUMN_PICKER_POSITION_TOKEN),+ column_picker_pin_label_on_value: t('components.column_picker.pin_label_on', name: COLUMN_PICKER_NAME_TOKEN),+ column_picker_pin_label_off_value: t('components.column_picker.pin_label_off', name: COLUMN_PICKER_NAME_TOKEN),column_picker_pin_title_on_value: t('components.column_picker.pinned'),column_picker_pin_title_off_value: t('components.column_picker.pin')}end- def meeting_columns_save_url(project)- return columns_organisation_smart_folder_path(@current_organisation, @active_smart_folder) if @active_smart_folder- return columns_organisation_meetings_view_configuration_path(@current_organisation) unless project+ def meeting_columns_save_url(organisation:, project:, active_view:)+ return columns_organisation_smart_folder_path(organisation, active_view) if active_view+ return columns_organisation_meetings_view_configuration_path(organisation) unless project- columns_organisation_project_view_configuration_path(@current_organisation, project, view_type: 'meetings')+ columns_organisation_project_view_configuration_path(organisation, project, view_type: 'meetings')end# "für alle Ansichten übernehmen": the base view of this list and the# reader's own views of it (Actors::ApplyColumnsToViews).- def meeting_columns_apply_all_url(project)- return apply_columns_to_all_organisation_meetings_view_configuration_path(@current_organisation) unless project+ def meeting_columns_apply_all_url(organisation:, project:)+ return apply_columns_to_all_organisation_meetings_view_configuration_path(organisation) unless project- apply_columns_to_all_organisation_project_view_configuration_path(@current_organisation, project, view_type: 'meetings')+ apply_columns_to_all_organisation_project_view_configuration_path(organisation, project, view_type: 'meetings')end# A column head that sorts its list: base_path is the list's address (thediff --git a/app/views/organisations/meetings/_column_picker.html.erb b/app/views/organisations/meetings/_column_picker.html.erbindex 388378a..0c1df58 100644--- a/app/views/organisations/meetings/_column_picker.html.erb+++ b/app/views/organisations/meetings/_column_picker.html.erb@@ -9,5 +9,5 @@view_name: @active_smart_folder&.name || t('smart_folders.all_meetings'),fit: initial_column_fit(@columns.reject { |column| column[:required] }, content_open: @selected_meeting.present? || @new_meeting.present?),pinned_keys: @active_smart_folder&.pinned_column_keys || @view_configuration.pinned_column_keys,- apply_all_url: meeting_columns_apply_all_url(@project)+ apply_all_url: meeting_columns_apply_all_url(organisation: @current_organisation, project: @project)) %>diff --git a/app/views/organisations/meetings/index.html.erb b/app/views/organisations/meetings/index.html.erbindex 2a6722e..078dbc8 100644--- a/app/views/organisations/meetings/index.html.erb+++ b/app/views/organisations/meetings/index.html.erb@@ -13,7 +13,7 @@<div class="labor-layout-view <%= 'show-content' if @selected_meeting || @new_meeting %> hide-panel"data-controller="layout-toggle hover-arrows index-page keyboard-navigation viewport column-picker"- <%= tag.attributes(data: meeting_column_picker_data(project: @project, frame_id: 'meetings_results')) %>+ <%= tag.attributes(data: meeting_column_picker_data(organisation: @current_organisation, project: @project, active_view: @active_smart_folder, frame_id: 'meetings_results')) %>data-hover-arrows-layout-toggle-outlet=".labor-layout-view"data-layout-toggle-list-frame-ids-value="<%= ['meetings_results'].to_json %>"data-layout-toggle-detail-frame-id-value="meeting_display_frame"diff --git a/app/views/organisations/meetings_overview/index.html.erb b/app/views/organisations/meetings_overview/index.html.erbindex 3aeeb1d..c4048a1 100644--- a/app/views/organisations/meetings_overview/index.html.erb+++ b/app/views/organisations/meetings_overview/index.html.erb@@ -23,7 +23,8 @@<div class="w-full"data-controller="index-page viewport list-address column-picker"- <%= tag.attributes(data: meeting_column_picker_data(project: nil, frame_id: Organisations::MeetingsOverviewController::LIST_FRAME_ID)) %>+ <%= tag.attributes(data: meeting_column_picker_data(organisation: @current_organisation, project: nil, active_view: @active_smart_folder,+ frame_id: Organisations::MeetingsOverviewController::LIST_FRAME_ID)) %>data-list-address-frame-value="<%= Organisations::MeetingsOverviewController::LIST_FRAME_ID %>"data-list-address-path-value="<%= organisation_meetings_path(@current_organisation) %>"data-index-page-param-name-value="meeting_id"diff --git a/spec/system/meetings_overview_spec.rb b/spec/system/meetings_overview_spec.rbindex 613e1c8..a042fef 100644--- a/spec/system/meetings_overview_spec.rb+++ b/spec/system/meetings_overview_spec.rb@@ -130,21 +130,22 @@ RSpec.describe 'Meetings overview', type: :system doexpect(page).to have_css('#column-picker li[data-key="project"]')find('#column-picker li[data-key="creator"] label').click- expect(page).to have_css('#meetings_overview_results th[data-column="creator"]', wait: 5)- find('#column-picker li[data-key="duration_minutes"] label').click- expect(page).to have_no_css('#meetings_overview_results th[data-column="duration_minutes"]', wait: 5)+ expect(page).to have_css('#meetings_overview_results th[data-column="creator"][data-rank="5"]', wait: 5)+ # Two places up, above participants and duration.row = find('#column-picker li[data-key="creator"]')row.find('.column-picker__grip').clickrow.send_keys(%i[alt up])- expect(page).to have_css('#meetings_overview_results th[data-column="creator"][data-rank="3"]', wait: 5)row.send_keys(%i[alt up])- expect(page).to have_css('#meetings_overview_results th[data-column="creator"][data-rank="2"]', wait: 5)- expect(overview_columns).to eq(%w[title project creator occurred_at participants])+ expect(page).to have_css('#meetings_overview_results th[data-column="creator"][data-rank="3"]', wait: 5)++ find('#column-picker li[data-key="duration_minutes"] label').click+ expect(page).to have_no_css('#meetings_overview_results th[data-column="duration_minutes"]', wait: 5)+ expect(overview_columns).to eq(%w[title project occurred_at creator participants])page.refreshexpect(page).to have_css('#meetings_overview_results th[data-column="creator"]', wait: 5)- expect(head_keys).to eq(%w[title project creator occurred_at participants])+ expect(head_keys).to eq(%w[title project occurred_at creator participants])visit organisation_project_meetings_path(organisation, alpha)find('[data-column-picker-trigger]').click