Skip to content

Commit

Permalink
Merge pull request #493 from scientist-softserv/i485-admin-dashboard-…
Browse files Browse the repository at this point in the history
…sidebar-response

I485 admin dashboard sidebar response
  • Loading branch information
ShanaLMoore authored Jul 25, 2023
2 parents 0ac1cae + df54f06 commit 6715e5c
Showing 1 changed file with 29 additions and 6 deletions.
35 changes: 29 additions & 6 deletions app/assets/javascripts/hyrax/app.js.erb
Original file line number Diff line number Diff line change
Expand Up @@ -165,17 +165,40 @@ Hyrax = {

// Minimize/maximize the dashboard sidebar
sidebar: function () {
$('.sidebar-toggle').on('click', function() {
$('.sidebar, .main-content').toggleClass('maximized');
});

$(window).on('resize', function() {
// default behavior
$(window).on('load', function() {
if ($(window).width() >= 768) {
$('.sidebar, .main-content').addClass('maximized');
} else {
$('.sidebar, .main-content').removeClass('maximized');
}
}).trigger('resize');
});

$(window).on('resize', function(){
checkWidth();
})

$('.sidebar-toggle').on('click', function() {
$('.sidebar').toggleClass('maximized');

checkWidth();
});

function checkWidth() {
if ($(window).width() >= 768) {
if ($('.sidebar').hasClass('maximized')) {
$('.main-content').addClass('maximized');
} else if (!$('.sidebar').hasClass('maximized')) {
$('.main-content').removeClass('maximized');
};
} else {
if ($('.sidebar').hasClass('maximized')) {
$('.main-content').removeClass('maximized');
} else if (!$('.sidebar').hasClass('maximized')) {
$('.main-content').removeClass('maximized');
};
}
}
},
// OVERRIDE end

Expand Down

0 comments on commit 6715e5c

Please sign in to comment.