joeybaker/wheelhouse-router

controller render method shouldn't need context

Closed this issue · 0 comments

The first param is the context which is really kinda messy. It would be great to drop that. It's also not needed client side.

Maybe change the actions from functions to objects?

current:

module.exports = {
  index: function(){
    this.render(this, 'view', 'collection', {
      data: function(collection){
        return collection
      }
    })
  }
}

Maybe:

module.exports = {
  index: {
    initialize: function(){
      // all the initial stuff can happen here
    }
    , view: 'view'
    , collection: 'collection'
    , model: collection.findwhere() // optional, would make making a view a model view _much_ easier
    , data: function(collection){ return collection } 
  }
}