diff --git a/core/client/components/gh-codemirror.js b/core/client/components/gh-codemirror.js index a65b4acb72..2febdbfc2f 100644 --- a/core/client/components/gh-codemirror.js +++ b/core/client/components/gh-codemirror.js @@ -4,13 +4,12 @@ import MarkerManager from 'ghost/mixins/marker-manager'; import mobileCodeMirror from 'ghost/utils/codemirror-mobile'; import setScrollClassName from 'ghost/utils/set-scroll-classname'; import codeMirrorShortcuts from 'ghost/utils/codemirror-shortcuts'; -import bind from 'ghost/utils/bind'; codeMirrorShortcuts.init(); var onChangeHandler = function (cm, changeObj) { var line, - component = cm.component, + component = cm.component; // fill array with a range of numbers for (line = changeObj.from.line; line < changeObj.from.line + changeObj.text.length; line += 1) { diff --git a/core/client/components/gh-markdown.js b/core/client/components/gh-markdown.js index b83e0d6252..f949e5d71f 100644 --- a/core/client/components/gh-markdown.js +++ b/core/client/components/gh-markdown.js @@ -15,26 +15,21 @@ var Markdown = Ember.Component.extend({ // fire off 'enable' API function from uploadManager // might need to make sure markdown has been processed first reInitDropzones: function () { - Ember.run.scheduleOnce('afterRender', this, function () { - var dropzones = $('.js-drop-zone'), - self = this; + function handleDropzoneEvents() { + var dropzones = $('.js-drop-zone'); uploader.call(dropzones, { editor: true, fileStorage: this.get('config.fileStorage') }); - function boundSendAction(actionName) { - return function() { - self.sendAction.call(self, actionName); - } - } + dropzones.on('uploadstart', Ember.run.bind(this, 'sendAction', 'uploadStarted')); + dropzones.on('uploadfailure', Ember.run.bind(this, 'sendAction', 'uploadFinished')); + dropzones.on('uploadsuccess', Ember.run.bind(this, 'sendAction', 'uploadFinished')); + dropzones.on('uploadsuccess', Ember.run.bind(this, 'sendAction', 'uploadSuccess')); + } - dropzones.on('uploadstart', boundSendAction('uploadStarted')); - dropzones.on('uploadfailure', boundSendAction('uploadFinished')); - dropzones.on('uploadsuccess', boundSendAction('uploadFinished')); - dropzones.on('uploadsuccess', boundSendAction('uploadSuccess')); - }); + Ember.run.scheduleOnce('afterRender', this, handleDropzoneEvents); }.observes('markdown') }); diff --git a/core/client/controllers/post-settings-menu.js b/core/client/controllers/post-settings-menu.js index a015ad1259..0808619992 100644 --- a/core/client/controllers/post-settings-menu.js +++ b/core/client/controllers/post-settings-menu.js @@ -136,7 +136,7 @@ var PostSettingsMenuController = Ember.ObjectController.extend({ el = $('.rendered-markdown'); // Get rendered markdown - if (!_.isUndefined(el) && el.length > 0) { + if (el !== undefined && el.length > 0) { html = el.clone(); html.find('.image-uploader').remove(); html = html[0].innerHTML; diff --git a/core/client/mixins/pagination-route.js b/core/client/mixins/pagination-route.js index 40f6e076b8..192fb15f13 100644 --- a/core/client/mixins/pagination-route.js +++ b/core/client/mixins/pagination-route.js @@ -13,8 +13,10 @@ var PaginationRoute = Ember.Mixin.create({ settings = settings || {}; for (var key in defaultPaginationSettings) { - if (!settings.hasOwnProperty(key)) { - settings[key] = defaultPaginationSettings[key]; + if (defaultPaginationSettings.hasOwnProperty(key)) { + if (!settings.hasOwnProperty(key)) { + settings[key] = defaultPaginationSettings[key]; + } } } diff --git a/core/client/models/user.js b/core/client/models/user.js index cf4d9414de..520576c417 100644 --- a/core/client/models/user.js +++ b/core/client/models/user.js @@ -90,7 +90,7 @@ var User = DS.Model.extend(NProgressSaveMixin, SelectiveSaveMixin, ValidationEng active: function () { return ['active', 'warn-1', 'warn-2', 'warn-3', 'warn-4', 'locked'].indexOf(this.get('status')) > -1; }.property('status'), - + invited: function () { return ['invited', 'invited-pending'].indexOf(this.get('status')) > -1; }.property('status'), diff --git a/core/client/routes/settings/index.js b/core/client/routes/settings/index.js index 0cf8c5c091..a48b516456 100644 --- a/core/client/routes/settings/index.js +++ b/core/client/routes/settings/index.js @@ -1,7 +1,6 @@ import MobileIndexRoute from 'ghost/routes/mobile-index-route'; import CurrentUserSettings from 'ghost/mixins/current-user-settings'; import mobileQuery from 'ghost/utils/mobile'; -import bind from 'ghost/utils/bind'; var SettingsIndexRoute = MobileIndexRoute.extend(SimpleAuth.AuthenticatedRouteMixin, CurrentUserSettings, { // Redirect users without permission to view settings, diff --git a/core/client/views/application.js b/core/client/views/application.js index 4f1f5db79c..f9dece9b78 100644 --- a/core/client/views/application.js +++ b/core/client/views/application.js @@ -1,4 +1,5 @@ import mobileQuery from 'ghost/utils/mobile'; +import bind from 'ghost/utils/bind'; var ApplicationView = Ember.View.extend({ elementId: 'container', @@ -43,7 +44,7 @@ var ApplicationView = Ember.View.extend({ }.observes('controller.showGlobalMobileNav'), setupCloseNavOnDesktop: function () { - this.set('closeGlobalMobileNavOnDesktop', _.bind(function closeGlobalMobileNavOnDesktop(mq) { + this.set('closeGlobalMobileNavOnDesktop', bind(function closeGlobalMobileNavOnDesktop(mq) { if (!mq.matches) { // Is desktop sized this.set('controller.showGlobalMobileNav', false); diff --git a/core/client/views/settings.js b/core/client/views/settings.js index 29f0aa44da..516ca3adc7 100644 --- a/core/client/views/settings.js +++ b/core/client/views/settings.js @@ -1,5 +1,4 @@ import MobileParentView from 'ghost/views/mobile/parent-view'; -import bind from 'ghost/utils/bind'; var SettingsView = MobileParentView.extend({ // MobileParentView callbacks