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

remove participants in mobile mode and show them in details part

bsatarnejad00f1d1106b7b
diff --git a/frontend/src/stimulus/controllers/dynamic/meetings-sidebar-details.controller.ts b/frontend/src/stimulus/controllers/dynamic/meetings-sidebar-details.controller.ts
new file mode 100644
index 00000000000..33c3408f387
--- /dev/null
+++ b/frontend/src/stimulus/controllers/dynamic/meetings-sidebar-details.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 MeetingsSidebarDetailsController 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/_index.sass b/modules/meeting/app/components/_index.sass
index 2f17a54aef6..c3880088011 100644
--- a/modules/meeting/app/components/_index.sass
+++ b/modules/meeting/app/components/_index.sass
@@ -1,3 +1,4 @@
@import "./meeting_agenda_items/item_component/show_component.sass"
@import "./meeting_agenda_items/form_component.sass"
@import "./meetings/sidebar/state_component.sass"
+@import "./meetings/sidebar/details_component.sass"
diff --git a/modules/meeting/app/components/meetings/sidebar/details_component.html.erb b/modules/meeting/app/components/meetings/sidebar/details_component.html.erb
index 86da51680f2..bf66f82c250 100644
--- a/modules/meeting/app/components/meetings/sidebar/details_component.html.erb
+++ b/modules/meeting/app/components/meetings/sidebar/details_component.html.erb
@@ -1,5 +1,5 @@
<%=
- component_wrapper do
+ component_wrapper(data: wrapper_data_attributes) do
flex_layout do |details_container|
details_container.with_row do
flex_layout(align_items: :center, justify_content: :space_between) do |heading|
@@ -85,6 +85,27 @@
end
end
end
+ details.with_row(mt: 2, classes: 'op-meeting-sidebar-details-participants') do
+ flex_layout do |flex|
+ render(Primer::Beta::Octicon.new(icon: 'people'))
+ flex.with_row(classes: 'd-none', data: { 'meetings-sidebar-details-target': "hiddenParticipants" }) do
+ flex_layout do |details|
+ @meeting.invited_or_attended_participants.sort.each do |participant|
+ details.with_row(mt: 1) do
+ render_participant(participant)
+ end
+ end
+ end
+ end
+ flex.with_row do
+ render (Primer::Beta::Button.new(scheme: :invisible, classes: 'op-meeting-sidebar-details-participants-button',
+ data: { 'meetings-sidebar-details-target': "showHideButton" })) do |button|
+ button.with_leading_visual_icon(icon: :people)
+ I18n.t('label_meeting_show_hide_participants',count: @meeting.invited_or_attended_participants.count)
+ end
+ end
+ end
+ end
end
end
end
diff --git a/modules/meeting/app/components/meetings/sidebar/details_component.rb b/modules/meeting/app/components/meetings/sidebar/details_component.rb
index 53f046d1d1b..436af43a8ec 100644
--- a/modules/meeting/app/components/meetings/sidebar/details_component.rb
+++ b/modules/meeting/app/components/meetings/sidebar/details_component.rb
@@ -40,6 +40,13 @@ module Meetings
private
+ def wrapper_data_attributes
+ {
+ controller: 'meetings-sidebar-details',
+ 'application-target': 'dynamic'
+ }
+ end
+
def render_truncated_location
render(Primer::Beta::Truncate.new) do |component|
component.with_item(max_width: 250) do
@@ -48,6 +55,29 @@ module Meetings
end
end
+ def render_participant(participant)
+ flex_layout(align_items: :center) do |flex|
+ flex.with_column(classes: 'ellipsis') do
+ render(Users::AvatarComponent.new(user: participant.user,
+ size: :medium,
+ classes: 'op-principal_flex'))
+ end
+ render_participant_state(participant, flex)
+ end
+ end
+
+ def render_participant_state(participant, flex)
+ if participant.attended?
+ flex.with_column(ml: 1) do
+ render(Primer::Beta::Text.new(font_size: :small, color: :subtle)) { t("description_attended").capitalize }
+ end
+ elsif participant.invited?
+ flex.with_column(ml: 1) do
+ render(Primer::Beta::Text.new(font_size: :small, color: :subtle)) { t("description_invite").capitalize }
+ end
+ end
+ end
+
def render_meeting_attribute_row(icon, &)
flex_layout(align_items: :center, justify_content: :space_between) do |flex|
flex.with_column do
diff --git a/modules/meeting/app/components/meetings/sidebar/details_component.sass b/modules/meeting/app/components/meetings/sidebar/details_component.sass
new file mode 100644
index 00000000000..c980f3d981f
--- /dev/null
+++ b/modules/meeting/app/components/meetings/sidebar/details_component.sass
@@ -0,0 +1,12 @@
+@import 'helpers'
+.op-meeting-sidebar-details-participants
+ display: none
+ &-button
+ padding: 0 !important
+ color: var(--content-link-color)
+
+
+
+@media screen and (max-width: $breakpoint-sm)
+ .op-meeting-sidebar-details-participants
+ display: block !important
\ No newline at end of file
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 8111cfb1adc..b301d79f41e 100644
--- a/modules/meeting/app/components/meetings/sidebar/participants_component.html.erb
+++ b/modules/meeting/app/components/meetings/sidebar/participants_component.html.erb
@@ -1,6 +1,6 @@
<%=
component_wrapper(data: wrapper_data_attributes) do
- flex_layout do |participants_container|
+ flex_layout(classes: 'hidden-for-mobile') do |participants_container|
participants_container.with_row do
flex_layout(align_items: :center, justify_content: :space_between) do |heading|
heading.with_column(flex: 1) do