Sha256: cf3775bf5f75a152ad10756a35feeb8320786317b16433752e6a04412fa129ee

Contents?: true

Size: 611 Bytes

Versions: 2

Compression:

Stored size: 611 Bytes

Contents

class <%= router_namespace %>Router extends Backbone.Router
  initialize: (options) ->
    @<%=plural_name%> = new <%=collection_namespace%>Collection.getInstance()
    if !@<%=plural_name%>._fetched
      @<%=plural_name%>.fetch()
      @<%=plural_name%>._fetched = true

  routes:
  <% actions.each do |action| -%>
  "<%= action %>": "<%= action %>"
  <% end -%>

<% actions.each do |action| -%>
  <%= action %>: ->
    view = new <%= "#{view_namespace}#{action.camelize}View()" %>
    <%= js_app_name %>.RootView.getInstance().setView view
<% end -%>

# Activate the router!
new <%= router_namespace %>Router

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
thorax-rails-1.0.0 lib/generators/thorax/router/templates/router.coffee
thorax-rails-0.1.8 lib/generators/thorax/router/templates/router.coffee