forgot that views need to return self from render
This commit is contained in:
parent
1b91906250
commit
371fa4a05e
|
@ -32,6 +32,7 @@ describe 'backbone-generator' do
|
||||||
File.file?(template = 'app/views/section/model.jst').should be_true
|
File.file?(template = 'app/views/section/model.jst').should be_true
|
||||||
|
|
||||||
File.read(view).should match(/SectionModel/)
|
File.read(view).should match(/SectionModel/)
|
||||||
|
File.read(view).should match(/return this/)
|
||||||
File.read(view).should match(%r{template: JST\['section/model'\]})
|
File.read(view).should match(%r{template: JST\['section/model'\]})
|
||||||
File.read(spec).should match(/SectionModel/)
|
File.read(spec).should match(/SectionModel/)
|
||||||
end
|
end
|
||||||
|
@ -47,6 +48,7 @@ describe 'backbone-generator' do
|
||||||
|
|
||||||
File.read(view).should match(/SectionModelsView/)
|
File.read(view).should match(/SectionModelsView/)
|
||||||
File.read(view).should match(/SectionModelView/)
|
File.read(view).should match(/SectionModelView/)
|
||||||
|
File.read(view).should match(/return this/)
|
||||||
File.read(view).should match(%r{template: JST\['section/models'\]})
|
File.read(view).should match(%r{template: JST\['section/models'\]})
|
||||||
File.read(spec).should match(/SectionModelsView/)
|
File.read(spec).should match(/SectionModelsView/)
|
||||||
end
|
end
|
||||||
|
|
|
@ -11,6 +11,7 @@ var <%= object_name %>sView = Backbone.View.extend({
|
||||||
},
|
},
|
||||||
render: function() {
|
render: function() {
|
||||||
$(this.el).html(this.template());
|
$(this.el).html(this.template());
|
||||||
|
return this;
|
||||||
},
|
},
|
||||||
addOne: function(model) {
|
addOne: function(model) {
|
||||||
var view = new <%= object_name %>View({model: model});
|
var view = new <%= object_name %>View({model: model});
|
||||||
|
|
|
@ -5,6 +5,7 @@ var <%= object_name %>View = Backbone.View.extend({
|
||||||
},
|
},
|
||||||
render: function() {
|
render: function() {
|
||||||
$(this.el).html(this.template());
|
$(this.el).html(this.template());
|
||||||
|
return this;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue