Skip to content

Commit

Permalink
WEBUI-1501: Update our elements to show a view instead of a download
Browse files Browse the repository at this point in the history
  • Loading branch information
rahuljain-dev committed May 6, 2024
1 parent 6ab9059 commit 317d77c
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 6 deletions.
19 changes: 16 additions & 3 deletions elements/nuxeo-data-grid/nuxeo-document-grid-thumbnail.js
Original file line number Diff line number Diff line change
Expand Up @@ -271,13 +271,26 @@ Polymer({
observers: ['_selectedItemsChanged(selectedItems.splices)'],

_thumbnail(doc) {
return doc &&
if (
doc &&
doc.uid &&
doc.contextParameters &&
doc.contextParameters.thumbnail &&
doc.contextParameters.thumbnail.url
? doc.contextParameters.thumbnail.url
: '';
) {
if (!this.isFollowRedirectEnabled()) {
const splitter = doc.contextParameters.thumbnail.url.indexOf('?') > -1 ? '&' : '?';
doc.contextParameters.thumbnail.url = `${doc.contextParameters.thumbnail.url}${splitter}clientReason=view`;
}
return doc.contextParameters.thumbnail.url;
}
return '';
},

isFollowRedirectEnabled() {
const followRedirect =
Nuxeo && Nuxeo.UI && Nuxeo.UI.config && Nuxeo.UI.config.url && Nuxeo.UI.config.url.followRedirect;
return followRedirect ? String(followRedirect).toLowerCase() === 'true' : false;
},

handleClick(e) {
Expand Down
19 changes: 16 additions & 3 deletions elements/nuxeo-data-list/nuxeo-document-list-item.js
Original file line number Diff line number Diff line change
Expand Up @@ -256,13 +256,26 @@ Polymer({
observers: ['_selectedItemsChanged(selectedItems.splices)'],

_thumbnail(doc) {
return doc &&
if (
doc &&
doc.uid &&
doc.contextParameters &&
doc.contextParameters.thumbnail &&
doc.contextParameters.thumbnail.url
? doc.contextParameters.thumbnail.url
: '';
) {
if (!this.isFollowRedirectEnabled()) {
const splitter = doc.contextParameters.thumbnail.url.indexOf('?') > -1 ? '&' : '?';
doc.contextParameters.thumbnail.url = `${doc.contextParameters.thumbnail.url}${splitter}clientReason=view`;
}
return doc.contextParameters.thumbnail.url;
}
return '';
},

isFollowRedirectEnabled() {
const followRedirect =
Nuxeo && Nuxeo.UI && Nuxeo.UI.config && Nuxeo.UI.config.url && Nuxeo.UI.config.url.followRedirect;
return followRedirect ? String(followRedirect).toLowerCase() === 'true' : false;
},

handleClick(e) {
Expand Down

0 comments on commit 317d77c

Please sign in to comment.