mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-21 18:01:36 +03:00
2b07773b8a
Closes #3568 - Deleted html placeholders in client - Added new grunt task, buildAboutPage, which 1)creates -contributors.hbs partial and 2) downloads contributor avatars - buildAboutPage is called by anything that does an emberTemplates task - Removed unused code from ghostpaths
48 lines
1.2 KiB
JavaScript
48 lines
1.2 KiB
JavaScript
var makeRoute = function (root, args) {
|
|
var parts = Array.prototype.slice.call(args, 0).join('/'),
|
|
route = [root, parts].join('/');
|
|
|
|
if (route.slice(-1) !== '/') {
|
|
route += '/';
|
|
}
|
|
|
|
return route;
|
|
};
|
|
|
|
|
|
function ghostPaths() {
|
|
var path = window.location.pathname,
|
|
subdir = path.substr(0, path.search('/ghost/')),
|
|
adminRoot = subdir + '/ghost',
|
|
apiRoot = subdir + '/ghost/api/v0.1';
|
|
|
|
function assetUrl(src) {
|
|
return subdir + src;
|
|
}
|
|
|
|
return {
|
|
subdir: subdir,
|
|
blogRoot: subdir + '/',
|
|
adminRoot: adminRoot,
|
|
apiRoot: apiRoot,
|
|
contributorsDir: assetUrl('/ghost/img/contributors'),
|
|
errorImageSrc: assetUrl('/ghost/img/404-ghost@2x.png'),
|
|
errorImageSrcSet: assetUrl('/ghost/img/404-ghost.png') + ' 1x, ' +
|
|
assetUrl('/ghost/img/404-ghost@2x.png') + ' 2x',
|
|
|
|
url: {
|
|
admin: function () {
|
|
return makeRoute(adminRoot, arguments);
|
|
},
|
|
|
|
api: function () {
|
|
return makeRoute(apiRoot, arguments);
|
|
},
|
|
|
|
asset: assetUrl
|
|
}
|
|
};
|
|
}
|
|
|
|
export default ghostPaths;
|