mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-16 20:43:01 +03:00
d61e37e799
Closes #3623 - Move hamburger logic to action with terrible name, "toggleSidebarOrGoHome" - Move ".js-close-sidebar" events to a document.on(event, *selector*, f) to make sure they attach even when the js-close-sidebars aren't on page (ie, hidenav)
24 lines
762 B
JavaScript
24 lines
762 B
JavaScript
var ApplicationView = Ember.View.extend({
|
|
setupCloseSidebar: function () {
|
|
// #### Navigating within the sidebar closes it.
|
|
$(document).on('click', '.js-close-sidebar', function () {
|
|
$('body').removeClass('off-canvas');
|
|
});
|
|
}.on('didInsertElement'),
|
|
|
|
actions: {
|
|
//Sends the user to the front if they're not on mobile,
|
|
//otherwise toggles the sidebar.
|
|
toggleSidebarOrGoHome: function () {
|
|
if (window.matchMedia('(max-width: 650px)').matches) {
|
|
$('body').toggleClass('off-canvas');
|
|
}
|
|
else {
|
|
window.location = this.get('controller.ghostPaths').blogRoot;
|
|
}
|
|
}
|
|
}
|
|
});
|
|
|
|
export default ApplicationView;
|