Fix up PR #3491, remove lodash from admin

Refs #3491
This commit is contained in:
Jason Williams 2014-10-04 16:38:15 +00:00
parent a3456b7e1c
commit 9aa13330ba
8 changed files with 17 additions and 22 deletions

View File

@ -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) {

View File

@ -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')
});

View File

@ -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;

View File

@ -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];
}
}
}

View File

@ -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'),

View File

@ -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,

View File

@ -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);

View File

@ -1,5 +1,4 @@
import MobileParentView from 'ghost/views/mobile/parent-view';
import bind from 'ghost/utils/bind';
var SettingsView = MobileParentView.extend({
// MobileParentView callbacks