mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-25 09:03:12 +03:00
Remove unused files
no issue - `app/helpers/gh-format-html` is duplicated in `lib/koenig-editor/addon/helpers/sanitize-html` and is not used anywhere else - `app/helpers/gh-path` is not used anywhere - the API should be returning absolute URLs everywhere so path generation is no longer as necessary within templates - `app/helpers/is-equal` replaced with `{{eq}}` from `ember-truth-helpers` - `app/helpers/is-not` replaced with `{{not}}` from `ember-truth-helpers` - `app/utils/isFinite` is not used anywhere - `app/utils/titleize` is not used anywhere
This commit is contained in:
parent
8e1f08f801
commit
0b649eaedd
@ -1,25 +0,0 @@
|
||||
/* global html_sanitize*/
|
||||
import cajaSanitizers from 'ghost-admin/utils/caja-sanitizers';
|
||||
import {helper} from '@ember/component/helper';
|
||||
import {htmlSafe} from '@ember/string';
|
||||
|
||||
export default helper(function (params) {
|
||||
if (!params || !params.length) {
|
||||
return;
|
||||
}
|
||||
|
||||
let escapedhtml = params[0] || '';
|
||||
|
||||
// replace script and iFrame
|
||||
escapedhtml = escapedhtml.replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,
|
||||
'<pre class="js-embed-placeholder">Embedded JavaScript</pre>');
|
||||
escapedhtml = escapedhtml.replace(/<iframe\b[^<]*(?:(?!<\/iframe>)<[^<]*)*<\/iframe>/gi,
|
||||
'<pre class="iframe-embed-placeholder">Embedded iFrame</pre>');
|
||||
|
||||
// sanitize HTML
|
||||
/* eslint-disable camelcase */
|
||||
escapedhtml = html_sanitize(escapedhtml, cajaSanitizers.url, cajaSanitizers.id);
|
||||
/* eslint-enable camelcase */
|
||||
|
||||
return htmlSafe(escapedhtml);
|
||||
});
|
@ -1,60 +0,0 @@
|
||||
import ghostPaths from 'ghost-admin/utils/ghost-paths';
|
||||
import {helper} from '@ember/component/helper';
|
||||
import {htmlSafe} from '@ember/string';
|
||||
|
||||
// Handlebars Helper {{gh-path}}
|
||||
// Usage: Assume 'http://www.myghostblog.org/myblog/'
|
||||
// {{gh-path}} or {{gh-path 'blog'}} for Ghost's root (/myblog/)
|
||||
// {{gh-path 'admin'}} for Ghost's admin root (/myblog/ghost/)
|
||||
// {{gh-path 'api'}} for Ghost's api root (/myblog/ghost/api/v0.1/)
|
||||
//
|
||||
// DO NOT USE - admin asset paths are now relative because we are using hash urls
|
||||
// and the gh-path helper can get in the way of asset rewriting
|
||||
// {{gh-path 'asset' '/img/hi.png'}} for resolved url (/myblog/ghost/assets/img/hi.png)
|
||||
|
||||
export default helper(function (params) {
|
||||
let paths = ghostPaths();
|
||||
let [path, url] = params;
|
||||
let base;
|
||||
|
||||
if (!path) {
|
||||
path = 'blog';
|
||||
}
|
||||
|
||||
if (!/^(blog|admin|asset|api)$/.test(path)) {
|
||||
url = path;
|
||||
path = 'blog';
|
||||
}
|
||||
|
||||
switch (path.toString()) {
|
||||
case 'blog':
|
||||
base = paths.blogRoot;
|
||||
break;
|
||||
case 'admin':
|
||||
base = paths.adminRoot;
|
||||
break;
|
||||
case 'asset':
|
||||
base = paths.assetRoot;
|
||||
break;
|
||||
case 'api':
|
||||
base = paths.apiRoot;
|
||||
break;
|
||||
default:
|
||||
base = paths.blogRoot;
|
||||
break;
|
||||
}
|
||||
|
||||
// handle leading and trailing slashes
|
||||
|
||||
base = base[base.length - 1] !== '/' ? `${base}/` : base;
|
||||
|
||||
if (url && url.length > 0) {
|
||||
if (url[0] === '/') {
|
||||
url = url.substr(1);
|
||||
}
|
||||
|
||||
base = base + url;
|
||||
}
|
||||
|
||||
return htmlSafe(base);
|
||||
});
|
@ -1,11 +0,0 @@
|
||||
import {helper} from '@ember/component/helper';
|
||||
|
||||
export function isEqual(params) {
|
||||
let [lhs, rhs] = params;
|
||||
|
||||
return lhs === rhs;
|
||||
}
|
||||
|
||||
export default helper(function (params) {
|
||||
return isEqual(params);
|
||||
});
|
@ -1,9 +0,0 @@
|
||||
import {helper} from '@ember/component/helper';
|
||||
|
||||
export function isNot(params) {
|
||||
return !params;
|
||||
}
|
||||
|
||||
export default helper(function (params) {
|
||||
return isNot(params);
|
||||
});
|
@ -1,7 +0,0 @@
|
||||
/* globals window */
|
||||
|
||||
// isFinite function from lodash
|
||||
|
||||
export default function (value) {
|
||||
return window.isFinite(value) && !window.isNaN(parseFloat(value));
|
||||
}
|
@ -1,18 +0,0 @@
|
||||
import {capitalize} from '@ember/string';
|
||||
const lowerWords = [
|
||||
'of', 'a', 'the', 'and', 'an', 'or', 'nor', 'but', 'is', 'if',
|
||||
'then', 'else', 'when', 'at', 'from', 'by', 'on', 'off', 'for',
|
||||
'in', 'out', 'over', 'to', 'into', 'with'
|
||||
];
|
||||
|
||||
export default function (input) {
|
||||
let words = input.split(' ').map((word, index) => {
|
||||
if (index === 0 || lowerWords.indexOf(word) === -1) {
|
||||
word = capitalize(word);
|
||||
}
|
||||
|
||||
return word;
|
||||
});
|
||||
|
||||
return words.join(' ');
|
||||
}
|
@ -1,17 +0,0 @@
|
||||
import {
|
||||
describe,
|
||||
it
|
||||
} from 'mocha';
|
||||
import {expect} from 'chai';
|
||||
import {
|
||||
isEqual
|
||||
} from 'ghost-admin/helpers/is-equal';
|
||||
|
||||
describe('Unit: Helper: is-equal', function () {
|
||||
// Replace this with your real tests.
|
||||
it('works', function () {
|
||||
let result = isEqual([42, 42]);
|
||||
|
||||
expect(result).to.be.ok;
|
||||
});
|
||||
});
|
@ -1,17 +0,0 @@
|
||||
import {
|
||||
describe,
|
||||
it
|
||||
} from 'mocha';
|
||||
import {expect} from 'chai';
|
||||
import {
|
||||
isNot
|
||||
} from 'ghost-admin/helpers/is-not';
|
||||
|
||||
describe('Unit: Helper: is-not', function () {
|
||||
// Replace this with your real tests.
|
||||
it('works', function () {
|
||||
let result = isNot(false);
|
||||
|
||||
expect(result).to.be.ok;
|
||||
});
|
||||
});
|
Loading…
Reference in New Issue
Block a user