Skip to content

Commit

Permalink
Change how buttons are injected in the folder page.
Browse files Browse the repository at this point in the history
This makes the process more robust for some other layout changes.
  • Loading branch information
manthey committed Nov 13, 2024
1 parent 5960f68 commit 62b3000
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions server/dive_server/web_client/views/folderPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ wrap(HierarchyWidget, 'render', function (render) {
render.call(this);
if (this.parentModel.attributes._modelType === 'folder'){
if (!this.$el.find('.g-dive-open-item[role="button"]').length && this.parentModel.attributes.meta.annotate) {
this.$el.find('.g-folder-header-buttons .btn-group').before(
this.$el.find('.g-folder-header-buttons').prepend(
`<a class="g-dive-open-item btn btn-sm btn-primary" style="margin-left: 10px" role="button" href="${webrootPath}${this.parentModel.id}" target="_blank">
<i class="icon-link-ext"></i>Open in DIVE
</a>`
);
}
if (!this.$el.find('.g-dive-open-metadata-item[role="button"]').length && this.parentModel.attributes.meta.DIVEMetadata) {
this.$el.find('.g-folder-header-buttons .btn-group').before(
this.$el.find('.g-folder-header-buttons').prepend(
`<a class="g-dive-open-metadata-item btn btn-sm btn-primary" style="margin-left: 10px" role="button" href="${metadataRootPath}${this.parentModel.id}" target="_blank">
<i class="icon-link-ext"></i>Open Metadata in DIVE
</a>`
Expand All @@ -22,14 +22,14 @@ wrap(HierarchyWidget, 'render', function (render) {
if (!this.$el.find('.g-dive-open-metadata-filter-item[role="button"]').length && this.parentModel.attributes.meta.DIVEMetadataClonedFilter && this.parentModel.attributes.meta.DIVEMetadataClonedFilterBase) {
const base = this.parentModel.attributes.meta.DIVEMetadataClonedFilterBase;
const params= encodeURI(this.parentModel.attributes.meta.DIVEMetadataClonedFilter);
this.$el.find('.g-folder-header-buttons .btn-group').before(
this.$el.find('.g-folder-header-buttons').prepend(
`<a class="g-dive-open-metadata-filter-item btn btn-sm btn-info" style="margin-left: 10px" role="button" href="${metadataRootPath}${base}?filter=${params}" target="_blank">
<i class="icon-link-ext"></i>Open Metadata Filter in DIVE
</a>`
);
}
if ( !this.$el.find('.g-dive-convert-item[role="button"]').length && !this.parentModel.attributes.meta.annotate && this.parentModel.attributes.meta.MarkForPostProcess === true) {
this.$el.find('.g-folder-header-buttons .btn-group').before(
this.$el.find('.g-folder-header-buttons').prepend(
`<div
class="g-dive-convert-link btn btn-sm btn-primary"
item-id=${this.parentModel.id}
Expand All @@ -46,4 +46,4 @@ wrap(HierarchyWidget, 'render', function (render) {
}
}
this.delegateEvents();
});
});

0 comments on commit 62b3000

Please sign in to comment.