From 01b49fede8ef9f43016fb8caf1e6e4b8b260b20d Mon Sep 17 00:00:00 2001 From: Taras Mankovski Date: Sun, 2 Mar 2014 15:12:06 -0500 Subject: [PATCH] Minor refactoring of the routers: - Moved post route under posts resource - Changed ajax to use ic.ajax.request instead of ic.ajax.raw --- ghost/admin/app.js | 36 ++------------------- ghost/admin/controllers/{ => posts}/post.js | 0 ghost/admin/fixtures/init.js | 24 ++++++++++++++ ghost/admin/fixtures/posts.js | 24 ++++++++++++++ ghost/admin/models/.gitkeep | 0 ghost/admin/models/post.js | 5 +++ ghost/admin/router.js | 2 +- ghost/admin/routes/posts/index.js | 4 +-- ghost/admin/routes/posts/post.js | 7 ++++ ghost/admin/templates/posts.hbs | 5 ++- ghost/admin/templates/{ => posts}/post.hbs | 0 ghost/admin/utils/ajax.js | 6 ++-- 12 files changed, 70 insertions(+), 43 deletions(-) rename ghost/admin/controllers/{ => posts}/post.js (100%) create mode 100644 ghost/admin/fixtures/init.js create mode 100644 ghost/admin/fixtures/posts.js delete mode 100644 ghost/admin/models/.gitkeep create mode 100644 ghost/admin/models/post.js create mode 100644 ghost/admin/routes/posts/post.js rename ghost/admin/templates/{ => posts}/post.hbs (100%) diff --git a/ghost/admin/app.js b/ghost/admin/app.js index 3df79d1e80..e40b0f9ce6 100755 --- a/ghost/admin/app.js +++ b/ghost/admin/app.js @@ -1,6 +1,5 @@ -/*global Ember, ic */ - import Resolver from 'ember/resolver'; +import initFixtures from 'ghost/fixtures/init'; var App = Ember.Application.extend({ /** @@ -15,6 +14,7 @@ var App = Ember.Application.extend({ Resolver: Resolver['default'] }); +initFixtures(); // TODO move into ext/route.js // needed to add body class depending on current route @@ -39,36 +39,4 @@ Ember.Route.reopen({ } }); - -ic.ajax.defineFixture('/ghost/api/v0.1/posts', { - response: { - "posts": [ - { - "id": 2, - "title": "Ghost Ember Demo 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": "

Lorem 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>", - "status": "draft", - "author": { - "id": 1, - "name": "manuel_mitasch", - }, - }, - { - "id": 1, - "title": "Welcome to Ghost", - "markdown": "You're live! Nice. We've put together a little post to introduce you to the Ghost editor and get you started. You can manage your content by signing in to the admin area at `\/ghost\/`. When you arrive, you can select this post from a list on the left and see a preview of it on the right. Click the little pencil icon at the top of the preview to edit this post and read the next section!\n\n## Getting Started\n\nGhost uses something called Markdown for writing. Essentially, it's a shorthand way to manage your post formatting as you write!\n\nWriting in Markdown is really easy. In the left hand panel of Ghost, you simply write as you normally would. Where appropriate, you can use *shortcuts* to **style** your content. For example, a list:\n\n* Item number one\n* Item number two\n * A nested item\n* A final item\n\nor with numbers!\n\n1. Remember to buy some milk\n2. Drink the milk\n3. Tweet that I remembered to buy the milk, and drank it\n\n### Links\n\nWant to link to a source? No problem. If you paste in url, like http:\/\/ghost.org - it'll automatically be linked up. But if you want to customise your anchor text, you can do that too! Here's a link to [the Ghost website](http:\/\/ghost.org). Neat.\n\n### What about Images?\n\nImages work too! Already know the URL of the image you want to include in your article? Simply paste it in like this to make it show up:\n\n![The Ghost Logo](https:\/\/ghost.org\/images\/ghost.png)\n\nNot sure which image you want to use yet? That's ok too. Leave yourself a descriptive placeholder and keep writing. Come back later and drag and drop the image in to upload:\n\n![A bowl of bananas]\n\n\n### Quoting\n\nSometimes a link isn't enough, you want to quote someone on what they've said. It was probably very wisdomous. Is wisdomous a word? Find out in a future release when we introduce spellcheck! For now - it's definitely a word.\n\n> Wisdomous - it's definitely a word.\n\n### Working with Code\n\nGot a streak of geek? We've got you covered there, too. You can write inline `` blocks really easily with back ticks. Want to show off something more comprehensive? 4 spaces of indentation gets you there.\n\n .awesome-thing {\n display: block;\n width: 100%;\n }\n\n### Ready for a Break? \n\nThrow 3 or more dashes down on any new line and you've got yourself a fancy new divider. Aw yeah.\n\n---\n\n### Advanced Usage\n\nThere's one fantastic secret about Markdown. If you want, you can write plain old HTML and it'll still work! Very flexible.\n\n\n\nThat should be enough to get you started. Have fun - and let us know what you think :)", - "html": "

You're live! Nice. We've put together a little post to introduce you to the Ghost editor and get you started. You can manage your content by signing in to the admin area at <your blog URL>\/ghost\/<\/code>. When you arrive, you can select this post from a list on the left and see a preview of it on the right. Click the little pencil icon at the top of the preview to edit this post and read the next section!<\/p>\n\n

Getting Started<\/h2>\n\n

Ghost uses something called Markdown for writing. Essentially, it's a shorthand way to manage your post formatting as you write!<\/p>\n\n

Writing in Markdown is really easy. In the left hand panel of Ghost, you simply write as you normally would. Where appropriate, you can use shortcuts<\/em> to style<\/strong> your content. For example, a list:<\/p>\n\n