mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-20 22:42:53 -05:00
Rename content fields - closes #253
- rename "content" to "content_raw" - rename "content_raw" to "content" - change all references
This commit is contained in:
parent
5948a3f246
commit
6b3f835cfb
8 changed files with 25 additions and 21 deletions
|
@ -25,10 +25,10 @@ fancyFirstChar = {
|
|||
ghost.registerFilter('prePostsRender', function (posts) {
|
||||
if (_.isArray(posts)) {
|
||||
_.each(posts, function (post) {
|
||||
post.content_html = fancify(post.content_html);
|
||||
post.content = fancify(post.content);
|
||||
});
|
||||
} else if (posts.hasOwnProperty('content_html')) {
|
||||
posts.content_html = fancify(posts.content_html);
|
||||
} else if (posts.hasOwnProperty('content')) {
|
||||
posts.content = fancify(posts.content);
|
||||
}
|
||||
|
||||
return posts;
|
||||
|
|
|
@ -129,14 +129,14 @@
|
|||
},
|
||||
|
||||
savePost: function (data) {
|
||||
// TODO: The content getter here isn't great, shouldn't rely on currentView.
|
||||
// TODO: The content_raw getter here isn't great, shouldn't rely on currentView.
|
||||
_.each(this.model.blacklist, function (item) {
|
||||
this.model.unset(item);
|
||||
}, this);
|
||||
|
||||
var saved = this.model.save(_.extend({
|
||||
title: $('#entry-title').val(),
|
||||
content: Ghost.currentView.editor.getValue()
|
||||
content_raw: Ghost.currentView.editor.getValue()
|
||||
}, data));
|
||||
|
||||
// TODO: Take this out if #2489 gets merged in Backbone. Or patch Backbone
|
||||
|
@ -162,7 +162,7 @@
|
|||
// Add the container view for the Publish Bar
|
||||
this.addSubview(new PublishBar({el: "#publish-bar", model: this.model})).render();
|
||||
|
||||
this.$('#entry-markdown').html(this.model.get('content'));
|
||||
this.$('#entry-markdown').html(this.model.get('content_raw'));
|
||||
|
||||
this.initMarkdown();
|
||||
this.renderPreview();
|
||||
|
|
|
@ -15,5 +15,5 @@
|
|||
</section>
|
||||
</header>
|
||||
<section class="content-preview-content">
|
||||
<div class="wrapper">{{{content_html}}}</div>
|
||||
<div class="wrapper">{{{content}}}</div>
|
||||
</section>
|
File diff suppressed because one or more lines are too long
|
@ -13,8 +13,8 @@ up = function () {
|
|||
t.string('uuid');
|
||||
t.string('title');
|
||||
t.string('slug');
|
||||
t.text('content_raw');
|
||||
t.text('content');
|
||||
t.text('content_html');
|
||||
t.string('meta_title');
|
||||
t.string('meta_description');
|
||||
t.string('meta_keywords');
|
||||
|
|
|
@ -32,7 +32,7 @@ Post = GhostBookshelf.Model.extend({
|
|||
if (!this.get('title')) {
|
||||
throw new Error('Post title cannot be blank');
|
||||
}
|
||||
this.set('content_html', converter.makeHtml(this.get('content')));
|
||||
this.set('content', converter.makeHtml(this.get('content_raw')));
|
||||
|
||||
if (this.hasChanged('status') && this.get('status') === 'published') {
|
||||
this.set('published_at', new Date());
|
||||
|
|
|
@ -63,7 +63,7 @@ describe('Post Model', function () {
|
|||
var createdPostUpdatedDate,
|
||||
newPost = {
|
||||
title: 'Test Title 1',
|
||||
content: 'Test Content 1'
|
||||
content_raw: 'Test Content 1'
|
||||
};
|
||||
|
||||
PostModel.add(newPost).then(function (createdPost) {
|
||||
|
@ -73,7 +73,9 @@ describe('Post Model', function () {
|
|||
createdPost.has('uuid').should.equal(true);
|
||||
createdPost.get('status').should.equal('draft');
|
||||
createdPost.get('title').should.equal(newPost.title, "title is correct");
|
||||
createdPost.get('content').should.equal(newPost.content, "content is correct");
|
||||
createdPost.get('content_raw').should.equal(newPost.content_raw, "content_raw is correct");
|
||||
createdPost.has('content').should.equal(true);
|
||||
createdPost.get('content').should.equal('<p>' + newPost.content_raw + '</p>');
|
||||
createdPost.get('slug').should.equal('test-title-1');
|
||||
createdPost.get('created_at').should.be.below(new Date().getTime()).and.be.above(new Date(0).getTime());
|
||||
createdPost.get('created_by').should.equal(1);
|
||||
|
@ -103,19 +105,19 @@ describe('Post Model', function () {
|
|||
it('can generate a non conflicting slug', function (done) {
|
||||
var newPost = {
|
||||
title: 'Test Title',
|
||||
content: 'Test Content 1'
|
||||
content_raw: 'Test Content 1'
|
||||
};
|
||||
|
||||
PostModel.add(newPost).then(function (createdPost) {
|
||||
|
||||
createdPost.get('slug').should.equal('test-title');
|
||||
|
||||
newPost.content = 'Test Content 2';
|
||||
newPost.content_raw = 'Test Content 2';
|
||||
return PostModel.add(newPost);
|
||||
}).then(function (secondPost) {
|
||||
|
||||
secondPost.get('slug').should.equal('test-title-2');
|
||||
secondPost.get('content').should.equal("Test Content 2");
|
||||
secondPost.get('content_raw').should.equal("Test Content 2");
|
||||
|
||||
done();
|
||||
}).then(null, done);
|
||||
|
@ -125,7 +127,7 @@ describe('Post Model', function () {
|
|||
it('can generate slugs without duplicate hyphens', function (done) {
|
||||
var newPost = {
|
||||
title: 'apprehensive titles have too many spaces ',
|
||||
content: 'Test Content 1'
|
||||
content_raw: 'Test Content 1'
|
||||
};
|
||||
|
||||
PostModel.add(newPost).then(function (createdPost) {
|
||||
|
|
File diff suppressed because one or more lines are too long
Loading…
Add table
Reference in a new issue