batmanjs/batman — pull request #909 by kmcphillips (2013-11-24 16:41:10+00:00)
Title: Look at source: on view when loaded from controller

@nsimmons @jbruton
/cc @pushrax @kristianpd

## Problem

The `source:` property on views is used to load the HTML from a custom location. It works in examples like this:

```html

```
```coffee
class Shopify.NetPromoterScoreView extends Batman.View
source: 'dashboard/net_promoter_score'
```

The `net_promoter_score` file is loaded from the non-default `dashboard` folder.

However, when rendering a view from a dispatch the `source:` must be passed in to the call to `render()`. Like this:

```coffee
class Shopify.ObscureView extends Batman.view
```
```coffee
@render(source: 'custom/path')
```

## Solution

To keep the API consistent, the call to `render()` should first look for passed in overrides, then the `source:` on the view's prototype, and then the default value. Like this:

```coffee
class Shopify.ObscureView extends Batman.view
source: 'custom/path'
```
```coffee
@render()
```

## Impact

Any existing view with a `source:` that is being loaded from a `render()` will load that source rather than the default.