mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-17 23:44:39 -05:00
Cleanup indentation and quotes
Aligns all requirements vertically for easier reading + adds single quote standard consistently throughout Ghost, except in long strings.
This commit is contained in:
parent
8eefbf9cc7
commit
c3a9a903c6
12 changed files with 70 additions and 70 deletions
|
@ -1,9 +1,9 @@
|
||||||
/*globals Handlebars, moment
|
/*globals Handlebars, moment
|
||||||
*/
|
*/
|
||||||
(function () {
|
(function () {
|
||||||
"use strict";
|
'use strict';
|
||||||
Handlebars.registerHelper('date', function (context, block) {
|
Handlebars.registerHelper('date', function (context, block) {
|
||||||
var f = block.hash.format || "MMM Do, YYYY",
|
var f = block.hash.format || 'MMM Do, YYYY',
|
||||||
timeago = block.hash.timeago,
|
timeago = block.hash.timeago,
|
||||||
date;
|
date;
|
||||||
if (timeago) {
|
if (timeago) {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/*globals window, $, _, Backbone, Validator */
|
/*globals window, $, _, Backbone, Validator */
|
||||||
(function () {
|
(function () {
|
||||||
"use strict";
|
'use strict';
|
||||||
|
|
||||||
var Ghost = {
|
var Ghost = {
|
||||||
Layout : {},
|
Layout : {},
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
/*global $, window, CodeMirror, Showdown, moment */
|
/*global $, window, CodeMirror, Showdown, moment */
|
||||||
(function () {
|
(function () {
|
||||||
"use strict";
|
'use strict';
|
||||||
var Markdown = {
|
var Markdown = {
|
||||||
init : function (options, elem) {
|
init : function (options, elem) {
|
||||||
var self = this;
|
var self = this;
|
||||||
|
@ -17,59 +17,59 @@
|
||||||
replace: function () {
|
replace: function () {
|
||||||
var text = this.elem.getSelection(), pass = true, md, cursor, line, word, letterCount, converter;
|
var text = this.elem.getSelection(), pass = true, md, cursor, line, word, letterCount, converter;
|
||||||
switch (this.style) {
|
switch (this.style) {
|
||||||
case "h1":
|
case 'h1':
|
||||||
cursor = this.elem.getCursor();
|
cursor = this.elem.getCursor();
|
||||||
line = this.elem.getLine(cursor.line);
|
line = this.elem.getLine(cursor.line);
|
||||||
this.elem.setLine(cursor.line, "# " + line);
|
this.elem.setLine(cursor.line, '# ' + line);
|
||||||
this.elem.setCursor(cursor.line, cursor.ch + 2);
|
this.elem.setCursor(cursor.line, cursor.ch + 2);
|
||||||
pass = false;
|
pass = false;
|
||||||
break;
|
break;
|
||||||
case "h2":
|
case 'h2':
|
||||||
cursor = this.elem.getCursor();
|
cursor = this.elem.getCursor();
|
||||||
line = this.elem.getLine(cursor.line);
|
line = this.elem.getLine(cursor.line);
|
||||||
this.elem.setLine(cursor.line, "## " + line);
|
this.elem.setLine(cursor.line, '## ' + line);
|
||||||
this.elem.setCursor(cursor.line, cursor.ch + 3);
|
this.elem.setCursor(cursor.line, cursor.ch + 3);
|
||||||
pass = false;
|
pass = false;
|
||||||
break;
|
break;
|
||||||
case "h3":
|
case 'h3':
|
||||||
cursor = this.elem.getCursor();
|
cursor = this.elem.getCursor();
|
||||||
line = this.elem.getLine(cursor.line);
|
line = this.elem.getLine(cursor.line);
|
||||||
this.elem.setLine(cursor.line, "### " + line);
|
this.elem.setLine(cursor.line, '### ' + line);
|
||||||
this.elem.setCursor(cursor.line, cursor.ch + 4);
|
this.elem.setCursor(cursor.line, cursor.ch + 4);
|
||||||
pass = false;
|
pass = false;
|
||||||
break;
|
break;
|
||||||
case "h4":
|
case 'h4':
|
||||||
cursor = this.elem.getCursor();
|
cursor = this.elem.getCursor();
|
||||||
line = this.elem.getLine(cursor.line);
|
line = this.elem.getLine(cursor.line);
|
||||||
this.elem.setLine(cursor.line, "#### " + line);
|
this.elem.setLine(cursor.line, '#### ' + line);
|
||||||
this.elem.setCursor(cursor.line, cursor.ch + 5);
|
this.elem.setCursor(cursor.line, cursor.ch + 5);
|
||||||
pass = false;
|
pass = false;
|
||||||
break;
|
break;
|
||||||
case "h5":
|
case 'h5':
|
||||||
cursor = this.elem.getCursor();
|
cursor = this.elem.getCursor();
|
||||||
line = this.elem.getLine(cursor.line);
|
line = this.elem.getLine(cursor.line);
|
||||||
this.elem.setLine(cursor.line, "##### " + line);
|
this.elem.setLine(cursor.line, '##### ' + line);
|
||||||
this.elem.setCursor(cursor.line, cursor.ch + 6);
|
this.elem.setCursor(cursor.line, cursor.ch + 6);
|
||||||
pass = false;
|
pass = false;
|
||||||
break;
|
break;
|
||||||
case "h6":
|
case 'h6':
|
||||||
cursor = this.elem.getCursor();
|
cursor = this.elem.getCursor();
|
||||||
line = this.elem.getLine(cursor.line);
|
line = this.elem.getLine(cursor.line);
|
||||||
this.elem.setLine(cursor.line, "###### " + line);
|
this.elem.setLine(cursor.line, '###### ' + line);
|
||||||
this.elem.setCursor(cursor.line, cursor.ch + 7);
|
this.elem.setCursor(cursor.line, cursor.ch + 7);
|
||||||
pass = false;
|
pass = false;
|
||||||
break;
|
break;
|
||||||
case "link":
|
case 'link':
|
||||||
md = this.options.syntax.link.replace('$1', text);
|
md = this.options.syntax.link.replace('$1', text);
|
||||||
this.elem.replaceSelection(md, "end");
|
this.elem.replaceSelection(md, 'end');
|
||||||
cursor = this.elem.getCursor();
|
cursor = this.elem.getCursor();
|
||||||
this.elem.setSelection({line: cursor.line, ch: cursor.ch - 8}, {line: cursor.line, ch: cursor.ch - 1});
|
this.elem.setSelection({line: cursor.line, ch: cursor.ch - 8}, {line: cursor.line, ch: cursor.ch - 1});
|
||||||
pass = false;
|
pass = false;
|
||||||
break;
|
break;
|
||||||
case "image":
|
case 'image':
|
||||||
cursor = this.elem.getCursor();
|
cursor = this.elem.getCursor();
|
||||||
md = this.options.syntax.image.replace('$1', text);
|
md = this.options.syntax.image.replace('$1', text);
|
||||||
if (this.elem.getLine(cursor.line) !== "") {
|
if (this.elem.getLine(cursor.line) !== '') {
|
||||||
md = "\n\n" + md;
|
md = "\n\n" + md;
|
||||||
}
|
}
|
||||||
this.elem.replaceSelection(md, "end");
|
this.elem.replaceSelection(md, "end");
|
||||||
|
@ -77,16 +77,16 @@
|
||||||
this.elem.setSelection({line: cursor.line, ch: cursor.ch - 8}, {line: cursor.line, ch: cursor.ch - 1});
|
this.elem.setSelection({line: cursor.line, ch: cursor.ch - 8}, {line: cursor.line, ch: cursor.ch - 1});
|
||||||
pass = false;
|
pass = false;
|
||||||
break;
|
break;
|
||||||
case "uppercase":
|
case 'uppercase':
|
||||||
md = text.toLocaleUpperCase();
|
md = text.toLocaleUpperCase();
|
||||||
break;
|
break;
|
||||||
case "lowercase":
|
case 'lowercase':
|
||||||
md = text.toLocaleLowerCase();
|
md = text.toLocaleLowerCase();
|
||||||
break;
|
break;
|
||||||
case "titlecase":
|
case 'titlecase':
|
||||||
md = text.toTitleCase();
|
md = text.toTitleCase();
|
||||||
break;
|
break;
|
||||||
case "selectword":
|
case 'selectword':
|
||||||
cursor = this.elem.getCursor();
|
cursor = this.elem.getCursor();
|
||||||
word = this.elem.getTokenAt(cursor);
|
word = this.elem.getTokenAt(cursor);
|
||||||
if (!/\w$/g.test(word.string)) {
|
if (!/\w$/g.test(word.string)) {
|
||||||
|
@ -95,7 +95,7 @@
|
||||||
this.elem.setSelection({line: cursor.line, ch: word.start}, {line: cursor.line, ch: word.end});
|
this.elem.setSelection({line: cursor.line, ch: word.start}, {line: cursor.line, ch: word.end});
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case "copyHTML":
|
case 'copyHTML':
|
||||||
converter = new Showdown.converter();
|
converter = new Showdown.converter();
|
||||||
if (text) {
|
if (text) {
|
||||||
md = converter.makeHtml(text);
|
md = converter.makeHtml(text);
|
||||||
|
@ -106,14 +106,14 @@
|
||||||
$(".modal-copyToHTML-content").text(md).selectText();
|
$(".modal-copyToHTML-content").text(md).selectText();
|
||||||
pass = false;
|
pass = false;
|
||||||
break;
|
break;
|
||||||
case "list":
|
case 'list':
|
||||||
md = text.replace(/^(\s*)(\w\W*)/gm, "$1* $2");
|
md = text.replace(/^(\s*)(\w\W*)/gm, '$1* $2');
|
||||||
this.elem.replaceSelection(md, "end");
|
this.elem.replaceSelection(md, 'end');
|
||||||
pass = false;
|
pass = false;
|
||||||
break;
|
break;
|
||||||
case "currentDate":
|
case 'currentDate':
|
||||||
md = moment(new Date()).format("D MMMM YYYY");
|
md = moment(new Date()).format('D MMMM YYYY');
|
||||||
this.elem.replaceSelection(md, "end");
|
this.elem.replaceSelection(md, 'end');
|
||||||
pass = false;
|
pass = false;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -122,7 +122,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (pass && md) {
|
if (pass && md) {
|
||||||
this.elem.replaceSelection(md, "end");
|
this.elem.replaceSelection(md, 'end');
|
||||||
if (!text) {
|
if (!text) {
|
||||||
letterCount = md.length;
|
letterCount = md.length;
|
||||||
cursor = this.elem.getCursor();
|
cursor = this.elem.getCursor();
|
||||||
|
|
|
@ -3,49 +3,49 @@
|
||||||
/*global window, document, $, FastClick */
|
/*global window, document, $, FastClick */
|
||||||
|
|
||||||
(function () {
|
(function () {
|
||||||
"use strict";
|
'use strict';
|
||||||
|
|
||||||
FastClick.attach(document.body);
|
FastClick.attach(document.body);
|
||||||
|
|
||||||
// ### Show content preview when swiping left on content list
|
// ### Show content preview when swiping left on content list
|
||||||
$(".manage").on("click", ".content-list ol li", function (event) {
|
$('.manage').on('click', '.content-list ol li', function (event) {
|
||||||
if (window.matchMedia('(max-width: 800px)').matches) {
|
if (window.matchMedia('(max-width: 800px)').matches) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
$(".content-list").animate({right: "100%", left: "-100%", 'margin-right': "15px"}, 300);
|
$('.content-list').animate({right: '100%', left: '-100%', 'margin-right': '15px'}, 300);
|
||||||
$(".content-preview").animate({right: "0", left: "0", 'margin-left': "0"}, 300);
|
$('.content-preview').animate({right: '0', left: '0', 'margin-left': '0'}, 300);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// ### Hide content preview
|
// ### Hide content preview
|
||||||
$(".manage").on("click", ".content-preview .button-back", function (event) {
|
$('.manage').on('click', '.content-preview .button-back', function (event) {
|
||||||
if (window.matchMedia('(max-width: 800px)').matches) {
|
if (window.matchMedia('(max-width: 800px)').matches) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
$(".content-list").animate({right: "0", left: "0", 'margin-right': "0"}, 300);
|
$('.content-list').animate({right: '0', left: '0', 'margin-right': '0'}, 300);
|
||||||
$(".content-preview").animate({right: "-100%", left: "100%", 'margin-left': "15px"}, 300);
|
$('.content-preview').animate({right: '-100%', left: '100%', 'margin-left': '15px'}, 300);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// ### Show settings options page when swiping left on settings menu link
|
// ### Show settings options page when swiping left on settings menu link
|
||||||
$(".settings").on("click", ".settings-menu li", function (event) {
|
$('.settings').on('click', '.settings-menu li', function (event) {
|
||||||
if (window.matchMedia('(max-width: 800px)').matches) {
|
if (window.matchMedia('(max-width: 800px)').matches) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
$(".settings-sidebar").animate({right: "100%", left: "-102%", 'margin-right': "15px"}, 300);
|
$('.settings-sidebar').animate({right: '100%', left: '-102%', 'margin-right': '15px'}, 300);
|
||||||
$(".settings-content").animate({right: "0", left: "0", 'margin-left': "0"}, 300);
|
$('.settings-content').animate({right: '0', left: '0', 'margin-left': '0'}, 300);
|
||||||
$(".settings-content .button-back, .settings-content .button-save").css("display", "inline-block");
|
$('.settings-content .button-back, .settings-content .button-save').css('display', 'inline-block');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// ### Hide settings options page
|
// ### Hide settings options page
|
||||||
$(".settings").on("click", ".settings-content .button-back", function (event) {
|
$('.settings').on('click', '.settings-content .button-back', function (event) {
|
||||||
if (window.matchMedia('(max-width: 800px)').matches) {
|
if (window.matchMedia('(max-width: 800px)').matches) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
$(".settings-sidebar").animate({right: "0", left: "0", 'margin-right': "0"}, 300);
|
$('.settings-sidebar').animate({right: '0', left: '0', 'margin-right': '0'}, 300);
|
||||||
$(".settings-content").animate({right: "-100%", left: "100%", 'margin-left': "15"}, 300);
|
$('.settings-content').animate({right: '-100%', left: '100%', 'margin-left': '15'}, 300);
|
||||||
$(".settings-content .button-back, .settings-content .button-save").css("display", "none");
|
$('.settings-content .button-back, .settings-content .button-save').css('display', 'none');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/*global window, document, Ghost, $, _, Backbone */
|
/*global window, document, Ghost, $, _, Backbone */
|
||||||
(function () {
|
(function () {
|
||||||
"use strict";
|
'use strict';
|
||||||
|
|
||||||
Ghost.Models.Post = Backbone.Model.extend({
|
Ghost.Models.Post = Backbone.Model.extend({
|
||||||
|
|
||||||
|
@ -12,8 +12,8 @@
|
||||||
|
|
||||||
parse: function (resp) {
|
parse: function (resp) {
|
||||||
if (resp.status) {
|
if (resp.status) {
|
||||||
resp.published = !!(resp.status === "published");
|
resp.published = !!(resp.status === 'published');
|
||||||
resp.draft = !!(resp.status === "draft");
|
resp.draft = !!(resp.status === 'draft');
|
||||||
}
|
}
|
||||||
if (resp.tags) {
|
if (resp.tags) {
|
||||||
// TODO: parse tags into it's own collection on the model (this.tags)
|
// TODO: parse tags into it's own collection on the model (this.tags)
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
/*global window, document, Ghost, $, _, Backbone */
|
/*global window, document, Ghost, $, _, Backbone */
|
||||||
(function () {
|
(function () {
|
||||||
"use strict";
|
'use strict';
|
||||||
//id:0 is used to issue PUT requests
|
//id:0 is used to issue PUT requests
|
||||||
Ghost.Models.Settings = Backbone.Model.extend({
|
Ghost.Models.Settings = Backbone.Model.extend({
|
||||||
url: Ghost.settings.apiRoot + '/settings/?type=blog,theme',
|
url: Ghost.settings.apiRoot + '/settings/?type=blog,theme',
|
||||||
id: "0"
|
id: '0'
|
||||||
});
|
});
|
||||||
|
|
||||||
}());
|
}());
|
|
@ -1,6 +1,6 @@
|
||||||
/*global window, document, Ghost, $, _, Backbone */
|
/*global window, document, Ghost, $, _, Backbone */
|
||||||
(function () {
|
(function () {
|
||||||
"use strict";
|
'use strict';
|
||||||
|
|
||||||
Ghost.Collections.Tags = Backbone.Collection.extend({
|
Ghost.Collections.Tags = Backbone.Collection.extend({
|
||||||
url: Ghost.settings.apiRoot + '/tags/'
|
url: Ghost.settings.apiRoot + '/tags/'
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/*global window, document, Ghost, $, _, Backbone */
|
/*global window, document, Ghost, $, _, Backbone */
|
||||||
(function () {
|
(function () {
|
||||||
"use strict";
|
'use strict';
|
||||||
|
|
||||||
Ghost.Models.Themes = Backbone.Model.extend({
|
Ghost.Models.Themes = Backbone.Model.extend({
|
||||||
url: Ghost.settings.apiRoot + '/themes'
|
url: Ghost.settings.apiRoot + '/themes'
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
/*global Ghost, Backbone */
|
/*global Ghost, Backbone */
|
||||||
(function () {
|
(function () {
|
||||||
"use strict";
|
'use strict';
|
||||||
Ghost.Models.uploadModal = Backbone.Model.extend({
|
Ghost.Models.uploadModal = Backbone.Model.extend({
|
||||||
|
|
||||||
options: {
|
options: {
|
||||||
close: true,
|
close: true,
|
||||||
type: "action",
|
type: 'action',
|
||||||
style: ["wide"],
|
style: ["wide"],
|
||||||
animation: 'fade',
|
animation: 'fade',
|
||||||
afterRender: function () {
|
afterRender: function () {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/*global window, document, Ghost, $, _, Backbone */
|
/*global window, document, Ghost, $, _, Backbone */
|
||||||
(function () {
|
(function () {
|
||||||
"use strict";
|
'use strict';
|
||||||
|
|
||||||
Ghost.Models.User = Backbone.Model.extend({
|
Ghost.Models.User = Backbone.Model.extend({
|
||||||
url: Ghost.settings.apiRoot + '/users/me/'
|
url: Ghost.settings.apiRoot + '/users/me/'
|
||||||
|
|
|
@ -1,15 +1,15 @@
|
||||||
/*global window, document, Ghost, $, _, Backbone */
|
/*global window, document, Ghost, $, _, Backbone */
|
||||||
(function () {
|
(function () {
|
||||||
"use strict";
|
'use strict';
|
||||||
|
|
||||||
Ghost.Models.Widget = Backbone.Model.extend({
|
Ghost.Models.Widget = Backbone.Model.extend({
|
||||||
|
|
||||||
defaults: {
|
defaults: {
|
||||||
title: "",
|
title: '',
|
||||||
name: "",
|
name: '',
|
||||||
author: "",
|
author: '',
|
||||||
applicationID: "",
|
applicationID: '',
|
||||||
size: "",
|
size: '',
|
||||||
content: {
|
content: {
|
||||||
template: '',
|
template: '',
|
||||||
data: {
|
data: {
|
||||||
|
@ -17,9 +17,9 @@
|
||||||
count: 0,
|
count: 0,
|
||||||
sub: {
|
sub: {
|
||||||
value: 0,
|
value: 0,
|
||||||
dir: "", // "up" or "down"
|
dir: '', // "up" or "down"
|
||||||
item: "",
|
item: '',
|
||||||
period: ""
|
period: ''
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,8 +28,8 @@
|
||||||
settingsPane: false,
|
settingsPane: false,
|
||||||
enabled: false,
|
enabled: false,
|
||||||
options: [{
|
options: [{
|
||||||
title: "ERROR",
|
title: 'ERROR',
|
||||||
value: "Widget options not set"
|
value: 'Widget options not set'
|
||||||
}]
|
}]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
/*global document, $, Ghost */
|
/*global document, $, Ghost */
|
||||||
(function () {
|
(function () {
|
||||||
"use strict";
|
'use strict';
|
||||||
|
|
||||||
Ghost.temporary.hideToggles = function () {
|
Ghost.temporary.hideToggles = function () {
|
||||||
$('[data-toggle]').each(function () {
|
$('[data-toggle]').each(function () {
|
||||||
|
@ -11,7 +11,7 @@
|
||||||
});
|
});
|
||||||
|
|
||||||
// Toggle active classes on menu headers
|
// Toggle active classes on menu headers
|
||||||
$("[data-toggle].active").removeClass("active");
|
$('[data-toggle].active').removeClass('active');
|
||||||
};
|
};
|
||||||
|
|
||||||
Ghost.temporary.initToggles = function ($el) {
|
Ghost.temporary.initToggles = function ($el) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue