Skip to content

Commit

Permalink
Flesh out more of the Ember admin
Browse files Browse the repository at this point in the history
no issue

- this ports over screens from old admin to
 allow people to begin working on aspects of the screen

- All logged out screens have been imported: Signup, Signin,
 Forgotten password, reset password

- Those screens are now ready for behavior to be ported over

- This also updates templates to be more in line with how they were
 in the old admin

- Littered through the code are @todo comments of functionality that is
 missing and will need to be resolved before this is production ready

- Also scaffolds out the settings screen and every tab
  • Loading branch information
hswolff committed Mar 16, 2014
1 parent 22fe020 commit 3296a3a
Show file tree
Hide file tree
Showing 34 changed files with 568 additions and 60 deletions.
3 changes: 3 additions & 0 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -425,6 +425,9 @@ var path = require('path'),
},
test: {
src: ['content/data/ghost-test.db']
},
tmp: {
src: ['.tmp/**']
}
},

Expand Down
2 changes: 1 addition & 1 deletion core/client/controllers/application.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
var ApplicationController = Ember.Controller.extend({
isLogin: Ember.computed.equal('currentPath', 'login')
isLoggedOut: Ember.computed.match('currentPath', /(signin|signup|forgotten|reset)/)
});

export default ApplicationController;
132 changes: 129 additions & 3 deletions core/client/fixtures/posts.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,135 @@
var posts = [
{
"id": 2,
"id": 4,
"uuid": "4dc16b9e-bf90-44c9-97c5-40a0a81e8297",
"title": "This post is featured",
"slug": "this-post-is-featured",
"markdown": "Lorem **ipsum** dolor sit amet, consectetur adipiscing elit. Fusce id felis nec est suscipit scelerisque vitae eu arcu. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Aliquam erat volutpat. Sed pellentesque metus vel velit tincidunt aliquet. Nunc condimentum tempus convallis. Sed tincidunt, leo et congue blandit, lorem tortor imperdiet sapien, et porttitor turpis nisl sed tellus. In ultrices urna sit amet mauris suscipit adipiscing.",
"html": "<p>Lorem <strong>ipsum<\/strong> dolor sit amet, consectetur adipiscing elit. Fusce id felis nec est suscipit scelerisque vitae eu arcu. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Aliquam erat volutpat. Sed pellentesque metus vel velit tincidunt aliquet. Nunc condimentum tempus convallis. Sed tincidunt, leo et congue blandit, lorem tortor imperdiet sapien, et porttitor turpis nisl sed tellus. In ultrices urna sit amet mauris suscipit adipiscing.<\/p>",
"image": null,
"featured": 1,
"page": 0,
"status": "published",
"language": "en_US",
"meta_title": null,
"meta_description": null,
"author_id": 1,
"created_at": "2014-02-15T23:27:08.000Z",
"created_by": 1,
"updated_at": "2014-02-15T23:27:08.000Z",
"updated_by": 1,
"published_at": "2014-02-15T23:27:08.000Z",
"published_by": 1,
"author": {
"id": 1,
"uuid": "ba9c67e4-8046-4b8c-9349-0eed3cca7529",
"name": "Bill Murray",
"slug": "manuel_mitasch",
"email": "[email protected]",
"image": null,
"cover": null,
"bio": null,
"website": null,
"location": null,
"accessibility": null,
"status": "active",
"language": "en_US",
"meta_title": null,
"meta_description": null,
"created_at": "2014-02-15T20:02:25.000Z",
"updated_at": "2014-02-15T20:02:25.000Z"
},
"user": {
"id": 1,
"uuid": "ba9c67e4-8046-4b8c-9349-0eed3cca7529",
"name": "manuel_mitasch",
"slug": "manuel_mitasch",
"email": "[email protected]",
"image": null,
"cover": null,
"bio": null,
"website": null,
"location": null,
"accessibility": null,
"status": "active",
"language": "en_US",
"meta_title": null,
"meta_description": null,
"created_at": "2014-02-15T20:02:25.000Z",
"updated_at": "2014-02-15T20:02:25.000Z"
},
"tags": [

]
},
{
"id": 3,
"uuid": "4dc16b9e-bf90-44c9-97c5-40a0a81e8297",
"title": "Ghost Ember Demo Post",
"slug": "ghost-ember-demo-post",
"title": "Example page entry",
"slug": "example-page-entry",
"markdown": "Lorem **ipsum** dolor sit amet, consectetur adipiscing elit. Fusce id felis nec est suscipit scelerisque vitae eu arcu. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Aliquam erat volutpat. Sed pellentesque metus vel velit tincidunt aliquet. Nunc condimentum tempus convallis. Sed tincidunt, leo et congue blandit, lorem tortor imperdiet sapien, et porttitor turpis nisl sed tellus. In ultrices urna sit amet mauris suscipit adipiscing.",
"html": "<p>Lorem <strong>ipsum<\/strong> dolor sit amet, consectetur adipiscing elit. Fusce id felis nec est suscipit scelerisque vitae eu arcu. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Aliquam erat volutpat. Sed pellentesque metus vel velit tincidunt aliquet. Nunc condimentum tempus convallis. Sed tincidunt, leo et congue blandit, lorem tortor imperdiet sapien, et porttitor turpis nisl sed tellus. In ultrices urna sit amet mauris suscipit adipiscing.<\/p>",
"image": null,
"featured": 0,
"page": 1,
"status": "published",
"language": "en_US",
"meta_title": null,
"meta_description": null,
"author_id": 1,
"created_at": "2014-02-15T23:27:08.000Z",
"created_by": 1,
"updated_at": "2014-02-15T23:27:08.000Z",
"updated_by": 1,
"published_at": null,
"published_by": null,
"author": {
"id": 1,
"uuid": "ba9c67e4-8046-4b8c-9349-0eed3cca7529",
"name": "Slimer",
"slug": "manuel_mitasch",
"email": "[email protected]",
"image": null,
"cover": null,
"bio": null,
"website": null,
"location": null,
"accessibility": null,
"status": "active",
"language": "en_US",
"meta_title": null,
"meta_description": null,
"created_at": "2014-02-15T20:02:25.000Z",
"updated_at": "2014-02-15T20:02:25.000Z"
},
"user": {
"id": 1,
"uuid": "ba9c67e4-8046-4b8c-9349-0eed3cca7529",
"name": "manuel_mitasch",
"slug": "manuel_mitasch",
"email": "[email protected]",
"image": null,
"cover": null,
"bio": null,
"website": null,
"location": null,
"accessibility": null,
"status": "active",
"language": "en_US",
"meta_title": null,
"meta_description": null,
"created_at": "2014-02-15T20:02:25.000Z",
"updated_at": "2014-02-15T20:02:25.000Z"
},
"tags": [

]
},
{
"id": 2,
"uuid": "4dc1cb9e-bf90-44c9-97c5-40a8381e8297",
"title": "Dummy draft post",
"slug": "dummy-draft-post",
"markdown": "Lorem **ipsum** dolor sit amet, consectetur adipiscing elit. Fusce id felis nec est suscipit scelerisque vitae eu arcu. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Aliquam erat volutpat. Sed pellentesque metus vel velit tincidunt aliquet. Nunc condimentum tempus convallis. Sed tincidunt, leo et congue blandit, lorem tortor imperdiet sapien, et porttitor turpis nisl sed tellus. In ultrices urna sit amet mauris suscipit adipiscing.",
"html": "<p>Lorem <strong>ipsum<\/strong> dolor sit amet, consectetur adipiscing elit. Fusce id felis nec est suscipit scelerisque vitae eu arcu. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Aliquam erat volutpat. Sed pellentesque metus vel velit tincidunt aliquet. Nunc condimentum tempus convallis. Sed tincidunt, leo et congue blandit, lorem tortor imperdiet sapien, et porttitor turpis nisl sed tellus. In ultrices urna sit amet mauris suscipit adipiscing.<\/p>",
"image": null,
Expand Down
2 changes: 1 addition & 1 deletion core/client/helpers/count-words.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import count from 'ghost/utils/word-count';

var countWords = Ember.Handlebars.makeBoundHelper(function (markdown) {
return count(markdown);
return count(markdown || '');
});

export default countWords;
2 changes: 1 addition & 1 deletion core/client/helpers/format-markdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
var showdown = new Showdown.converter();

var formatMarkdown = Ember.Handlebars.makeBoundHelper(function (markdown) {
return new Handlebars.SafeString(showdown.makeHtml(markdown));
return new Handlebars.SafeString(showdown.makeHtml(markdown || ''));
});

export default formatMarkdown;
11 changes: 10 additions & 1 deletion core/client/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,21 @@ Router.reopen({
});

Router.map(function () {
this.route('login', { path: '/signin' });
this.route('signin');
this.route('signup');
this.route('forgotten');
this.route('reset');
this.resource('posts', { path: '/' }, function () {
this.route('post', { path: ':post_id' });
});
this.resource('editor', { path: '/editor/:post_id' });
this.route('new', { path: '/editor' });
this.resource('settings', function () {
this.route('general');
this.route('user');
this.route('debug');
this.route('apps');
});
});

export default Router;
2 changes: 1 addition & 1 deletion core/client/routes/authenticated.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ var AuthenticatedRoute = Ember.Route.extend({
actions: {
error: function (error) {
if (error.jqXHR.status === 401) {
this.transitionTo('login');
this.transitionTo('signin');
}
}
}
Expand Down
7 changes: 7 additions & 0 deletions core/client/routes/forgotten.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import styleBody from 'ghost/mixins/style-body';

var ForgottenRoute = Ember.Route.extend(styleBody, {
classNames: ['ghost-forgotten']
});

export default ForgottenRoute;
12 changes: 12 additions & 0 deletions core/client/routes/new.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import styleBody from 'ghost/mixins/style-body';
import AuthenticatedRoute from 'ghost/routes/authenticated';

var NewRoute = AuthenticatedRoute.extend(styleBody, {
classNames: ['editor'],

renderTemplate: function () {
this.render('editor');
}
});

export default NewRoute;
7 changes: 7 additions & 0 deletions core/client/routes/reset.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import styleBody from 'ghost/mixins/style-body';

var ResetRoute = Ember.Route.extend(styleBody, {
classNames: ['ghost-reset']
});

export default ResetRoute;
8 changes: 8 additions & 0 deletions core/client/routes/settings.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import styleBody from 'ghost/mixins/style-body';
import AuthenticatedRoute from 'ghost/routes/authenticated';

var SettingsRoute = AuthenticatedRoute.extend(styleBody, {
classNames: ['settings']
});

export default SettingsRoute;
8 changes: 8 additions & 0 deletions core/client/routes/settings/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
var SettingsIndexRoute = Ember.Route.extend({
// redirect to general tab
redirect: function () {
this.transitionTo('settings.general');
}
});

export default SettingsIndexRoute;
4 changes: 2 additions & 2 deletions core/client/routes/login.js → core/client/routes/signin.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import styleBody from 'ghost/mixins/style-body';

var isEmpty = Ember.isEmpty;

var LoginRoute = Ember.Route.extend(styleBody, {
var SigninRoute = Ember.Route.extend(styleBody, {
classNames: ['ghost-login'],

actions: {
Expand All @@ -29,4 +29,4 @@ var LoginRoute = Ember.Route.extend(styleBody, {
}
});

export default LoginRoute;
export default SigninRoute;
7 changes: 7 additions & 0 deletions core/client/routes/signup.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import styleBody from 'ghost/mixins/style-body';

var SignupRoute = Ember.Route.extend(styleBody, {
classNames: ['ghost-signup']
});

export default SignupRoute;
8 changes: 5 additions & 3 deletions core/client/templates/-floating-header.hbs
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
<header class="floatingheader">
<button class="button-back" href="#">Back</button>
<a class="unfeatured" href="#" title="Feature this post">
{{!-- @TODO: add back title updates depending on featured state --}}
<a {{bind-attr class="featured:featured:unfeatured"}} href="#" title="Feature this post">
<span class="hidden">Star</span>
</a>
<small>
<span class="status">Written</span>
{{!-- @TODO: the if published doesn't seem to work, needs to be fixed --}}
<span class="status">{{#if published}}Published{{else}}Written{{/if}}</span>
<span class="normal">by</span>
<span class="author">{{author.name}}</span>
<span class="author">{{#if author.name}}{{author.name}}{{else}}{{author.email}}{{/if}}</span>
</small>
<section class="post-controls">
{{#link-to "editor" this class="post-edit" title="Edit Post"}}
Expand Down
35 changes: 32 additions & 3 deletions core/client/templates/-navbar.hbs
Original file line number Diff line number Diff line change
@@ -1,8 +1,37 @@
<header id="global-header" class="navbar">
<a class="ghost-logo" href="/" data-off-canvas="left" title="/">
<span class="hidden">Ghost </span>
</a>
<nav id="global-nav" role="navigation">
<ul id="main-menu" >
<li class="content">{{#link-to "posts"}}Content{{/link-to}}</li>
<li class="editor">{{#link-to "new"}}New post{{/link-to}}</li>
{{!-- @TODO: don't nest link-to attributes
currently required to get proper class styling --}}
{{#link-to "posts" class="content" tagName="li" disabled=true}}
{{#link-to "posts"}}Content{{/link-to}}
{{/link-to}}
{{#link-to "new" class="editor" tagName="li" disabled=true}}
{{#link-to "new"}}New post{{/link-to}}
{{/link-to}}
{{#link-to "settings" class="settings" tagName="li" disabled=true}}
{{#link-to "settings"}}Settings{{/link-to}}
{{/link-to}}

<li id="usermenu" class="usermenu subnav">
<a href="#" class="dropdown">
{{!-- @TODO: show avatar of logged in user --}}
<img class="avatar" src="/shared/img/user-image.png" alt="Avatar" />
{{!-- @TODO: show logged in user name or email --}}
<span class="name">Fake Ghost</span>
</a>
{{!-- @TODO: add functionality to allow for dropdown to work --}}
<ul class="overlay">
<li class="usermenu-profile"><a href="#">Your Profile</a></li>
<li class="divider"></li>
<li class="usermenu-help"><a href="http://ghost.org/forum/">Help / Support</a></li>
<li class="divider"></li>
<li class="usermenu-signout"><a href="#">Sign Out</a></li>
</ul>
</li>
</ul>
</nav>
</header>
</header>
5 changes: 3 additions & 2 deletions core/client/templates/-publish-bar.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<nav>
<section id="entry-tags" href="#" class="left">
<label class="tag-label" for="tags" title="Tags"><span class="hidden">Tags</span></label>
<div class="tags">Nothing implemented</div>
<div class="tags"></div>
<input type="hidden" class="tags-holder" id="tags-holder">
<input class="tag-input" id="tags" type="text" data-input-behaviour="tag" />
<ul class="suggestions overlay"></ul>
Expand Down Expand Up @@ -46,8 +46,9 @@
</section>

<section id="entry-actions" class="js-publish-splitbutton splitbutton-save">
<button type="button" class="js-publish-button button-save"></button>
<button type="button" class="js-publish-button button-save">Save Draft</button>
<a class="options up" data-toggle="ul" href="#" title="Post Settings"><span class="hidden">Post Settings</span></a>
{{!-- @TODO: implement popover --}}
<ul class="editor-options overlay" style="display:none">
<li data-set-status="published"><a href="#"></a></li>
<li data-set-status="draft"><a href="#"></a></li>
Expand Down
2 changes: 1 addition & 1 deletion core/client/templates/application.hbs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{#unless isLogin}}
{{#unless isLoggedOut}}
{{partial "navbar"}}
{{/unless}}

Expand Down
8 changes: 3 additions & 5 deletions core/client/templates/components/-markdown.hbs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
<section class="entry-preview-content">
<div class="rendered-markdown">
{{format-markdown markdown}}
</div>
</section>
<div class="rendered-markdown">
{{format-markdown markdown}}
</div>
4 changes: 3 additions & 1 deletion core/client/templates/editor.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@
<header class="floatingheader">
<small>Preview <span class="entry-word-count js-entry-word-count">{{count-words markdown}} words</span></small>
</header>
{{-markdown markdown=markdown scrollPosition=view.scrollPosition}}
<section class="entry-preview-content">
{{-markdown markdown=markdown scrollPosition=view.scrollPosition}}
</section>
</section>
</section>

Expand Down
8 changes: 8 additions & 0 deletions core/client/templates/forgotten.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<section class="forgotten-box js-forgotten-box">
<form id="forgotten" class="forgotten-form" method="post" novalidate="novalidate">
<div class="email-wrap">
<input class="email" type="email" placeholder="Email Address" name="email" autocapitalize="off" autocorrect="off">
</div>
<button class="button-save" type="submit">Send new password</button>
</form>
</section>
Loading

0 comments on commit 3296a3a

Please sign in to comment.