airbnb/rendr — pull request #57 by spikebrehm (2013-06-01 13:14:38+00:00)
Title: Allow view & template subdirs; support default viewPath in controller

This is a simplified version of @technicolorenvy's #50. Instead of magically mapping i.e. `home_index_view` to one of `home_index_view`, `home/index_view`, `home/index`, etc., this just supports the explicit use of subdirectories. In other words, in your controller, you can pass nested paths like `home/index`, and as long as you have a view `app/views/home/index.js` and a template `app/templates/home/index.hbs`, it will work just fine.

It also requires a view's `id` to match its module path, so a view located at `home/index.js` will look like this:

```js
var BaseView = require('rendr/shared/base/view');
module.exports = BaseView.extend({
// ...
});
module.exports.id = 'home/index';
```

This was enabled by a simple change to `viewEngine` to not strip out the basepath of the `viewPath` passed to it.

Additionally, this PR adds the ability to omit the `viewPath` in a controller, supporting the default of i.e. `:controller/:action`. So, your `users_controller.js` might look like this:
```js
module.exports = {
show: function(params, callback) {
var spec = {
model: {model: 'User', params: params}
};
this.app.fetch(spec, function(err, result) {
callback(err, result);
});
}
};
```
And the router will assume a `viewPath` of `users/show`. This can save a lot of typing, because typically the view name matches the controller & action.