diff --git a/ghost/admin/app.js b/ghost/admin/app.js index e40b0f9ce6..27671a09aa 100755 --- a/ghost/admin/app.js +++ b/ghost/admin/app.js @@ -10,33 +10,10 @@ var App = Ember.Application.extend({ LOG_TRANSITIONS: true, LOG_TRANSITIONS_INTERNAL: true, LOG_VIEW_LOOKUPS: true, - modulePrefix: 'ghost', // TODO: loaded via config + modulePrefix: 'ghost', Resolver: Resolver['default'] }); initFixtures(); -// TODO move into ext/route.js -// needed to add body class depending on current route -Ember.Route.reopen({ - activate: function () { - var cssClasses = this.get('classNames'), - rootElement = this.router.namespace.get('rootElement'); - - if (cssClasses) { - Ember.run.schedule('afterRender', null, function () { - Ember.$(rootElement).addClass(cssClasses); - }); - } - }, - deactivate: function () { - var cssClasses = this.get('classNames'), - rootElement = this.router.namespace.get('rootElement'); - - Ember.run.schedule('afterRender', null, function () { - Ember.$(rootElement).removeClass(cssClasses); - }); - } -}); - export default App; diff --git a/ghost/admin/components/code-mirror.js b/ghost/admin/components/-codemirror.js similarity index 71% rename from ghost/admin/components/code-mirror.js rename to ghost/admin/components/-codemirror.js index b41ece884e..5004559220 100644 --- a/ghost/admin/components/code-mirror.js +++ b/ghost/admin/components/-codemirror.js @@ -15,30 +15,30 @@ var onScrollHandler = function (cm) { }, 50); }; -export default Ember.TextArea.extend({ +var Codemirror = Ember.TextArea.extend({ initCodemirror: function () { // create codemirror this.codemirror = CodeMirror.fromTextArea(this.get('element'), { lineWrapping: true }); - this.codemirror.component = this; // save reference to this // propagate changes to value property - this.codemirror.on("change", onChangeHandler); + this.codemirror.on('change', onChangeHandler); // on scroll update scrollPosition property - this.codemirror.on("scroll", onScrollHandler); - }.on("didInsertElement"), + this.codemirror.on('scroll', onScrollHandler); + }.on('didInsertElement'), removeThrottle: function () { Ember.run.cancel(this.throttle); - }.on("willDestroyElement"), + }.on('willDestroyElement'), removeCodemirrorHandlers: function () { // not sure if this is needed. - this.codemirror.off("change", onChangeHandler); - this.codemirror.off("scroll", onScrollHandler); - }.on("willDestroyElement") + this.codemirror.off('change', onChangeHandler); + this.codemirror.off('scroll', onScrollHandler); + }.on('willDestroyElement') +}); -}); \ No newline at end of file +export default Codemirror; \ No newline at end of file diff --git a/ghost/admin/components/-markdown.js b/ghost/admin/components/-markdown.js new file mode 100644 index 0000000000..778bd940e2 --- /dev/null +++ b/ghost/admin/components/-markdown.js @@ -0,0 +1,11 @@ +var Markdown = Ember.Component.extend({ + adjustScrollPosition: function () { + var scrollWrapper = this.$('.entry-preview-content').get(0), + // calculate absolute scroll position from percentage + scrollPixel = scrollWrapper.scrollHeight * this.get('scrollPosition'); + + scrollWrapper.scrollTop = scrollPixel; // adjust scroll position + }.observes('scrollPosition') +}); + +export default Markdown; \ No newline at end of file diff --git a/ghost/admin/components/mark-down.js b/ghost/admin/components/mark-down.js deleted file mode 100644 index e33466f70a..0000000000 --- a/ghost/admin/components/mark-down.js +++ /dev/null @@ -1,8 +0,0 @@ -export default Ember.Component.extend({ - adjustScrollPosition: function () { - var scrollWrapper = this.$(".entry-preview-content").get(0), - scrollPixel = scrollWrapper.scrollHeight * this.get('scrollPosition'); // calculate absolute scroll position from percentage - - scrollWrapper.scrollTop = scrollPixel; // adjust scroll position - }.observes("scrollPosition") -}); \ No newline at end of file diff --git a/ghost/admin/controllers/posts/post.js b/ghost/admin/controllers/posts/post.js index 65a351c88d..f81406d23b 100644 --- a/ghost/admin/controllers/posts/post.js +++ b/ghost/admin/controllers/posts/post.js @@ -1,6 +1,8 @@ var equal = Ember.computed.equal; -export default Ember.ObjectController.extend({ +var PostController = Ember.ObjectController.extend({ isPublished: equal('status', 'published'), isDraft: equal('status', 'draft') -}); \ No newline at end of file +}); + +export default PostController; \ No newline at end of file diff --git a/ghost/admin/fixtures/init.js b/ghost/admin/fixtures/init.js index 976f7b81d7..9bdbb71924 100644 --- a/ghost/admin/fixtures/init.js +++ b/ghost/admin/fixtures/init.js @@ -11,14 +11,22 @@ var post = function (id) { var posts = function () { return { - response: postFixtures, + response: { + 'posts': postFixtures, + 'page': 1, + 'limit': 15, + 'pages': 1, + 'total': 2 + }, jqXHR: {}, textStatus: 'success' }; }; -export default function () { +var defineFixtures = function () { ic.ajax.defineFixture('/ghost/api/v0.1/posts', posts()); ic.ajax.defineFixture('/ghost/api/v0.1/posts/1', post(1)); ic.ajax.defineFixture('/ghost/api/v0.1/posts/2', post(2)); -} +}; + +export default defineFixtures; \ No newline at end of file diff --git a/ghost/admin/fixtures/posts.js b/ghost/admin/fixtures/posts.js index 3c40e103e2..f378605a29 100644 --- a/ghost/admin/fixtures/posts.js +++ b/ghost/admin/fixtures/posts.js @@ -1,24 +1,143 @@ -export default [ +var posts = [ { "id": 2, + "uuid": "4dc16b9e-bf90-44c9-97c5-40a0a81e8297", "title": "Ghost Ember Demo Post", + "slug": "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>", + "image": null, + "featured": 0, + "page": 0, "status": "draft", + "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, - "name": "manuel_mitasch" - } + "uuid": "ba9c67e4-8046-4b8c-9349-0eed3cca7529", + "name": "manuel_mitasch", + "slug": "manuel_mitasch", + "email": "manuel@cms.mine.nu", + "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": "manuel@cms.mine.nu", + "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": 1, + "uuid": "4b96025d-050c-47ff-8bd4-047e4843b302", "title": "Welcome to Ghost", + "slug": "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