Skip to content

Commit

Permalink
fix(subgenerators): fix and normalize singleton handling
Browse files Browse the repository at this point in the history
  • Loading branch information
cueedee committed Apr 13, 2015
1 parent 193e657 commit d400038
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 12 deletions.
12 changes: 6 additions & 6 deletions generators/collection/templates/collection.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,18 @@
# @author <%= user.git.name() %>
# @class <%= className %>Collection
# @extends Backbone.Collection<% if ( singleton ) { %>
# @static<% } %>
# @static<% } else { %>
# @constructor<% } %>
# @moduletype collection
# @version 0.1
###
class <%= className %>Collection extends Backbone.Collection

model: <%= modelClass %>Model
model: <%= modelClass %>Model<% if ( singleton ) { %>


<% if( singleton === true ) { %>
my<%= className %>Collection = new <%= className %>Collection()
return my<%= className %>Collection
<% } %>
## Export singleton
##
return new <%= className %>Collection()<% } %>

)
13 changes: 7 additions & 6 deletions generators/model/templates/model.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,17 @@
# @author <%= user.git.name() %>
# @class <%= className %>Model
# @extends Backbone.Model<% if ( singleton ) { %>
# @static<% } %>
# @static<% } else { %>
# @constructor<% } %>
# @moduletype model
# @version 0.1
###
class <%= className %>Model extends Backbone.Model

class <%= className %>Model extends Backbone.Model<% if ( singleton ) { %>

<% if( singleton === true ) { %>
my<%= className %>Model = new <%= className %>Model()
return my<%= className %>Model
<% } %>

## Export singleton
##
return new <%= className %>Model()<% } %>

)

0 comments on commit d400038

Please sign in to comment.