Update ghost-logo, death to jQuery

Amends #3740 (which amended #3736), ref #3623
- Removed futzy jquery for setting href on logo; binding to ApplicationView property
- Killed dead code
This commit is contained in:
Matt Enlow 2014-08-11 09:51:06 -06:00
parent b6507bed9b
commit 10f3efa388
3 changed files with 6 additions and 20 deletions

View File

@ -1,9 +1,9 @@
<header id="global-header" class="navbar"> <header id="global-header" class="navbar">
<button {{action "toggleSidebarOrGoHome" target="view"}} class="ghost-logo ghost-logo-button"> <button {{action "toggleSidebar" target="view"}} class="ghost-logo ghost-logo-button">
<span class="hidden">Ghost</span> <span class="hidden">Ghost</span>
</button> </button>
<a class="ghost-logo ghost-logo-link"> <a class="ghost-logo ghost-logo-link" {{bind-attr href=view.blogRoot}}>
<span class="hidden">Ghost</span> <span class="hidden">Ghost</span>
</a> </a>

View File

@ -1,27 +1,16 @@
var ApplicationView = Ember.View.extend({ var ApplicationView = Ember.View.extend({
blogRoot: Ember.computed.alias('controller.ghostPaths.blogRoot'),
setupCloseSidebar: function () { setupCloseSidebar: function () {
// #### Navigating within the sidebar closes it. // #### Navigating within the sidebar closes it.
$(document).on('click', '.js-close-sidebar', function () { $(document).on('click', '.js-close-sidebar', function () {
$('body').removeClass('off-canvas'); $('body').removeClass('off-canvas');
}); });
// #### Add the blog URL to the <a> version of the ghost logo
$('.ghost-logo-link').attr('href', this.get('controller.ghostPaths').blogRoot);
}.on('didInsertElement'), }.on('didInsertElement'),
actions: { actions: {
//Sends the user to the front if they're not on mobile, toggleSidebar: function () {
//otherwise toggles the sidebar. $('body').toggleClass('off-canvas');
toggleSidebarOrGoHome: function () {
if (window.matchMedia('(max-width: 650px)').matches) {
$('body').toggleClass('off-canvas');
}
else {
window.location = this.get('controller.ghostPaths').blogRoot;
}
} }
} }
}); });

View File

@ -15,9 +15,6 @@ var PostsView = Ember.View.extend({
} }
}); });
// ### Add the blog URL to the <a> version of the ghost logo
$('.ghost-logo-link').attr('href', this.get('controller.ghostPaths').blogRoot);
// ### Show content preview when swiping left on content list // ### Show content preview when swiping left on content list
$('.manage').on('click', '.content-list ol li', function (event) { $('.manage').on('click', '.content-list ol li', function (event) {
responsiveAction(event, '(max-width: 800px)', function () { responsiveAction(event, '(max-width: 800px)', function () {