Merge pull request from aignatov-bio/ai-sci-5476-fix-empty-toolbar-state

Fix toolbar empty state [SCI-5476]
This commit is contained in:
aignatov-bio 2021-02-15 10:29:27 +01:00 committed by GitHub
commit e09f5a0604
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 19 additions and 3 deletions
app/assets
javascripts/projects
stylesheets/shared

View file

@ -24,15 +24,15 @@
function updateExperimentsToolbar() {
let experimentsToolbar = $('#projectShowToolbar');
let toolbarVisible = false;
if (selectedExperiments.length === 0) {
experimentsToolbar.find('.single-object-action, .multiple-object-action').addClass('hidden');
return;
}
if (selectedExperiments.length === 1) {
experimentsToolbar.find('.single-object-action, .multiple-object-action').removeClass('hidden');
} else {
} else if (selectedExperiments.length > 1) {
experimentsToolbar.find('.single-object-action').addClass('hidden');
experimentsToolbar.find('.multiple-object-action').removeClass('hidden');
}
@ -41,6 +41,13 @@
experimentsToolbar.find(`.btn[data-for="${permission}"]`).addClass('hidden');
}
});
$.each($('#projectShowToolbar').find('.btn'), (i, btn) => {
if (window.getComputedStyle(btn).display !== 'none') {
toolbarVisible = true;
}
});
$(experimentsPage).attr('data-toolbar-visible', toolbarVisible);
}
function initProjectsViewModeSwitch() {

View file

@ -134,7 +134,7 @@
padding: 0 .5em;
position: sticky;
position: -webkit-sticky;
top: 13em;
top: calc(var(--content-header-size) + var(--navbar-height));
z-index: 2;
&.select-all-checkboxes {

View file

@ -2,6 +2,7 @@
// scss-lint:disable NestingDepth QualifyingElement
.content-pane {
--content-header-size: 9.5em;
background-color: $color-white;
margin: 20px 0;
padding: 25px 20px;
@ -141,4 +142,12 @@
width: calc(100% + 4em);
}
}
&[data-toolbar-visible="false"] {
--content-header-size: 5em;
.toolbar-row {
display: none;
}
}
}