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 angular_component_tag on attachments list

Oliver Günther84a504404f6d
diff --git a/app/helpers/attachments_helper.rb b/app/helpers/attachments_helper.rb
index 368ad7e253a..9f3238dd012 100644
--- a/app/helpers/attachments_helper.rb
+++ b/app/helpers/attachments_helper.rb
@@ -42,11 +42,9 @@ module AttachmentsHelper
# Within ckeditor-augmented-textarea-form, this attachment list is added automatically
# when a resource is added.
def list_attachments(resource, options = {})
- content_tag "op-attachments",
- "",
- "data-resource": resource.to_json,
- "data-allow-uploading": false,
- "data-destroy-immediately": true,
- **options
+ options[:inputs] = (options[:inputs] || {})
+ .reverse_merge(resource:, allowUploading: false, destroyImmediately: true)
+
+ angular_component_tag("op-attachments", **options)
end
end
diff --git a/frontend/src/app/shared/components/attachments/attachments.component.html b/frontend/src/app/shared/components/attachments/attachments.component.html
index b05e3f5dcf2..d20b30203f1 100644
--- a/frontend/src/app/shared/components/attachments/attachments.component.html
+++ b/frontend/src/app/shared/components/attachments/attachments.component.html
@@ -43,12 +43,12 @@
<span
*ngIf="(attachments$ | async).length > 0"
class="op-file-section--drop-box-text"
- [textContent]="dropZoneText || text.dropFiles"
+ [textContent]="text.dropFiles"
></span>
<span
*ngIf="(attachments$ | async).length === 0"
class="op-file-section--drop-box-text"
- [textContent]="dropZoneText || text.dropClickFiles"
+ [textContent]="text.dropClickFiles"
></span>
</button>
diff --git a/frontend/src/app/shared/components/attachments/attachments.component.ts b/frontend/src/app/shared/components/attachments/attachments.component.ts
index 508fb56edb5..9d70e31406f 100644
--- a/frontend/src/app/shared/components/attachments/attachments.component.ts
+++ b/frontend/src/app/shared/components/attachments/attachments.component.ts
@@ -82,8 +82,6 @@ export class OpAttachmentsComponent extends UntilDestroyedMixin implements OnIni
@Input() public showTimestamp = true;
- @Input() public dropZoneText:string|null = null;
-
public attachments$:Observable<IAttachment[]>;
public draggingOverDropZone = false;
diff --git a/modules/meeting/app/components/meetings/show_component.html.erb b/modules/meeting/app/components/meetings/show_component.html.erb
index f1283e0bb9c..cd631d8add8 100644
--- a/modules/meeting/app/components/meetings/show_component.html.erb
+++ b/modules/meeting/app/components/meetings/show_component.html.erb
@@ -26,7 +26,8 @@
agenda.with_row(mt: 3, classes: 'hidden-for-desktop') do
resource = ::API::V3::Meetings::MeetingRepresenter.new(@meeting, current_user: User.current, embed_links: false)
concat render(Primer::Beta::Heading.new(tag: :h4)) { I18n.t(:label_attachment_plural) }
- concat helpers.list_attachments(resource, 'data-allow-uploading': true)
+ concat helpers.list_attachments(resource,
+ inputs: { allowUploading: true })
end
end
end
diff --git a/modules/meeting/app/components/meetings/sidebar/attachments_component.html.erb b/modules/meeting/app/components/meetings/sidebar/attachments_component.html.erb
index c81d42b4c72..7a90c1f69c5 100644
--- a/modules/meeting/app/components/meetings/sidebar/attachments_component.html.erb
+++ b/modules/meeting/app/components/meetings/sidebar/attachments_component.html.erb
@@ -7,10 +7,11 @@
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-drop-zone-text': I18n.t('meeting.attachments.dropzone_text').to_json,
- 'data-external-upload-button': "#meetings-add-attachments".to_json)
+ inputs: {
+ allowUploading: true,
+ showTimestamp: false,
+ externalUploadButton: "#meetings-add-attachments"
+ })
end
attachments_container.with_row(mt: 1) do