From 8836375ca61f984b51a12a13e5331457fb08ae83 Mon Sep 17 00:00:00 2001 From: Hannah Wolfe Date: Sun, 1 Jun 2014 21:53:16 +0100 Subject: [PATCH] Ember cleanup: single quotes for JS - All JS should use single quotes --- core/client/components/gh-popover-button.js | 2 +- core/client/controllers/modals/delete-all.js | 8 ++++---- core/client/controllers/modals/delete-post.js | 10 +++++----- core/client/controllers/modals/upload.js | 2 +- core/client/models/post.js | 2 +- core/client/models/settings.js | 10 +++++----- core/client/models/tag.js | 2 +- core/client/models/user.js | 14 +++++++------- core/client/utils/ajax.js | 8 ++++---- core/client/utils/date-formatting.js | 14 +++++++------- core/client/utils/notifications.js | 2 +- core/client/utils/word-count.js | 6 +++--- core/client/views/post-item-view.js | 2 +- 13 files changed, 41 insertions(+), 41 deletions(-) diff --git a/core/client/components/gh-popover-button.js b/core/client/components/gh-popover-button.js index 7e258119f2..8b2fa1330f 100644 --- a/core/client/components/gh-popover-button.js +++ b/core/client/components/gh-popover-button.js @@ -1,7 +1,7 @@ import PopoverMixin from 'ghost/mixins/popover-mixin'; var PopoverButton = Ember.Component.extend(PopoverMixin, { - tagName: "button", + tagName: 'button', /*matches with the popover this button toggles*/ popoverName: null, /*Notify popover service this popover should be toggled*/ diff --git a/core/client/controllers/modals/delete-all.js b/core/client/controllers/modals/delete-all.js index b3112fcdf4..8719a3c30d 100644 --- a/core/client/controllers/modals/delete-all.js +++ b/core/client/controllers/modals/delete-all.js @@ -39,15 +39,15 @@ var DeleteAllController = Ember.Controller.extend({ // } // }); }, - text: "Delete", - buttonClass: "button-delete" + text: 'Delete', + buttonClass: 'button-delete' }, reject: { func: function () { return true; }, - text: "Cancel", - buttonClass: "button" + text: 'Cancel', + buttonClass: 'button' } } }); diff --git a/core/client/controllers/modals/delete-post.js b/core/client/controllers/modals/delete-post.js index 43d7d7687f..69af6e512d 100644 --- a/core/client/controllers/modals/delete-post.js +++ b/core/client/controllers/modals/delete-post.js @@ -26,17 +26,17 @@ var DeletePostController = Ember.Controller.extend({ // }); // }); }, - text: "Delete", - buttonClass: "button-delete" + text: 'Delete', + buttonClass: 'button-delete' }, reject: { func: function () { return true; }, - text: "Cancel", - buttonClass: "button" + text: 'Cancel', + buttonClass: 'button' } - }, + } }); export default DeletePostController; diff --git a/core/client/controllers/modals/upload.js b/core/client/controllers/modals/upload.js index 67a4d67b01..6058de6e86 100644 --- a/core/client/controllers/modals/upload.js +++ b/core/client/controllers/modals/upload.js @@ -6,7 +6,7 @@ var UploadController = Ember.Controller.extend({ return true; }, buttonClass: true, - text: "Cancel" // The reject button text + text: 'Cancel' // The reject button text } } }); diff --git a/core/client/models/post.js b/core/client/models/post.js index 1d6e148a51..9b53e255de 100644 --- a/core/client/models/post.js +++ b/core/client/models/post.js @@ -40,7 +40,7 @@ var Post = DS.Model.extend({ if (!this.get('title.length')) { validationErrors.push({ - message: "You must specify a title for the post." + message: 'You must specify a title for the post.' }); } diff --git a/core/client/models/settings.js b/core/client/models/settings.js index 8303eae2a7..65a3a617c9 100644 --- a/core/client/models/settings.js +++ b/core/client/models/settings.js @@ -25,24 +25,24 @@ var SettingsModel = BaseModel.extend({ postsPerPage; if (!validator.isLength(this.get('title'), 0, 150)) { - validationErrors.push({message: "Title is too long", el: 'title'}); + validationErrors.push({message: 'Title is too long', el: 'title'}); } if (!validator.isLength(this.get('description'), 0, 200)) { - validationErrors.push({message: "Description is too long", el: 'description'}); + validationErrors.push({message: 'Description is too long', el: 'description'}); } if (!validator.isEmail(this.get('email')) || !validator.isLength(this.get('email'), 0, 254)) { - validationErrors.push({message: "Please supply a valid email address", el: 'email'}); + validationErrors.push({message: 'Please supply a valid email address', el: 'email'}); } postsPerPage = this.get('postsPerPage'); if (!validator.isInt(postsPerPage) || postsPerPage > 1000) { - validationErrors.push({message: "Please use a number less than 1000", el: 'postsPerPage'}); + validationErrors.push({message: 'Please use a number less than 1000', el: 'postsPerPage'}); } if (!validator.isInt(postsPerPage) || postsPerPage < 0) { - validationErrors.push({message: "Please use a number greater than 0", el: 'postsPerPage'}); + validationErrors.push({message: 'Please use a number greater than 0', el: 'postsPerPage'}); } return validationErrors; diff --git a/core/client/models/tag.js b/core/client/models/tag.js index 6000f2777c..5fe0e674a9 100644 --- a/core/client/models/tag.js +++ b/core/client/models/tag.js @@ -9,5 +9,5 @@ export default DS.Model.extend({ created_at: DS.attr('date'), created_by: DS.attr('number'), updated_at: DS.attr('date'), - updated_by: DS.attr('number'), + updated_by: DS.attr('number') }); \ No newline at end of file diff --git a/core/client/models/user.js b/core/client/models/user.js index 530be37026..656d462814 100644 --- a/core/client/models/user.js +++ b/core/client/models/user.js @@ -26,25 +26,25 @@ var User = DS.Model.extend({ var validationErrors = []; if (!validator.isLength(this.get('name'), 0, 150)) { - validationErrors.push({message: "Name is too long"}); + validationErrors.push({message: 'Name is too long'}); } if (!validator.isLength(this.get('bio'), 0, 200)) { - validationErrors.push({message: "Bio is too long"}); + validationErrors.push({message: 'Bio is too long'}); } if (!validator.isEmail(this.get('email'))) { - validationErrors.push({message: "Please supply a valid email address"}); + validationErrors.push({message: 'Please supply a valid email address'}); } if (!validator.isLength(this.get('location'), 0, 150)) { - validationErrors.push({message: "Location is too long"}); + validationErrors.push({message: 'Location is too long'}); } if (this.get('website').length) { if (!validator.isURL(this.get('website'), { protocols: ['http', 'https'], require_protocol: true }) || !validator.isLength(this.get('website'), 0, 2000)) { - validationErrors.push({message: "Please use a valid url"}); + validationErrors.push({message: 'Please use a valid url'}); } } @@ -65,11 +65,11 @@ var User = DS.Model.extend({ var validationErrors = []; if (!validator.equals(password.newPassword, password.ne2Password)) { - validationErrors.push("Your new passwords do not match"); + validationErrors.push('Your new passwords do not match'); } if (!validator.isLength(password.newPassword, 8)) { - validationErrors.push("Your password is not long enough. It must be at least 8 characters long."); + validationErrors.push('Your password is not long enough. It must be at least 8 characters long.'); } return validationErrors; diff --git a/core/client/utils/ajax.js b/core/client/utils/ajax.js index faac205034..12ebc8f2b2 100644 --- a/core/client/utils/ajax.js +++ b/core/client/utils/ajax.js @@ -21,18 +21,18 @@ var getRequestErrorMessage = function (request) { // If a non 200 response if (request.status !== 200) { try { - // Try to parse out the error, or default to "Unknown" + // Try to parse out the error, or default to 'Unknown' if (request.responseJSON.errors && Ember.isArray(request.responseJSON.errors)) { message = request.responseJSON.errors.map(function (errorItem) { return errorItem.message; }).join('; '); } else { - message = request.responseJSON.error || "Unknown Error"; + message = request.responseJSON.error || 'Unknown Error'; } } catch (e) { - msgDetail = request.status ? request.status + " - " + request.statusText : "Server was not available"; - message = "The server returned an error (" + msgDetail + ")."; + msgDetail = request.status ? request.status + ' - ' + request.statusText : 'Server was not available'; + message = 'The server returned an error (' + msgDetail + ').'; } } diff --git a/core/client/utils/date-formatting.js b/core/client/utils/date-formatting.js index 1f8213a465..200f7ee972 100644 --- a/core/client/utils/date-formatting.js +++ b/core/client/utils/date-formatting.js @@ -1,11 +1,11 @@ /* global moment */ -var parseDateFormats = ["DD MMM YY HH:mm", - "DD MMM YYYY HH:mm", - "DD/MM/YY HH:mm", - "DD/MM/YYYY HH:mm", - "DD-MM-YY HH:mm", - "DD-MM-YYYY HH:mm", - "YYYY-MM-DD HH:mm"], +var parseDateFormats = ['DD MMM YY HH:mm', + 'DD MMM YYYY HH:mm', + 'DD/MM/YY HH:mm', + 'DD/MM/YYYY HH:mm', + 'DD-MM-YY HH:mm', + 'DD-MM-YYYY HH:mm', + 'YYYY-MM-DD HH:mm'], displayDateFormat = 'DD MMM YY @ HH:mm'; //Parses a string to a Moment diff --git a/core/client/utils/notifications.js b/core/client/utils/notifications.js index fb0bfa30d6..824a46f436 100644 --- a/core/client/utils/notifications.js +++ b/core/client/utils/notifications.js @@ -5,7 +5,7 @@ var Notifications = Ember.ArrayProxy.extend({ object.typeClass = 'notification-' + object.type; // This should be somewhere else. if (object.type === 'success') { - object.typeClass = object.typeClass + " notification-passive"; + object.typeClass = object.typeClass + ' notification-passive'; } this._super(object); }, diff --git a/core/client/utils/word-count.js b/core/client/utils/word-count.js index 237a2cb471..67542c44a0 100644 --- a/core/client/utils/word-count.js +++ b/core/client/utils/word-count.js @@ -1,6 +1,6 @@ export default function (s) { - s = s.replace(/(^\s*)|(\s*$)/gi, ""); // exclude start and end white-space - s = s.replace(/[ ]{2,}/gi, " "); // 2 or more space to 1 - s = s.replace(/\n /, "\n"); // exclude newline with a start spacing + s = s.replace(/(^\s*)|(\s*$)/gi, ''); // exclude start and end white-space + s = s.replace(/[ ]{2,}/gi, ' '); // 2 or more space to 1 + s = s.replace(/\n /, '\n'); // exclude newline with a start spacing return s.split(' ').length; } \ No newline at end of file diff --git a/core/client/views/post-item-view.js b/core/client/views/post-item-view.js index 90851a0aaa..66c8f38bb7 100644 --- a/core/client/views/post-item-view.js +++ b/core/client/views/post-item-view.js @@ -3,7 +3,7 @@ import itemView from 'ghost/views/item-view'; var PostItemView = itemView.extend({ openEditor: function () { this.get('controller').send('openEditor', this.get('controller.model')); // send action to handle transition to editor route - }.on("doubleClick") + }.on('doubleClick') }); export default PostItemView;