From 61db2dc33555ef6b79fa42400e45424aa97faeb7 Mon Sep 17 00:00:00 2001 From: Renyu Liu Date: Wed, 9 Apr 2014 01:41:21 +0800 Subject: [PATCH 1/6] OSX shortcut fix. closes #2573 - separate different shortcuts by OS detection in markdownEditor.js --- .../admin/assets/lib/editor/markdownEditor.js | 25 +++++++++++-------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/ghost/admin/assets/lib/editor/markdownEditor.js b/ghost/admin/assets/lib/editor/markdownEditor.js index 65a864e948..050a69de29 100644 --- a/ghost/admin/assets/lib/editor/markdownEditor.js +++ b/ghost/admin/assets/lib/editor/markdownEditor.js @@ -10,10 +10,6 @@ MarkdownEditor; MarkdownShortcuts = [ - {'key': 'Ctrl+B', 'style': 'bold'}, - {'key': 'Meta+B', 'style': 'bold'}, - {'key': 'Ctrl+I', 'style': 'italic'}, - {'key': 'Meta+I', 'style': 'italic'}, {'key': 'Ctrl+Alt+U', 'style': 'strike'}, {'key': 'Ctrl+Shift+K', 'style': 'code'}, {'key': 'Meta+K', 'style': 'code'}, @@ -31,13 +27,22 @@ {'key': 'Ctrl+Shift+U', 'style': 'lowercase'}, {'key': 'Ctrl+Alt+Shift+U', 'style': 'titlecase'}, {'key': 'Ctrl+Alt+W', 'style': 'selectword'}, - {'key': 'Ctrl+L', 'style': 'list'}, - {'key': 'Ctrl+Alt+C', 'style': 'copyHTML'}, - {'key': 'Meta+Alt+C', 'style': 'copyHTML'}, - {'key': 'Meta+Enter', 'style': 'newLine'}, - {'key': 'Ctrl+Enter', 'style': 'newLine'} + {'key': 'Ctrl+L', 'style': 'list'} ]; + if (navigator.userAgent.indexOf('Mac') !== -1) { + MarkdownShortcuts.push({'key': 'Meta+B', 'style': 'bold'}); + MarkdownShortcuts.push({'key': 'Meta+I', 'style': 'italic'}); + MarkdownShortcuts.push({'key': 'Meta+Alt+C', 'style': 'copyHTML'}); + MarkdownShortcuts.push({'key': 'Meta+Enter', 'style': 'newLine'}); + } else { + MarkdownShortcuts.push({'key': 'Ctrl+B', 'style': 'bold'}); + MarkdownShortcuts.push({'key': 'Ctrl+I', 'style': 'italic'}); + MarkdownShortcuts.push({'key': 'Ctrl+Alt+C', 'style': 'copyHTML'}); + MarkdownShortcuts.push({'key': 'Ctrl+Enter', 'style': 'newLine'}); + + } + MarkdownEditor = function () { var codemirror = CodeMirror.fromTextArea(document.getElementById('entry-markdown'), { mode: 'gfm', @@ -92,4 +97,4 @@ Ghost.Editor = Ghost.Editor || {}; Ghost.Editor.MarkdownEditor = MarkdownEditor; -} ()); \ No newline at end of file +} ()); From 91a0c7c666985947b74aab5dfd1d4c28733c0220 Mon Sep 17 00:00:00 2001 From: Peter Szel Date: Fri, 4 Apr 2014 03:59:09 +0200 Subject: [PATCH 2/6] Added email sending endpoint to the API. closes #2550 - Added new API module named 'mail' - Added routes for the mail endpoint - Added 'send a test email' button to the debug settigns page - Added handler to this button which sends and AJAX request to the mail API endpoint --- ghost/admin/views/debug.js | 34 ++++++++++++++++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) diff --git a/ghost/admin/views/debug.js b/ghost/admin/views/debug.js index e08e2b5c8a..e3333a15d4 100644 --- a/ghost/admin/views/debug.js +++ b/ghost/admin/views/debug.js @@ -6,7 +6,8 @@ events: { "click .settings-menu a": "handleMenuClick", "click #startupload": "handleUploadClick", - "click .js-delete": "handleDeleteClick" + "click .js-delete": "handleDeleteClick", + "click #sendtestmail": "handleSendTestMailClick" }, initialize: function () { @@ -154,6 +155,35 @@ } } })); - } + }, + + handleSendTestMailClick: function (ev) { + ev.preventDefault(); + + $.ajax({ + url: Ghost.paths.apiRoot + '/mail/test/', + type: 'POST', + headers: { + 'X-CSRF-Token': $("meta[name='csrf-param']").attr('content') + }, + success: function onSuccess(response) { + Ghost.notifications.addItem({ + type: 'success', + message: ['Check your email for the test message: ', response.message].join(''), + status: 'passive' + }); + }, + error: function onError(response) { + var responseText = JSON.parse(response.responseText), + message = responseText && responseText.error ? responseText.error : 'unknown'; + Ghost.notifications.addItem({ + type: 'error', + message: ['A problem was encountered while sending the test email: ', message].join(''), + status: 'passive' + }); + + } + }); + }, }); }()); From 3dbd11994cb2a1d8c06e8632ab43bb2f3cd3929c Mon Sep 17 00:00:00 2001 From: Jason Williams Date: Mon, 14 Apr 2014 16:18:17 +0000 Subject: [PATCH 3/6] Set input field types to match expected input values ref #2588 - Change name field in User Profile to be type text - Change website field in User Profile to be type url --- ghost/admin/tpl/settings/user-profile.hbs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ghost/admin/tpl/settings/user-profile.hbs b/ghost/admin/tpl/settings/user-profile.hbs index d543529f87..48336cd88d 100644 --- a/ghost/admin/tpl/settings/user-profile.hbs +++ b/ghost/admin/tpl/settings/user-profile.hbs @@ -25,7 +25,7 @@
- +

Use your real name so people can recognise you

@@ -47,7 +47,7 @@
- +

Have a website or blog other than this one? Link it!

From ff5ae21a9ee68229c01af6ea505c30df516f512c Mon Sep 17 00:00:00 2001 From: Sebastian Gierlinger Date: Wed, 16 Apr 2014 12:09:03 +0200 Subject: [PATCH 4/6] Move post API to primary document format MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit closes #2580 - added new format to post API methods - added post object parsing and wrapping to admin - removed unused ‚user‘ object from API response - updated tests --- ghost/admin/models/post.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/ghost/admin/models/post.js b/ghost/admin/models/post.js index 157eb8e59d..26f5c792fa 100644 --- a/ghost/admin/models/post.js +++ b/ghost/admin/models/post.js @@ -1,4 +1,4 @@ -/*global Ghost, _, Backbone */ +/*global Ghost, _, Backbone, JSON */ (function () { 'use strict'; @@ -11,6 +11,10 @@ blacklist: ['published', 'draft'], parse: function (resp) { + + if (resp.posts) { + resp = resp.posts[0]; + } if (resp.status) { resp.published = resp.status === 'published'; resp.draft = resp.status === 'draft'; @@ -39,6 +43,15 @@ return tag.id === tagToRemove.id || tag.name === tagToRemove.name; }); this.set('tags', tags); + }, + sync: function (method, model, options) { + //wrap post in {posts: [{...}]} + if (method === 'create' || method === 'update') { + options.data = JSON.stringify({posts: [this.attributes]}); + options.contentType = 'application/json'; + } + + return Backbone.Model.prototype.sync.apply(this, arguments); } }); From 52197d3a389be111a6800e7c8d1136e80f829217 Mon Sep 17 00:00:00 2001 From: Sebastian Gierlinger Date: Sat, 19 Apr 2014 17:03:20 +0200 Subject: [PATCH 5/6] Post response move pagination -> meta MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit closes #2604 - moved ‚pagination‘ to ‚meta‘ property - added response test for pagination property - changed ‚next‘ and ‚prev‘ to be set to null and exist on every response - removed unnecessary call to API for RSS author --- ghost/admin/models/post.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/ghost/admin/models/post.js b/ghost/admin/models/post.js index 26f5c792fa..f39a1b3280 100644 --- a/ghost/admin/models/post.js +++ b/ghost/admin/models/post.js @@ -67,12 +67,12 @@ parse: function (resp) { if (_.isArray(resp.posts)) { - this.limit = resp.limit; - this.currentPage = resp.page; - this.totalPages = resp.pages; - this.totalPosts = resp.total; - this.nextPage = resp.next; - this.prevPage = resp.prev; + this.limit = resp.meta.pagination.limit; + this.currentPage = resp.meta.pagination.page; + this.totalPages = resp.meta.pagination.pages; + this.totalPosts = resp.meta.pagination.total; + this.nextPage = resp.meta.pagination.next; + this.prevPage = resp.meta.pagination.prev; return resp.posts; } return resp; From 5ddfe279f1e6d097113c303333198a741bf5f0dd Mon Sep 17 00:00:00 2001 From: Jacob Gable Date: Sun, 20 Apr 2014 19:48:59 -0500 Subject: [PATCH 6/6] Tag API: Primary Document Format Closes #2605 - Change tags browse() response to { tags: [...] } - Update client side collection to use nested tags document - Update test references to use response.tags --- ghost/admin/models/tag.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ghost/admin/models/tag.js b/ghost/admin/models/tag.js index 879396a056..9803905487 100644 --- a/ghost/admin/models/tag.js +++ b/ghost/admin/models/tag.js @@ -3,6 +3,10 @@ 'use strict'; Ghost.Collections.Tags = Ghost.ProgressCollection.extend({ - url: Ghost.paths.apiRoot + '/tags/' + url: Ghost.paths.apiRoot + '/tags/', + + parse: function (resp) { + return resp.tags; + } }); }());