diff --git a/core/client/app/components/gh-autonav-toggle.js b/core/client/app/components/gh-autonav-toggle.js new file mode 100644 index 0000000000..a85177d4f2 --- /dev/null +++ b/core/client/app/components/gh-autonav-toggle.js @@ -0,0 +1,13 @@ +import Ember from 'ember'; + +export default Ember.Component.extend({ + classNames: ['gh-autonav-toggle'], + + maximise: false, + + click: function () { + this.toggleProperty('maximise'); + + this.sendAction('onClick'); + } +}); diff --git a/core/client/app/components/gh-content-cover.js b/core/client/app/components/gh-content-cover.js new file mode 100644 index 0000000000..6cdbdfaf6a --- /dev/null +++ b/core/client/app/components/gh-content-cover.js @@ -0,0 +1,16 @@ +import Ember from 'ember'; + +export default Ember.Component.extend({ + classNames: ['content-cover'], + + onClick: null, + onMouseEnter: null, + + click: function () { + this.sendAction('onClick'); + }, + + mouseEnter: function () { + this.sendAction('onMouseEnter'); + } +}); diff --git a/core/client/app/components/gh-main.js b/core/client/app/components/gh-main.js new file mode 100644 index 0000000000..e9fdacacb8 --- /dev/null +++ b/core/client/app/components/gh-main.js @@ -0,0 +1,11 @@ +import Ember from 'ember'; + +export default Ember.Component.extend({ + tagName: 'main', + classNames: ['gh-main'], + ariaRole: 'main', + + mouseEnter: function () { + this.sendAction('onMouseEnter'); + } +}); diff --git a/core/client/app/components/gh-nav-menu.js b/core/client/app/components/gh-nav-menu.js new file mode 100644 index 0000000000..b9dd569880 --- /dev/null +++ b/core/client/app/components/gh-nav-menu.js @@ -0,0 +1,29 @@ +import Ember from 'ember'; + +export default Ember.Component.extend({ + tagName: 'nav', + classNames: ['gh-nav'], + classNameBindings: ['open'], + + open: false, + + autoNav: null, + + mouseEnter: function () { + if (!this.get('autoNav')) { + return; + } + + this.set('open', true); + }, + + actions: { + toggleMaximise: function () { + this.sendAction('toggleMaximise'); + }, + + openModal: function (modal) { + this.sendAction('openModal', modal); + } + } +}); diff --git a/core/client/app/controllers/application.js b/core/client/app/controllers/application.js index 0155e2de6d..51cbaecdb9 100644 --- a/core/client/app/controllers/application.js +++ b/core/client/app/controllers/application.js @@ -1,32 +1,28 @@ import Ember from 'ember'; -var ApplicationController = Ember.Controller.extend({ + +export default Ember.Controller.extend({ // jscs: disable signedOut: Ember.computed.match('currentPath', /(signin|signup|setup|reset)/), // jscs: enable topNotificationCount: 0, - showGlobalMobileNav: false, + showNavMenu: false, showSettingsMenu: false, - userImage: Ember.computed('session.user.image', function () { - return this.get('session.user.image') || this.get('ghostPaths.url').asset('/shared/img/user-image.png'); - }), - - userImageBackground: Ember.computed('userImage', function () { - return `background-image: url(${this.get('userImage')})`.htmlSafe(); - }), - - userImageAlt: Ember.computed('session.user.name', function () { - var name = this.get('session.user.name'); - - return (name) ? name + '\'s profile picture' : 'Profile picture'; - }), + autoNav: false, actions: { topNotificationChange: function (count) { this.set('topNotificationCount', count); + }, + + closeNavMenu: function () { + this.get('dropdown').closeDropdowns(); + this.set('showNavMenu', false); + }, + + navMenuToggleMaximise: function () { + this.toggleProperty('autoNav'); } } }); - -export default ApplicationController; diff --git a/core/client/app/controllers/post-settings-menu.js b/core/client/app/controllers/post-settings-menu.js index ca17fa4b10..b66a68faf9 100644 --- a/core/client/app/controllers/post-settings-menu.js +++ b/core/client/app/controllers/post-settings-menu.js @@ -12,6 +12,8 @@ var PostSettingsMenuController = Ember.Controller.extend(SettingsMenuMixin, { selectedAuthor: null, uploaderReference: null, + application: Ember.inject.controller(), + initializeSelectedAuthor: function () { var self = this; @@ -456,6 +458,10 @@ var PostSettingsMenuController = Ember.Controller.extend(SettingsMenuMixin, { resetPubDate: function () { this.set('publishedAtValue', ''); + }, + + closeNavMenu: function () { + this.get('application').send('closeNavMenu'); } } }); diff --git a/core/client/app/controllers/settings/tags.js b/core/client/app/controllers/settings/tags.js index 00bfb2a5b7..8877a4a331 100644 --- a/core/client/app/controllers/settings/tags.js +++ b/core/client/app/controllers/settings/tags.js @@ -19,6 +19,8 @@ var TagsController = Ember.ArrayController.extend(PaginationMixin, SettingsMenuM this._super(options); }, + application: Ember.inject.controller(), + showErrors: function (errors) { errors = Ember.isArray(errors) ? errors : [errors]; this.notifications.showErrors(errors); @@ -128,6 +130,10 @@ var TagsController = Ember.ArrayController.extend(PaginationMixin, SettingsMenuM clearCoverImage: function () { this.saveActiveTagProperty('image', ''); + }, + + closeNavMenu: function () { + this.get('application').send('closeNavMenu'); } } }); diff --git a/core/client/app/initializers/dropdown.js b/core/client/app/initializers/dropdown.js index 02a3181ff2..db339383f9 100644 --- a/core/client/app/initializers/dropdown.js +++ b/core/client/app/initializers/dropdown.js @@ -9,6 +9,7 @@ var dropdownInitializer = { // Inject dropdowns application.inject('component:gh-dropdown', 'dropdown', 'dropdown:service'); application.inject('component:gh-dropdown-button', 'dropdown', 'dropdown:service'); + application.inject('controller:application', 'dropdown', 'dropdown:service'); application.inject('controller:modals.delete-post', 'dropdown', 'dropdown:service'); application.inject('controller:modals.transfer-owner', 'dropdown', 'dropdown:service'); application.inject('route:application', 'dropdown', 'dropdown:service'); diff --git a/core/client/app/mixins/editor-base-controller.js b/core/client/app/mixins/editor-base-controller.js index d7a9fcdb73..a27cf73e46 100644 --- a/core/client/app/mixins/editor-base-controller.js +++ b/core/client/app/mixins/editor-base-controller.js @@ -1,5 +1,6 @@ -import Ember from 'ember'; /* global console */ + +import Ember from 'ember'; import PostModel from 'ghost/models/post'; import boundOneWay from 'ghost/utils/bound-one-way'; import imageManager from 'ghost/utils/ed-image-manager'; diff --git a/core/client/app/templates/-nav-menu.hbs b/core/client/app/templates/-nav-menu.hbs deleted file mode 100644 index bef4912b30..0000000000 --- a/core/client/app/templates/-nav-menu.hbs +++ /dev/null @@ -1,66 +0,0 @@ - diff --git a/core/client/app/templates/application.hbs b/core/client/app/templates/application.hbs index 676f6a0672..1712adb88f 100644 --- a/core/client/app/templates/application.hbs +++ b/core/client/app/templates/application.hbs @@ -2,15 +2,15 @@ {{gh-alerts notify="topNotificationChange"}} -