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

move show/hide button to the bottom

bsatarnejadb5237801fcfe
diff --git a/frontend/src/stimulus/controllers/dynamic/meetings-sidebar-participants.controller.ts b/frontend/src/stimulus/controllers/dynamic/meetings-sidebar-participants.controller.ts
new file mode 100644
index 00000000000..19972443ccf
--- /dev/null
+++ b/frontend/src/stimulus/controllers/dynamic/meetings-sidebar-participants.controller.ts
@@ -0,0 +1,51 @@
+/*
+ * -- copyright
+ * OpenProject is an open source project management software.
+ * Copyright (C) 2023 the OpenProject GmbH
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License version 3.
+ *
+ * OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
+ * Copyright (C) 2006-2013 Jean-Philippe Lang
+ * Copyright (C) 2010-2013 the ChiliProject Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * See COPYRIGHT and LICENSE files for more details.
+ * ++
+ */
+
+import { Controller } from '@hotwired/stimulus';
+
+export default class MeetingsSidebarParticipantsController extends Controller {
+ static targets = ['showHideButton', 'hiddenParticipants'];
+ declare readonly showHideButtonTarget:HTMLInputElement;
+ declare readonly hiddenParticipantsTarget:HTMLElement;
+
+ connect():void {
+ this.showHiddenParticipants();
+ }
+
+ showHiddenParticipants():void {
+ this.showHideButtonTarget.addEventListener('click', () => {
+ if (this.hiddenParticipantsTarget.classList.contains('d-none')) {
+ this.hiddenParticipantsTarget.classList.remove('d-none');
+ } else {
+ this.hiddenParticipantsTarget.classList.add('d-none');
+ }
+ });
+ }
+}
diff --git a/modules/meeting/app/components/meetings/sidebar/participants_component.html.erb b/modules/meeting/app/components/meetings/sidebar/participants_component.html.erb
index 924754b62f4..8111cfb1adc 100644
--- a/modules/meeting/app/components/meetings/sidebar/participants_component.html.erb
+++ b/modules/meeting/app/components/meetings/sidebar/participants_component.html.erb
@@ -1,5 +1,5 @@
<%=
- component_wrapper do
+ component_wrapper(data: wrapper_data_attributes) do
flex_layout do |participants_container|
participants_container.with_row do
flex_layout(align_items: :center, justify_content: :space_between) do |heading|
@@ -49,27 +49,21 @@
end
list.with_row(mt: 2) do
- render Primer::Beta::Details.new do |hidden_details|
- flex_layout do |flex|
- flex.with_row do
- hidden_details.with_summary(size: :small, scheme: :link) do
- t('label_meeting_show_hide_participants',
- count: @meeting.invited_or_attended_participants.count - MAX_SHOWN_PARTICIPANTS).to_s
- end
- end
-
- flex.with_row do
- hidden_details.with_body do
- flex_layout do |hidden_user_list|
- @meeting.invited_or_attended_participants.sort[MAX_SHOWN_PARTICIPANTS..].each do |participant|
- hidden_user_list.with_row(mt: 1) do
- render_participant(participant)
- end
- end
+ flex_layout do |flex|
+ flex.with_row(classes: 'd-none', data: { 'meetings-sidebar-participants-target': "hiddenParticipants" }) do
+ flex_layout do |hidden_user_list|
+ @meeting.invited_or_attended_participants.sort[MAX_SHOWN_PARTICIPANTS..].each do |participant|
+ hidden_user_list.with_row(mt: 1) do
+ render_participant(participant)
end
end
end
end
+ flex.with_row do
+ render (Primer::Beta::Button.new(scheme: :invisible,
+ data: { 'meetings-sidebar-participants-target': "showHideButton" })) { I18n.t('label_meeting_show_hide_participants',
+ count: @meeting.invited_or_attended_participants.count - MAX_SHOWN_PARTICIPANTS) }
+ end
end
end
end
diff --git a/modules/meeting/app/components/meetings/sidebar/participants_component.rb b/modules/meeting/app/components/meetings/sidebar/participants_component.rb
index 8ac30d4b720..4b16784f9d3 100644
--- a/modules/meeting/app/components/meetings/sidebar/participants_component.rb
+++ b/modules/meeting/app/components/meetings/sidebar/participants_component.rb
@@ -34,6 +34,13 @@ module Meetings
MAX_SHOWN_PARTICIPANTS = 5
+ def wrapper_data_attributes
+ {
+ controller: 'meetings-sidebar-participants',
+ 'application-target': 'dynamic'
+ }
+ end
+
def initialize(meeting:)
super