Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Editor / Upload file or overview from main form #6371

Merged
merged 2 commits into from
Jun 14, 2022

Conversation

fxprunayre
Copy link
Member

Rework the overview manager to manage any kind of file upload.
The directive can also be embedded into the main form directly to manage overview or to easily upload files.

Files are upload in the data store and then a link is added with WWW:DOWNLOAD protocol by default or a custom value.

Sample editor configuration for file upload in the main form:

        <section>
          <field xpath="/gmd:MD_Metadata/gmd:identificationInfo//gmd:title"/>

	  * Manage overview
          <directive data-gn-overview-manager=""/>

          * Manage uploaded file with a WWW:DOWNLOAD protocol
          <directive data-gn-file-uploader=""
                     data-type="onlines"/>

          * Same but with custom titles and icons
          <directive data-gn-file-uploader=""
                     data-title="Resource for download"
                     data-btn-label="Drop a file here"
                     data-icon="fa-cloud"
                     data-type="onlines"/>

          * Without the panel
          <directive data-gn-file-uploader=""
                     data-title=""
                     data-type="onlines"/>

          * With a custom protocol
          <directive data-gn-file-uploader=""
                     data-protocol="DIRECTDOWNLOAD"
                     data-type="onlines"/>
        </section>

image

Rework the overview manager to manage any kind of file upload.
The directive can also be embedded into the main form directly to manage overview or to easily upload files.

Files are upload in the data store and then a link is added with `WWW:DOWNLOAD` protocol by default or a custom value.

Examples:

```xml
Example for file upload in the main form
        <section>
          <field xpath="/gmd:MD_Metadata/gmd:identificationInfo//gmd:title"/>

	  * Manage overview
          <directive data-gn-overview-manager=""/>

          * Manage uploaded file with a WWW:DOWNLOAD protocol
          <directive data-gn-file-uploader=""
                     data-type="onlines"/>

          * Same but with custom titles and icons
          <directive data-gn-file-uploader=""
                     data-title="Resource for download"
                     data-btn-label="Drop a file here"
                     data-icon="fa-cloud"
                     data-type="onlines"/>

          * Without the panel
          <directive data-gn-file-uploader=""
                     data-title=""
                     data-type="onlines"/>

          * With a custom protocol
          <directive data-gn-file-uploader=""
                     data-protocol="DIRECTDOWNLOAD"
                     data-type="onlines"/>
        </section>
```
@fxprunayre fxprunayre added this to the 4.2.1 milestone Jun 9, 2022
class="gn-file-uploader">
<div data-ng-if="panelMode" class="panel-heading" data-gn-slide-toggle>
<i class="fa fa-fw {{icon}}"></i>
<span data-translate="">{{title}}</span>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The overview panel with the change displays the header Download instead of Overview

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

'/attachments?visibility=public',
dropZone: $('#gn-overview-dropzone'),
singleUpload: true,
// TODO: acceptFileTypes: /(\.|\/)(xml|skos|rdf)$/i,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is something to improve: for thumbnails, only image formats should be allowed. For files, should be limited to certain types, maybe make both configurable in the settings?

Not in the scope of this pull request, but to create a ticket to track this.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


* Same but with custom titles and icons
<directive data-gn-file-uploader=""
data-title="Resource for download"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this support translation keys?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could put text or a key that you can set in database translation.

@fxprunayre fxprunayre merged commit cd79a9a into main Jun 14, 2022
@fxprunayre fxprunayre deleted the 421-fileuploaderinform branch June 14, 2022 07:27
fxprunayre added a commit that referenced this pull request Jun 20, 2022
Follow up of #6371

* Cleanup styles to have same rendering of links in record view and editor (labels, icons) - Replace #6101
* Improve format encoding can use WWW:DOWNLOAD:{format} or a MimeFileType element in ISO standards.
* Create directive for uploading file that can be used in various places (eg. metadata filestore or form file or thumbnail upload)
* Upload file / Add file format to import eg. images only for thumbnails
fxprunayre added a commit that referenced this pull request Jul 6, 2022
…abels (#6411)

* Online source / Improve format support

Follow up of #6371

* Cleanup styles to have same rendering of links in record view and editor (labels, icons) - Replace #6101
* Improve format encoding can use WWW:DOWNLOAD:{format} or a MimeFileType element in ISO standards.
* Create directive for uploading file that can be used in various places (eg. metadata filestore or form file or thumbnail upload)
* Upload file / Add file format to import eg. images only for thumbnails

* Online source / Improve format support / Wro4j errors.

* Online source / Improve format support / Styling.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants