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
Show meeting attachments in sidebar
Oliver Günthera6595e085c05
diff --git a/config/locales/en.yml b/config/locales/en.ymlindex 94721a3df2f..cd6af4a8a6e 100644--- a/config/locales/en.yml+++ b/config/locales/en.yml@@ -1815,9 +1815,7 @@ Project attributes and sections are defined in the <a href=%{admin_settings_url}label_ascending: "Ascending"label_assigned_to_me_work_packages: "Work packages assigned to me"label_associated_revisions: "Associated revisions"- label_attachment_delete: "Delete file"- label_attachment_new: "New file"- label_attachment_plural: "Files"+ label_attachment_plural: "Attachments"label_attribute: "Attribute"label_attribute_plural: "Attributes"label_ldap_auth_source_new: "New LDAP connection"diff --git a/frontend/src/app/shared/components/attachments/attachment-list/attachment-list-item.component.html b/frontend/src/app/shared/components/attachments/attachment-list/attachment-list-item.component.htmlindex eec65cf8238..a013d994c54 100644--- a/frontend/src/app/shared/components/attachments/attachment-list/attachment-list-item.component.html+++ b/frontend/src/app/shared/components/attachments/attachment-list/attachment-list-item.component.html@@ -23,6 +23,7 @@</div><span+ *ngIf="showTimestamp"class="op-file-list--item-text"[textContent]="timestampText"></span>diff --git a/frontend/src/app/shared/components/attachments/attachment-list/attachment-list-item.component.ts b/frontend/src/app/shared/components/attachments/attachment-list/attachment-list-item.component.tsindex eba957fce10..a5b025857b1 100644--- a/frontend/src/app/shared/components/attachments/attachment-list/attachment-list-item.component.ts+++ b/frontend/src/app/shared/components/attachments/attachment-list/attachment-list-item.component.ts@@ -63,6 +63,8 @@ export class OpAttachmentListItemComponent extends UntilDestroyedMixin implement@Input() public index:number;+ @Input() public showTimestamp = true;+@Output() public removeAttachment = new EventEmitter<void>();@ViewChild('avatar') avatar:ElementRef;diff --git a/frontend/src/app/shared/components/attachments/attachment-list/attachment-list.component.html b/frontend/src/app/shared/components/attachments/attachment-list/attachment-list.component.htmlindex fe49cbcc169..50f7f59f394 100644--- a/frontend/src/app/shared/components/attachments/attachment-list/attachment-list.component.html+++ b/frontend/src/app/shared/components/attachments/attachment-list/attachment-list.component.html@@ -8,6 +8,7 @@class="spot-list--item op-file-list--item"data-test-selector="op-attachment-list-item"[attachment]="attachment"+ [showTimestamp]="showTimestamp"[index]="i"(removeAttachment)="removeAttachment(attachment)"></li>diff --git a/frontend/src/app/shared/components/attachments/attachment-list/attachment-list.component.ts b/frontend/src/app/shared/components/attachments/attachment-list/attachment-list.component.tsindex ccb781ff408..59936b1c7a1 100644--- a/frontend/src/app/shared/components/attachments/attachment-list/attachment-list.component.ts+++ b/frontend/src/app/shared/components/attachments/attachment-list/attachment-list.component.ts@@ -26,12 +26,7 @@// See COPYRIGHT and LICENSE files for more details.//++-import {- ChangeDetectionStrategy,- Component,- Input,- OnInit,-} from '@angular/core';+import { ChangeDetectionStrategy, Component, Input, OnInit } from '@angular/core';import { IAttachment } from 'core-app/core/state/attachments/attachment.model';import { UntilDestroyedMixin } from 'core-app/shared/helpers/angular/until-destroyed.mixin';import { AttachmentsResourceService } from 'core-app/core/state/attachments/attachments.service';@@ -46,6 +41,8 @@ export class OpAttachmentListComponent extends UntilDestroyedMixin implements On@Input() public collectionKey:string;+ @Input() public showTimestamp = true;+constructor(private readonly attachmentsResourceService:AttachmentsResourceService,) {diff --git a/frontend/src/app/shared/components/attachments/attachments.component.html b/frontend/src/app/shared/components/attachments/attachments.component.htmlindex 263525870c8..d20b30203f1 100644--- a/frontend/src/app/shared/components/attachments/attachments.component.html+++ b/frontend/src/app/shared/components/attachments/attachments.component.html@@ -6,6 +6,7 @@*ngIf="(attachments$ | async).length"[attachments]="attachments$ | async"[collectionKey]="collectionKey"+ [showTimestamp]="showTimestamp"></op-attachment-list><input@@ -56,6 +57,7 @@class="op-file-section--actions"><button+ *ngIf="!externalUploadButton"type="button"class="spot-link"(click)="triggerFileInput()"diff --git a/frontend/src/app/shared/components/attachments/attachments.component.ts b/frontend/src/app/shared/components/attachments/attachments.component.tsindex 5ba3ed502ce..9d70e31406f 100644--- a/frontend/src/app/shared/components/attachments/attachments.component.ts+++ b/frontend/src/app/shared/components/attachments/attachments.component.ts@@ -38,7 +38,7 @@ import {ViewChild,ViewEncapsulation,} from '@angular/core';-import { Observable } from 'rxjs';+import { fromEvent, Observable } from 'rxjs';import { filter, map, tap } from 'rxjs/operators';import { States } from 'core-app/core/states/states.service';@@ -78,6 +78,10 @@ export class OpAttachmentsComponent extends UntilDestroyedMixin implements OnIni@Input() public destroyImmediately = true;+ @Input() public externalUploadButton:string|null = null;++ @Input() public showTimestamp = true;+public attachments$:Observable<IAttachment[]>;public draggingOverDropZone = false;@@ -146,6 +150,14 @@ export class OpAttachmentsComponent extends UntilDestroyedMixin implements OnInithis.resource = this.halResourceService.createHalResource(this.resource, true);}+ if (this.externalUploadButton) {+ fromEvent(document.querySelector(this.externalUploadButton) as Element, 'click')+ .pipe(+ this.untilDestroyed(),+ )+ .subscribe(() => this.triggerFileInput());+ }+this.states.forResource(this.resource)!.changes$().pipe(this.untilDestroyed(),diff --git a/modules/meeting/app/components/meetings/show_component.html.erb b/modules/meeting/app/components/meetings/show_component.html.erbindex 51e203c6a62..f1283e0bb9c 100644--- a/modules/meeting/app/components/meetings/show_component.html.erb+++ b/modules/meeting/app/components/meetings/show_component.html.erb@@ -23,9 +23,10 @@render(MeetingAgendaItems::NewButtonComponent.new(meeting: @meeting))end- agenda.with_row do+ agenda.with_row(mt: 3, classes: 'hidden-for-desktop') doresource = ::API::V3::Meetings::MeetingRepresenter.new(@meeting, current_user: User.current, embed_links: false)- helpers.list_attachments(resource)+ concat render(Primer::Beta::Heading.new(tag: :h4)) { I18n.t(:label_attachment_plural) }+ concat helpers.list_attachments(resource, 'data-allow-uploading': true)endendenddiff --git a/modules/meeting/app/components/meetings/sidebar/attachments_component.html.erb b/modules/meeting/app/components/meetings/sidebar/attachments_component.html.erbnew file mode 100644index 00000000000..36e5a27cfd2--- /dev/null+++ b/modules/meeting/app/components/meetings/sidebar/attachments_component.html.erb@@ -0,0 +1,28 @@+<%=+ flex_layout(classes: 'hidden-for-mobile') do |attachments_container|+ attachments_container.with_row do+ render(Primer::Beta::Heading.new(tag: :h4)) { I18n.t(:label_attachment_plural) }+ end++ attachments_container.with_row(mt: 2) do+ resource = ::API::V3::Meetings::MeetingRepresenter.new(@meeting, current_user: User.current, embed_links: false)+ helpers.list_attachments(resource,+ 'data-allow-uploading': true,+ 'data-show-timestamp': false,+ 'data-external-upload-button': "#meetings-add-attachments".to_json)+ end++ attachments_container.with_row(mt: 1) do+ render(Primer::Beta::Button.new(+ scheme: :link,+ color: :default,+ underline: false,+ font_weight: :bold,+ id: "meetings-add-attachments"+ )) do |button|+ button.with_leading_visual_icon(icon: "op-attachmentadd")+ t("js.label_add_attachments")+ end+ end+ end+%>diff --git a/modules/meeting/app/components/meetings/sidebar/attachments_component.rb b/modules/meeting/app/components/meetings/sidebar/attachments_component.rbnew file mode 100644index 00000000000..01fd2d06215--- /dev/null+++ b/modules/meeting/app/components/meetings/sidebar/attachments_component.rb@@ -0,0 +1,41 @@+#-- copyright+# OpenProject is an open source project management software.+# Copyright (C) 2012-2024 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.+#++++module Meetings+ class Sidebar::AttachmentsComponent < ApplicationComponent+ include ApplicationHelper+ include OpTurbo::Streamable+ include OpPrimer::ComponentHelpers++ def initialize(meeting:)+ super++ @meeting = meeting+ end+ end+enddiff --git a/modules/meeting/app/components/meetings/sidebar_component.html.erb b/modules/meeting/app/components/meetings/sidebar_component.html.erbindex 182e5b13787..10a832940f0 100644--- a/modules/meeting/app/components/meetings/sidebar_component.html.erb+++ b/modules/meeting/app/components/meetings/sidebar_component.html.erb@@ -4,6 +4,7 @@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 { render(Meetings::Sidebar::AttachmentsComponent.new(meeting: @meeting)) }endend%>diff --git a/modules/meeting/app/forms/meeting_agenda_item/notes.rb b/modules/meeting/app/forms/meeting_agenda_item/notes.rbindex 9f4881579d3..64c82b368b4 100644--- a/modules/meeting/app/forms/meeting_agenda_item/notes.rb+++ b/modules/meeting/app/forms/meeting_agenda_item/notes.rb@@ -36,6 +36,7 @@ class MeetingAgendaItem::Notes < ApplicationFormdisabled: @disabled,rich_text_options: {resource:,+ showAttachments: false})enddiff --git a/modules/meeting/spec/features/structured_meetings/attachment_upload_spec.rb b/modules/meeting/spec/features/structured_meetings/attachment_upload_spec.rbindex 774ab1a69d2..01d2e32a25e 100644--- a/modules/meeting/spec/features/structured_meetings/attachment_upload_spec.rb+++ b/modules/meeting/spec/features/structured_meetings/attachment_upload_spec.rb@@ -40,6 +40,7 @@ RSpec.describe "Upload attachment to meetings", :js dolet(:image_fixture) { UploadedFile.load_from("spec/fixtures/files/image.png") }let(:editor) { Components::WysiwygEditor.new "#content", "opce-ckeditor-augmented-textarea" }let(:wiki_page_content) { project.wiki.pages.first.text }+ let(:attachment_list) { Components::AttachmentsList.new("#content") }let(:meeting) { create(:structured_meeting, project:) }let(:show_page) { Pages::StructuredMeeting::Show.new(meeting) }@@ -58,12 +59,12 @@ RSpec.describe "Upload attachment to meetings", :js do# adding an imageeditor.drag_attachment image_fixture.path, "Image uploaded the first time"- editor.attachments_list.expect_attached("image.png")+ attachment_list.expect_attached("image.png")editor.wait_until_upload_progress_toaster_clearedclick_on "Save"expect(page).to have_css("#meeting-agenda-items-list-component img", count: 1)expect(page).to have_content("Image uploaded the first time")- editor.attachments_list.expect_attached("image.png")+ attachment_list.expect_attached("image.png")endend