Updated reference to templates in Backbone views

This commit is contained in:
Matthew Harrison-Jones 2013-06-22 16:50:59 +01:00
parent 2621de54a0
commit 23d317ed3e
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;
}