2014-07-07 18:55:22 +04:00
|
|
|
var ApplicationView = Ember.View.extend({
|
2014-08-11 13:25:30 +04:00
|
|
|
|
2014-08-11 00:50:25 +04:00
|
|
|
setupCloseSidebar: function () {
|
2014-08-11 13:25:30 +04:00
|
|
|
|
2014-07-07 18:55:22 +04:00
|
|
|
// #### Navigating within the sidebar closes it.
|
2014-08-11 00:50:25 +04:00
|
|
|
$(document).on('click', '.js-close-sidebar', function () {
|
|
|
|
$('body').removeClass('off-canvas');
|
2014-07-07 18:55:22 +04:00
|
|
|
});
|
2014-08-11 13:25:30 +04:00
|
|
|
|
|
|
|
// #### Add the blog URL to the <a> version of the ghost logo
|
|
|
|
$('.ghost-logo-link').attr('href', this.get('controller.ghostPaths').blogRoot);
|
|
|
|
|
2014-08-11 00:50:25 +04:00
|
|
|
}.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;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2014-07-07 18:55:22 +04:00
|
|
|
});
|
|
|
|
|
|
|
|
export default ApplicationView;
|