diff --git a/research/static/research/js/research.js b/research/static/research/js/research.js index 05598f05..050b9088 100644 --- a/research/static/research/js/research.js +++ b/research/static/research/js/research.js @@ -37,6 +37,11 @@ $(function () { window.location.href = '/vault/?dir=' + encodeURIComponent('/' + $(this).attr('vault-area')) }) + $('.btn-go-to-group-manager').on('click', function () { + Yoda.storage.session.set('selected-group', $(this).attr('group')) + window.location.href = '/group_manager' + }) + $('.btn-group button.metadata-form').on('click', function () { showMetadataForm($(this).attr('data-path')) }) @@ -753,6 +758,7 @@ function browse (dir = '', changeHistory = false) { // remove hide class that could have been added when a erroneous vault path was used. $('#file-browser_wrapper').removeClass('hide') handleGoToVaultButton(dir) + handleGoToGroupManager(dir) makeBreadcrumb(dir) if (changeHistory) { changeBrowserUrl(dir) } topInformation(dir, true) // only here topInformation should show its alertMessage @@ -770,6 +776,18 @@ function handleGoToVaultButton (dir) { } } +function handleGoToGroupManager(dir) { + // Handle the button with which to return to the corresponding research area. + const parts = dir.split('/') + console.log(parts[1]) + + if (parts.length > 1) { + $('.btn-go-to-group-manager').attr('group', parts[1]).show() + } else { + $('.btn-go-to-group-manager').attr('group', '').hide() + } +} + function makeBreadcrumb (dir) { const pathParts = dir.split('/').filter(x => x.length) diff --git a/research/templates/research/browse.html b/research/templates/research/browse.html index 741504f4..bf7749eb 100644 --- a/research/templates/research/browse.html +++ b/research/templates/research/browse.html @@ -341,6 +341,7 @@