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

use participants component in details component

bsatarnejada68d3f98fcee
diff --git a/frontend/src/stimulus/controllers/dynamic/meetings-sidebar-participants.controller.ts b/frontend/src/stimulus/controllers/dynamic/meetings-sidebar-participants.controller.ts
index 19972443ccf..1e0d75b8c4c 100644
--- a/frontend/src/stimulus/controllers/dynamic/meetings-sidebar-participants.controller.ts
+++ b/frontend/src/stimulus/controllers/dynamic/meetings-sidebar-participants.controller.ts
@@ -31,12 +31,15 @@
import { Controller } from '@hotwired/stimulus';
export default class MeetingsSidebarParticipantsController extends Controller {
- static targets = ['showHideButton', 'hiddenParticipants'];
+ static targets = ['showHideButton', 'hiddenParticipants', 'showHideMobileButton', 'hiddenMobileParticipants'];
declare readonly showHideButtonTarget:HTMLInputElement;
declare readonly hiddenParticipantsTarget:HTMLElement;
+ declare readonly showHideMobileButtonTarget:HTMLInputElement;
+ declare readonly hiddenMobileParticipantsTarget:HTMLElement;
connect():void {
this.showHiddenParticipants();
+ this.showHiddenMobileParticipants();
}
showHiddenParticipants():void {
@@ -48,4 +51,14 @@ export default class MeetingsSidebarParticipantsController extends Controller {
}
});
}
+
+ showHiddenMobileParticipants():void {
+ this.showHideMobileButtonTarget.addEventListener('click', () => {
+ if (this.hiddenMobileParticipantsTarget.classList.contains('d-none')) {
+ this.hiddenMobileParticipantsTarget.classList.remove('d-none');
+ } else {
+ this.hiddenMobileParticipantsTarget.classList.add('d-none');
+ }
+ });
+ }
}
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 bf66f82c250..5b46f6e98ef 100644
--- a/modules/meeting/app/components/meetings/sidebar/details_component.html.erb
+++ b/modules/meeting/app/components/meetings/sidebar/details_component.html.erb
@@ -85,26 +85,8 @@
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
+ details.with_row(mt: 2, display: [:block, :block, :none, :none, :none]) do
+ render(Meetings::Sidebar::ParticipantsComponent.new(meeting: @meeting))
end
end
end
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 b301d79f41e..5ca810c36a4 100644
--- a/modules/meeting/app/components/meetings/sidebar/participants_component.html.erb
+++ b/modules/meeting/app/components/meetings/sidebar/participants_component.html.erb
@@ -1,7 +1,7 @@
<%=
component_wrapper(data: wrapper_data_attributes) do
- flex_layout(classes: 'hidden-for-mobile') do |participants_container|
- participants_container.with_row do
+ flex_layout do |participants_container|
+ participants_container.with_row(hide: :sm) do
flex_layout(align_items: :center, justify_content: :space_between) do |heading|
heading.with_column(flex: 1) do
flex_layout(align_items: :center) do |title|
@@ -29,7 +29,7 @@
end
end
- participants_container.with_row(mt: 2) do
+ participants_container.with_row(mt: 2, hide: :sm) do
if count == 0
render(Primer::Beta::Text.new(color: :subtle)) { t("label_meeting_no_participants") }
elsif count <= MAX_SHOWN_PARTICIPANTS
@@ -70,8 +70,39 @@
end
end
+ participants_container.with_row(display: [:block, :block, :none, :none, :none]) do
+ flex_layout do |flex|
+ if count == 0
+ render(Primer::Beta::Text.new(color: :subtle)) { t("label_meeting_no_participants") }
+ else
+ flex.with_row(display: :none, data: { 'meetings-sidebar-participants-target': "hiddenMobileParticipants" }) 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
+ flex.with_column do
+ render(Primer::Beta::Octicon.new('people', color: :subtle, mr: 1))
+ end
+ flex.with_column do
+ render(Primer::Beta::Text.new(color: :subtle, mr: 1)) { t('label_meeting_count_participants', count: @meeting.invited_or_attended_participants.count) }
+ end
+ flex.with_column(data: { 'meetings-sidebar-participants-target': "showHideMobileButton" }) do
+ render(Primer::Beta::Link.new(href: "#", target: "_blank")) do
+ I18n.t('label_meeting_show_hide_all_participants')
+ end
+ end
+ end
+ end
+ end
+ end
+
if @meeting.editable?
- participants_container.with_row(mt: 3) do
+ participants_container.with_row(mt: 3, hide: :sm) do
render(Primer::Beta::Button.new(
scheme: :link,
color: :default,
diff --git a/modules/meeting/app/components/meetings/sidebar_component.html.erb b/modules/meeting/app/components/meetings/sidebar_component.html.erb
index 182e5b13787..565f3705a58 100644
--- a/modules/meeting/app/components/meetings/sidebar_component.html.erb
+++ b/modules/meeting/app/components/meetings/sidebar_component.html.erb
@@ -3,7 +3,7 @@
render(Primer::OpenProject::BorderGrid.new) do |border_grid|
border_grid.with_row { render(Meetings::Sidebar::DetailsComponent.new(meeting: @meeting)) }
border_grid.with_row { render(Meetings::Sidebar::StateComponent.new(meeting: @meeting)) }
- border_grid.with_row { render(Meetings::Sidebar::ParticipantsComponent.new(meeting: @meeting)) }
+ border_grid.with_row(hide: :sm) { render(Meetings::Sidebar::ParticipantsComponent.new(meeting: @meeting)) }
end
end
%>
diff --git a/modules/meeting/config/locales/en.yml b/modules/meeting/config/locales/en.yml
index 8edaad09090..f0d7e537bb9 100644
--- a/modules/meeting/config/locales/en.yml
+++ b/modules/meeting/config/locales/en.yml
@@ -188,6 +188,8 @@ en:
label_meeting_manage_participants: "Manage participants"
label_meeting_no_participants: "No participants"
label_meeting_show_hide_participants: "Show/hide %{count} more"
+ label_meeting_show_hide_all_participants: "Show/hide all"
+ label_meeting_count_participants: "%{count} participants"
label_meeting_add_participants: "Add participants"
text_meeting_not_editable_anymore: "This meeting is not editable anymore."