Skip to content
This repository has been archived by the owner on Mar 26, 2018. It is now read-only.

Commit

Permalink
Provide more useful scaffold
Browse files Browse the repository at this point in the history
  • Loading branch information
jaseemabid authored and revathskumar committed Feb 7, 2014
1 parent ffc099e commit c81c324
Show file tree
Hide file tree
Showing 7 changed files with 96 additions and 4 deletions.
10 changes: 10 additions & 0 deletions templates/coffeescript/model.coffee
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
'use strict';

class <%= _.camelize(appname) %>.Models.<%= _.classify(name) %>Model extends Backbone.Model
url: '',

initialize: () ->

defaults: {}

validate: (attrs, options) ->

parse: (response, options) ->
response
12 changes: 11 additions & 1 deletion templates/coffeescript/requirejs/model.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,14 @@ define [
], (_, Backbone) ->
'use strict';

class <%= _.classify(name) %>Model extends Backbone.Model
class <%= _.classify(name) %>Model extends Backbone.Model
url: '',

initialize: () ->

defaults: {}

validate: (attrs, options) ->

parse: (response, options) ->
response
16 changes: 15 additions & 1 deletion templates/coffeescript/requirejs/view.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,18 @@ define [
'templates'
], ($, _, Backbone, JST) ->
class <%= _.classify(name) %>View extends Backbone.View
template: JST['<%= jst_path %>']
template: JST['<%= jst_path %>']

tagName: 'div'

id: ''

className: ''

events: {}

initialize: () ->
@listenTo @model, 'change', @render

render: () ->
@$el.html @template(@model.toJSON())
14 changes: 14 additions & 0 deletions templates/coffeescript/view.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,17 @@
class <%= _.camelize(appname) %>.Views.<%= _.classify(name) %>View extends Backbone.View

template: JST['<%= jst_path %>']

tagName: 'div'

id: ''

className: ''

events: {}

initialize: () ->
@listenTo @model, 'change', @render

render: () ->
@$el.html @template(@model.toJSON())
12 changes: 12 additions & 0 deletions templates/requirejs/model.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,19 @@ define([
'use strict';

var <%= _.classify(name) %>Model = Backbone.Model.extend({
url: '',

initialize: function() {
},

defaults: {
},

validate: function(attrs, options) {
},

parse: function(response, options) {
return response;
}
});

Expand Down
18 changes: 17 additions & 1 deletion templates/requirejs/view.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,23 @@ define([
'use strict';

var <%= _.classify(name) %>View = Backbone.View.extend({
template: JST['<%= jst_path %>']
template: JST['<%= jst_path %>'],

tagName: 'div',

id: '',

className: '',

events: {},

initialize: function () {
this.listenTo(this.model, 'change', this.render);
},

render: function () {
this.$el.html(this.template(this.model.toJSON()));
}
});

return <%= _.classify(name) %>View;
Expand Down
18 changes: 17 additions & 1 deletion templates/view.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,23 @@

<%= _.camelize(appname) %>.Views.<%= _.classify(name) %>View = Backbone.View.extend({

template: JST['<%= jst_path %>']
template: JST['<%= jst_path %>'],

tagName: 'div',

id: '',

className: '',

events: {},

initialize: function () {
this.listenTo(this.model, 'change', this.render);
},

render: function () {
this.$el.html(this.template(this.model.toJSON()));
}

});

Expand Down

0 comments on commit c81c324

Please sign in to comment.