Merge pull request #191 from matthojo/template-moving

Updated reference to templates in Backbone views
This commit is contained in:
Hannah Wolfe 2013-06-22 09:57:39 -07:00
commit b7c1ed2aef
2 changed files with 17 additions and 6 deletions

View File

@ -109,7 +109,11 @@
Backbone.trigger('blog:activeItem', item.data('id'));
},
template: JST['content/list-item'],
templateName: "list-item",
template: function (data) {
return JST[this.templateName](data);
},
render: function () {
this.$el.html(this.template(_.extend({active: this.active}, this.model.toJSON())));
@ -157,7 +161,11 @@
window.location = '/ghost/editor/' + this.model.get('id');
},
template: JST['content/preview'],
templateName: "preview",
template: function (data) {
return JST[this.templateName](data);
},
render: function () {
if (this.activeId) {

View File

@ -139,7 +139,11 @@
this.render();
},
template: JST['content/widget'],
templateName: "widget",
template: function (data) {
return JST[this.templateName](data);
},
render: function () {
this.$el.html(this.template(this.model.toJSON()));
@ -155,12 +159,11 @@
// ----------
WidgetContent = Ghost.View.extend({
getTemplate: function () {
return JST['content/widgets/' + this.model.attributes.content.template];
template: function (data) {
return JST['widgets/' + this.model.attributes.content.template](data);
},
render: function () {
this.template = this.getTemplate();
this.$el.html(this.template(this.model.toJSON()));
return this;
}