Merge pull request #3575 from novaugust/about-ghost

About ghost page
This commit is contained in:
Hannah Wolfe 2014-09-02 21:17:16 +01:00
commit e00843851e
9 changed files with 151 additions and 7 deletions

2
.gitignore vendored
View File

@ -64,7 +64,9 @@ config.js
# Built asset files
/core/built
/core/client/assets/css
/core/client/assets/img/contributors/
/core/client/docs/dist/css
/core/client/templates/-contributors.hbs
# Coverage reports
coverage.html

View File

@ -5,10 +5,14 @@
// **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
var path = require('path'),
var _ = require('lodash'),
colors = require('colors'),
fs = require('fs'),
_ = require('lodash'),
fs = require('fs-extra'),
getTopContribs = require('top-gh-contribs'),
path = require('path'),
Promise = require('bluebird'),
request = require('request'),
escapeChar = process.platform.match(/^win/) ? '^' : '\\',
cwd = process.cwd().replace(/( |\(|\))/g, escapeChar + '$1'),
buildDirectory = path.resolve(cwd, '.build'),
@ -852,18 +856,67 @@ var path = require('path'),
// ### Ember Build *(Utility Task)*
// 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',
['clean:tmp', 'emberTemplates:dev', 'transpile', 'concat_sourcemap:dev']);
['clean:tmp', 'buildAboutPage', 'emberTemplates:dev', 'transpile', 'concat_sourcemap:dev']);
// ### Ember Build *(Utility Task)*
// 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',
['clean:tmp', 'emberTemplates:prod', 'transpile', 'concat_sourcemap:prod']);
['clean:tmp', 'buildAboutPage', 'emberTemplates:prod', 'transpile', 'concat_sourcemap:prod']);
// ### CSS Build *(Utility Task)*
// Build the CSS files from the SCSS files
grunt.registerTask('css', 'Build Client CSS',
['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
// `grunt init` - will run an initial asset build for you
//

View File

@ -33,6 +33,7 @@ Router.map(function () {
this.resource('settings.users', { path: '/users' }, function () {
this.route('user', { path: '/:slug' });
});
this.route('about');
});
this.route('debug');
//Redirect legacy content to posts

View 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;

View File

@ -14,6 +14,8 @@
{{gh-activating-list-item route="settings.users" title="Users" classNames="settings-menu-users"}}
{{/unless}}
{{gh-activating-list-item route="settings.about" title="About" classNames="settings-menu-about"}}
</ul>
</nav>

View 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 youre 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>

View File

@ -25,7 +25,7 @@ function ghostPaths() {
blogRoot: subdir + '/',
adminRoot: adminRoot,
apiRoot: apiRoot,
userImage: assetUrl('/assets/img/user-image.png'),
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',

View File

@ -0,0 +1,5 @@
import BaseView from 'ghost/views/settings/content-base';
var SettingsAboutView = BaseView.extend();
export default SettingsAboutView;

View File

@ -99,6 +99,7 @@
"require-dir": "~0.1.0",
"should": "~2.1.1",
"sinon": "~1.7.3",
"supertest": "~0.8.2"
"supertest": "~0.8.2",
"top-gh-contribs": "0.0.1"
}
}