mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-23 10:53:34 +03:00
Implement About Ghost page
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
This commit is contained in:
parent
245d859699
commit
737ea3f65e
2
.gitignore
vendored
2
.gitignore
vendored
@ -64,7 +64,9 @@ config.js
|
|||||||
# Built asset files
|
# Built asset files
|
||||||
/core/built
|
/core/built
|
||||||
/core/client/assets/css
|
/core/client/assets/css
|
||||||
|
/core/client/assets/img/contributors/
|
||||||
/core/client/docs/dist/css
|
/core/client/docs/dist/css
|
||||||
|
/core/client/templates/-contributors.hbs
|
||||||
|
|
||||||
# Coverage reports
|
# Coverage reports
|
||||||
coverage.html
|
coverage.html
|
||||||
|
63
Gruntfile.js
63
Gruntfile.js
@ -5,10 +5,14 @@
|
|||||||
// **Usage instructions:** can be found in the [Custom Tasks](#custom%20tasks) section or by running `grunt --help`.
|
// **Usage instructions:** can be found in the [Custom Tasks](#custom%20tasks) section or by running `grunt --help`.
|
||||||
//
|
//
|
||||||
// **Debug tip:** If you have any problems with any Grunt tasks, try running them with the `--verbose` command
|
// **Debug tip:** If you have any problems with any Grunt tasks, try running them with the `--verbose` command
|
||||||
var path = require('path'),
|
var _ = require('lodash'),
|
||||||
colors = require('colors'),
|
colors = require('colors'),
|
||||||
fs = require('fs'),
|
fs = require('fs-extra'),
|
||||||
_ = require('lodash'),
|
getTopContribs = require('top-gh-contribs'),
|
||||||
|
path = require('path'),
|
||||||
|
Promise = require('bluebird'),
|
||||||
|
request = require('request'),
|
||||||
|
|
||||||
escapeChar = process.platform.match(/^win/) ? '^' : '\\',
|
escapeChar = process.platform.match(/^win/) ? '^' : '\\',
|
||||||
cwd = process.cwd().replace(/( |\(|\))/g, escapeChar + '$1'),
|
cwd = process.cwd().replace(/( |\(|\))/g, escapeChar + '$1'),
|
||||||
buildDirectory = path.resolve(cwd, '.build'),
|
buildDirectory = path.resolve(cwd, '.build'),
|
||||||
@ -852,18 +856,67 @@ var path = require('path'),
|
|||||||
// ### Ember Build *(Utility Task)*
|
// ### Ember Build *(Utility Task)*
|
||||||
// All tasks related to building the Ember client code including transpiling ES6 modules and building templates
|
// All tasks related to building the Ember client code including transpiling ES6 modules and building templates
|
||||||
grunt.registerTask('emberBuildDev', 'Build Ember JS & templates for development',
|
grunt.registerTask('emberBuildDev', 'Build Ember JS & templates for development',
|
||||||
['clean:tmp', 'emberTemplates:dev', 'transpile', 'concat_sourcemap:dev']);
|
['clean:tmp', 'buildAboutPage', 'emberTemplates:dev', 'transpile', 'concat_sourcemap:dev']);
|
||||||
|
|
||||||
// ### Ember Build *(Utility Task)*
|
// ### Ember Build *(Utility Task)*
|
||||||
// All tasks related to building the Ember client code including transpiling ES6 modules and building templates
|
// All tasks related to building the Ember client code including transpiling ES6 modules and building templates
|
||||||
grunt.registerTask('emberBuildProd', 'Build Ember JS & templates for production',
|
grunt.registerTask('emberBuildProd', 'Build Ember JS & templates for production',
|
||||||
['clean:tmp', 'emberTemplates:prod', 'transpile', 'concat_sourcemap:prod']);
|
['clean:tmp', 'buildAboutPage', 'emberTemplates:prod', 'transpile', 'concat_sourcemap:prod']);
|
||||||
|
|
||||||
// ### CSS Build *(Utility Task)*
|
// ### CSS Build *(Utility Task)*
|
||||||
// Build the CSS files from the SCSS files
|
// Build the CSS files from the SCSS files
|
||||||
grunt.registerTask('css', 'Build Client CSS',
|
grunt.registerTask('css', 'Build Client CSS',
|
||||||
['sass', 'autoprefixer']);
|
['sass', 'autoprefixer']);
|
||||||
|
|
||||||
|
// ### Build About Page *(Utility Task)*
|
||||||
|
// Builds the github contributors partial template used on the Settings/About page,
|
||||||
|
// and downloads the avatar for each of the users.
|
||||||
|
// Run by any task that compiles the ember assets (emberBuildDev, emberBuildProd)
|
||||||
|
// or manually via `grunt buildAboutPage`.
|
||||||
|
// Change which version you're working against by setting the "releaseTag" below.
|
||||||
|
grunt.registerTask('buildAboutPage', 'Compile assets for the About Ghost page', function () {
|
||||||
|
var done = this.async();
|
||||||
|
|
||||||
|
grunt.verbose.writeln('Downloading release and contributor information from GitHub');
|
||||||
|
getTopContribs({
|
||||||
|
user: 'tryghost',
|
||||||
|
repo: 'ghost',
|
||||||
|
releaseTag: '0.4.2',
|
||||||
|
count: 20
|
||||||
|
}).then(function makeContributorTemplate(contributors) {
|
||||||
|
var contributorTemplate = '<li>\n\t<a href="<%githubUrl%>" title="<%name%>">\n' +
|
||||||
|
'\t\t<img src="{{unbound ghostPaths.contributorsDir}}/<%name%>" alt="<%name%>">\n' +
|
||||||
|
'\t</a>\n</li>';
|
||||||
|
|
||||||
|
grunt.verbose.writeln('Creating contributors template.');
|
||||||
|
grunt.file.write('core/client/templates/-contributors.hbs',
|
||||||
|
//Map contributors to the template.
|
||||||
|
_.map(contributors, function (contributor) {
|
||||||
|
return contributorTemplate
|
||||||
|
.replace(/<%githubUrl%>/g, contributor.githubUrl)
|
||||||
|
.replace(/<%name%>/g, contributor.name);
|
||||||
|
}).join('\n')
|
||||||
|
);
|
||||||
|
grunt.verbose.writeln('Downloading images for top contributors');
|
||||||
|
return Promise.promisify(fs.mkdirs)('core/client/assets/img/contributors').then(function () {
|
||||||
|
return contributors;
|
||||||
|
});
|
||||||
|
}).then(function downloadContributorImages(contributors) {
|
||||||
|
var downloadImagePromise = function (url, name) {
|
||||||
|
return new Promise(function (resolve, reject) {
|
||||||
|
request(url)
|
||||||
|
.pipe(fs.createWriteStream('core/client/assets/img/contributors/' + name))
|
||||||
|
.on('close', resolve)
|
||||||
|
.on('error', reject);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
return Promise.all(_.map(contributors, function (contributor) {
|
||||||
|
return downloadImagePromise(contributor.avatarUrl, contributor.name);
|
||||||
|
}));
|
||||||
|
}).catch(function (error) {
|
||||||
|
grunt.log.error(error);
|
||||||
|
}).finally(done);
|
||||||
|
});
|
||||||
// ### Init assets
|
// ### Init assets
|
||||||
// `grunt init` - will run an initial asset build for you
|
// `grunt init` - will run an initial asset build for you
|
||||||
//
|
//
|
||||||
|
@ -33,6 +33,7 @@ Router.map(function () {
|
|||||||
this.resource('settings.users', { path: '/users' }, function () {
|
this.resource('settings.users', { path: '/users' }, function () {
|
||||||
this.route('user', { path: '/:slug' });
|
this.route('user', { path: '/:slug' });
|
||||||
});
|
});
|
||||||
|
this.route('about');
|
||||||
});
|
});
|
||||||
this.route('debug');
|
this.route('debug');
|
||||||
//Redirect legacy content to posts
|
//Redirect legacy content to posts
|
||||||
|
25
core/client/routes/settings/about.js
Normal file
25
core/client/routes/settings/about.js
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
import loadingIndicator from 'ghost/mixins/loading-indicator';
|
||||||
|
|
||||||
|
var SettingsAboutRoute = Ember.Route.extend(SimpleAuth.AuthenticatedRouteMixin, loadingIndicator, {
|
||||||
|
cachedConfig: false,
|
||||||
|
model: function () {
|
||||||
|
var cachedConfig = this.get('cachedConfig'),
|
||||||
|
self = this;
|
||||||
|
if (cachedConfig) {
|
||||||
|
return cachedConfig;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ic.ajax.request(this.get('ghostPaths.url').api('configuration'))
|
||||||
|
.then(function (configurationResponse) {
|
||||||
|
var configKeyValues = configurationResponse.configuration;
|
||||||
|
cachedConfig = {};
|
||||||
|
configKeyValues.forEach(function (configKeyValue) {
|
||||||
|
cachedConfig[configKeyValue.key] = configKeyValue.value;
|
||||||
|
});
|
||||||
|
self.set('cachedConfig', cachedConfig);
|
||||||
|
return cachedConfig;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
export default SettingsAboutRoute;
|
@ -14,6 +14,8 @@
|
|||||||
{{gh-activating-list-item route="settings.users" title="Users" classNames="settings-menu-users"}}
|
{{gh-activating-list-item route="settings.users" title="Users" classNames="settings-menu-users"}}
|
||||||
|
|
||||||
{{/unless}}
|
{{/unless}}
|
||||||
|
|
||||||
|
{{gh-activating-list-item route="settings.about" title="About" classNames="settings-menu-about"}}
|
||||||
</ul>
|
</ul>
|
||||||
</nav>
|
</nav>
|
||||||
|
|
||||||
|
55
core/client/templates/settings/about.hbs
Normal file
55
core/client/templates/settings/about.hbs
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
<header class="settings-view-header">
|
||||||
|
<h2 class="page-title">About</h2>
|
||||||
|
<div class="settings-header-inner">
|
||||||
|
{{#link-to 'settings' class='btn btn-default btn-back'}}Back{{/link-to}}
|
||||||
|
</div>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<section class="content settings-about">
|
||||||
|
<section class="about-ghost-intro">
|
||||||
|
<h1>
|
||||||
|
<span class="ghost_logo">
|
||||||
|
<span class="hidden">Ghost</span>
|
||||||
|
</span>
|
||||||
|
<span class="version blue">v{{version}}</span>
|
||||||
|
</h1>
|
||||||
|
<p>A free, open, simple publishing platform</p>
|
||||||
|
|
||||||
|
<div class="about-environment-help clearfix">
|
||||||
|
<div class="about-environment">
|
||||||
|
<dl>
|
||||||
|
<dt>Version:</dt>
|
||||||
|
<dd class="about-environment-detail">{{version}}</dd>
|
||||||
|
<dt>Environment:</dt>
|
||||||
|
<dd class="about-environment-detail">{{environment}}</dd>
|
||||||
|
<dt>Database:</dt>
|
||||||
|
<dd class="about-environment-detail">{{database}}</dd>
|
||||||
|
<dt>Mail:</dt>
|
||||||
|
<dd class="about-environment-detail">{{#if mail}}{{mail}}{{else}}Native{{/if}}</dd>
|
||||||
|
</dl>
|
||||||
|
</div>
|
||||||
|
<div class="about-help">
|
||||||
|
<a href="http://support.ghost.org" class="btn">User Documentation</a>
|
||||||
|
<a href="https://ghost.org/forum/" class="btn">Get Help With Ghost</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section class="about-credits">
|
||||||
|
<h1>The People Who Made it Possible</h1>
|
||||||
|
|
||||||
|
<ul class="top-contributors clearfix">
|
||||||
|
{{partial "contributors"}}
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<p class="about-contributors-info">Ghost is built by an incredible group of contributors from all over the world. Here are just a few of the people who helped create the version you’re using right now.</p>
|
||||||
|
|
||||||
|
<a href="https://github.com/TryGhost/Ghost/blob/master/CONTRIBUTING.md" class="about-get-involved btn-blue btn-lg btn">Find out how you can get involved</a>
|
||||||
|
|
||||||
|
<p class="about-copyright">
|
||||||
|
Copyright 2013 - 2014 Ghost Foundation, released under the <a href="https://github.com/TryGhost/Ghost/blob/master/LICENSE">MIT license</a>.
|
||||||
|
<br>
|
||||||
|
<a href="https://ghost.org/">Ghost</a> is a trademark of the <a href="https://ghost.org/about/">Ghost Foundation</a>.
|
||||||
|
</p>
|
||||||
|
</section>
|
||||||
|
</section>
|
@ -25,7 +25,7 @@ function ghostPaths() {
|
|||||||
blogRoot: subdir + '/',
|
blogRoot: subdir + '/',
|
||||||
adminRoot: adminRoot,
|
adminRoot: adminRoot,
|
||||||
apiRoot: apiRoot,
|
apiRoot: apiRoot,
|
||||||
userImage: assetUrl('/assets/img/user-image.png'),
|
contributorsDir: assetUrl('/ghost/img/contributors'),
|
||||||
errorImageSrc: assetUrl('/ghost/img/404-ghost@2x.png'),
|
errorImageSrc: assetUrl('/ghost/img/404-ghost@2x.png'),
|
||||||
errorImageSrcSet: assetUrl('/ghost/img/404-ghost.png') + ' 1x, ' +
|
errorImageSrcSet: assetUrl('/ghost/img/404-ghost.png') + ' 1x, ' +
|
||||||
assetUrl('/ghost/img/404-ghost@2x.png') + ' 2x',
|
assetUrl('/ghost/img/404-ghost@2x.png') + ' 2x',
|
||||||
|
5
core/client/views/settings/about.js
Normal file
5
core/client/views/settings/about.js
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
import BaseView from 'ghost/views/settings/content-base';
|
||||||
|
|
||||||
|
var SettingsAboutView = BaseView.extend();
|
||||||
|
|
||||||
|
export default SettingsAboutView;
|
@ -99,6 +99,7 @@
|
|||||||
"require-dir": "~0.1.0",
|
"require-dir": "~0.1.0",
|
||||||
"should": "~2.1.1",
|
"should": "~2.1.1",
|
||||||
"sinon": "~1.7.3",
|
"sinon": "~1.7.3",
|
||||||
"supertest": "~0.8.2"
|
"supertest": "~0.8.2",
|
||||||
|
"top-gh-contribs": "0.0.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user