diff --git a/core/client/assets/css/ember-hacks.css b/core/client/assets/css/ember-hacks.css
index 76f8c554f2..6a38a2a2e4 100644
--- a/core/client/assets/css/ember-hacks.css
+++ b/core/client/assets/css/ember-hacks.css
@@ -3,17 +3,6 @@
The contents should be solved properly or moved into ghost-ui package.
*/
-#entry-markdown,
-.entry-preview,
-.CodeMirror.cm-s-default {
- height: 500px !important;
-}
-
-.editor input {
- -webkit-transition: none;
- -moz-transition: none;
- transition: none;
-}
/*
By default nav menu should be displayed as it's visibility is controllerd
diff --git a/core/client/controllers/posts/post.js b/core/client/controllers/posts/post.js
index 394010f1a5..8e8196dc77 100644
--- a/core/client/controllers/posts/post.js
+++ b/core/client/controllers/posts/post.js
@@ -1,16 +1,14 @@
/* global console */
import {parseDateString, formatDate} from 'ghost/utils/date-formatting';
-var equal = Ember.computed.equal;
-
var PostController = Ember.ObjectController.extend({
//## Editor state properties
isEditingSettings: false,
isViewingSaveTypes: false,
//## Computed post properties
- isPublished: equal('status', 'published'),
- isDraft: equal('status', 'draft'),
+ isPublished: Ember.computed.equal('status', 'published'),
+ isDraft: Ember.computed.equal('status', 'draft'),
willPublish: Ember.computed.oneWay('isPublished'),
isStaticPage: function (key, val) {
var self = this;
@@ -19,7 +17,7 @@ var PostController = Ember.ObjectController.extend({
this.set('page', val ? 1 : 0);
return this.get('model').save().then(function () {
- self.notifications.showSuccess('Succesfully converted to ' + (val ? 'static page' : 'post'));
+ self.notifications.showSuccess('Successfully converted to ' + (val ? 'static page' : 'post'));
return !!self.get('page');
}, this.notifications.showErrors);
@@ -38,9 +36,12 @@ var PostController = Ember.ObjectController.extend({
save: function () {
var status = this.get('willPublish') ? 'published' : 'draft',
self = this;
+
this.set('model.status', status);
this.get('model').save().then(function () {
- self.notifications.showSuccess('Post status saved as ' + this.get('model.status') + '.');
+ console.log('saved');
+ self.notifications.showSuccess('Post status saved as ' +
+ self.get('model.status') + '.');
}, this.notifications.showErrors);
},
viewSaveTypes: function () {
@@ -101,14 +102,16 @@ var PostController = Ember.ObjectController.extend({
if (!this.get('isNew')) {
return;
}
-
+
this.get('model').save().then(function () {
- self.notifications.showSuccess('Permalink successfully changed to ' + this.get('slug') + '.');
+ self.notifications.showSuccess('Permalink successfully changed to ' +
+ self.get('slug') + '.');
}, this.notifications.showErrors);
},
updatePublishedAt: function (userInput) {
- var errMessage = '',
+ var self = this,
+ errMessage = '',
newPubDate = formatDate(parseDateString(userInput)),
pubDate = this.get('publishedAt'),
newPubDateMoment,
@@ -124,7 +127,7 @@ var PostController = Ember.ObjectController.extend({
// Check for missing time stamp on new data
// If no time specified, add a 12:00
if (newPubDate && !newPubDate.slice(-5).match(/\d+:\d\d/)) {
- newPubDate += " 12:00";
+ newPubDate += ' 12:00';
}
newPubDateMoment = parseDateString(newPubDate);
@@ -134,7 +137,7 @@ var PostController = Ember.ObjectController.extend({
// Check for missing time stamp on current model
// If no time specified, add a 12:00
if (!pubDate.slice(-5).match(/\d+:\d\d/)) {
- pubDate += " 12:00";
+ pubDate += ' 12:00';
}
pubDateMoment = parseDateString(pubDate);
@@ -146,8 +149,9 @@ var PostController = Ember.ObjectController.extend({
}
// Validate new Published date
- if (!newPubDateMoment.isValid() || newPubDate.substr(0, 12) === "Invalid date") {
- errMessage = 'Published Date must be a valid date with format: DD MMM YY @ HH:mm (e.g. 6 Dec 14 @ 15:00)';
+ if (!newPubDateMoment.isValid() || newPubDate.substr(0, 12) === 'Invalid date') {
+ errMessage = 'Published Date must be a valid date with format: ' +
+ 'DD MMM YY @ HH:mm (e.g. 6 Dec 14 @ 15:00)';
}
if (newPubDateMoment.diff(new Date(), 'h') > 0) {
@@ -175,7 +179,8 @@ var PostController = Ember.ObjectController.extend({
}
this.get('model').save().then(function () {
- this.notifications.showSuccess('Publish date successfully changed to ' + this.get('publishedAt') + '.');
+ this.notifications.showSuccess('Publish date successfully changed to ' +
+ self.get('publishedAt') + '.');
}, this.notifications.showErrors);
}
}
diff --git a/core/client/controllers/settings/general.js b/core/client/controllers/settings/general.js
index dc4e81d296..0e44cce9c6 100644
--- a/core/client/controllers/settings/general.js
+++ b/core/client/controllers/settings/general.js
@@ -34,7 +34,7 @@ var SettingsGeneralController = Ember.ObjectController.extend({
});
// Let the applicationRoute handle validation errors
- this.send('handleValidationErrors', errs);
+ this.send('handleErrors', errs);
} else {
model.save().then(function () {
// @TODO: Notification of success
diff --git a/core/client/models/post.js b/core/client/models/post.js
index ccdf1f6fd2..1d6e148a51 100644
--- a/core/client/models/post.js
+++ b/core/client/models/post.js
@@ -2,13 +2,13 @@ var Post = DS.Model.extend({
uuid: DS.attr('string'),
title: DS.attr('string'),
slug: DS.attr('string'),
- markdown: DS.attr('string'),
+ markdown: DS.attr('string', {defaultValue: ''}),
html: DS.attr('string'),
image: DS.attr('string'),
- featured: DS.attr('boolean'),
- page: DS.attr('boolean'),
- status: DS.attr('string'),
- language: DS.attr('string'),
+ featured: DS.attr('boolean', {defaultValue: false}),
+ page: DS.attr('boolean', {defaultValue: false}),
+ status: DS.attr('string', {defaultValue: 'draft'}),
+ language: DS.attr('string', {defaultValue: 'en_US'}),
meta_title: DS.attr('string'),
meta_description: DS.attr('string'),
author: DS.belongsTo('user', { async: true }),
@@ -35,7 +35,7 @@ var Post = DS.Model.extend({
});
},
- validationErrors: function () {
+ validate: function () {
var validationErrors = [];
if (!this.get('title.length')) {
diff --git a/core/client/routes/application.js b/core/client/routes/application.js
index 3cb172953c..0e4c7a5a7e 100644
--- a/core/client/routes/application.js
+++ b/core/client/routes/application.js
@@ -45,9 +45,10 @@ var ApplicationRoute = Ember.Route.extend({
},
handleErrors: function (errors) {
+ var self = this;
this.notifications.clear();
errors.forEach(function (errorObj) {
- this.notifications.showError(errorObj.message || errorObj);
+ self.notifications.showError(errorObj.message || errorObj);
if (errorObj.hasOwnProperty('el')) {
errorObj.el.addClass('input-error');
diff --git a/core/client/routes/new.js b/core/client/routes/new.js
index d84d0f646e..319b8a4002 100644
--- a/core/client/routes/new.js
+++ b/core/client/routes/new.js
@@ -11,7 +11,7 @@ var NewRoute = AuthenticatedRoute.extend(styleBody, {
model: function () {
return this.store.createRecord('post', {
- title: 'New Post'
+ title: ''
});
}
});
diff --git a/core/client/templates/editor.hbs b/core/client/templates/editor.hbs
index 1830bb204b..cdb1d86ef5 100644
--- a/core/client/templates/editor.hbs
+++ b/core/client/templates/editor.hbs
@@ -1,27 +1,26 @@
-
-
- {{input type="text" id="entry-title" placeholder="Your Post Title" value=title tabindex="1"}}
-
-
-
-
-
-
- {{gh-codemirror value=markdown scrollPosition=view.scrollPosition}}
-
+
+
+ {{input type="text" id="entry-title" placeholder="Your Post Title" value=title tabindex="1"}}
+
-
-
-
- {{gh-markdown markdown=markdown scrollPosition=view.scrollPosition}}
-
+
+
+
+ {{gh-codemirror value=markdown scrollPosition=view.scrollPosition}}
+
+
+
+
+
+
+ {{gh-markdown markdown=markdown scrollPosition=view.scrollPosition}}
diff --git a/core/client/views/editor.js b/core/client/views/editor.js
index 1203befc91..dcab519415 100644
--- a/core/client/views/editor.js
+++ b/core/client/views/editor.js
@@ -1,3 +1,5 @@
export default Ember.View.extend({
+ tagName: 'section',
+ classNames: ['entry-container'],
scrollPosition: 0 // percentage of scroll position
});
\ No newline at end of file