0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-24 23:48:13 -05:00

Merge pull request #3736 from novaugust/ghost-burgers

Fix -navbar events attachment
This commit is contained in:
Hannah Wolfe 2014-08-10 22:45:50 +01:00
commit 2b1beee7da
3 changed files with 19 additions and 18 deletions

View file

@ -1,7 +1,7 @@
<header id="global-header" class="navbar">
<a class="ghost-logo" data-off-canvas="left">
<button {{action "toggleSidebarOrGoHome" target="view"}} class="ghost-logo">
<span class="hidden">Ghost</span>
</a>
</button>
<nav id="global-nav" role="navigation">
<ul id="main-menu" >
{{gh-activating-list-item route="posts" title="Content" classNames="content js-close-sidebar"}}

View file

@ -1,21 +1,23 @@
import {responsiveAction} from 'ghost/utils/mobile';
var ApplicationView = Ember.View.extend({
mobileInteractions: function () {
var body = $('body');
// ### Toggle the mobile sidebar menu
$('[data-off-canvas]').on('click', function (event) {
responsiveAction(event, '(max-width: 650px)', function () {
body.toggleClass('off-canvas');
});
});
$('[data-off-canvas]').attr('href', this.get('controller.ghostPaths.blogRoot'));
setupCloseSidebar: function () {
// #### Navigating within the sidebar closes it.
$('.js-close-sidebar').on('click', function () {
body.removeClass('off-canvas');
$(document).on('click', '.js-close-sidebar', function () {
$('body').removeClass('off-canvas');
});
}.on('didInsertElement')
}.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;

View file

@ -28,7 +28,6 @@ var PostsView = Ember.View.extend({
self.send('hideContentPreview');
});
});
$('[data-off-canvas]').attr('href', this.get('controller.ghostPaths.blogRoot'));
});
}.on('didInsertElement'),
});