mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-28 21:33:24 +03:00
Ember cleanup: single quotes for JS
- All JS should use single quotes
This commit is contained in:
parent
ef6b03fef1
commit
8836375ca6
@ -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*/
|
||||
|
@ -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'
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -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.'
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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')
|
||||
});
|
@ -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;
|
||||
|
@ -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 + ').';
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
},
|
||||
|
@ -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;
|
||||
}
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user