batmanjs/batman — pull request #985 by sdomino (2014-02-26 00:06:24+00:00)
Title: adding saveOn, unsaveOn, and toggle as simple resource helpers

I was a little unsure of where these should live, and `Batman.Object` is probably a little to high. We've added these to our `Batman.View`'s only because thats where they are most useful, however I can see some potential benefit to `Batman.Controller`'s and maybe even `Batman.Model`'s.

`saveOn` and `unsaveOn` work exactly the same as `set` and `unset` however they will attempt to save a resource as well:
```
// html - useful for on-the-fly setting/getting
%div{ data: { 'event-click' => 'saveOn | withArguments someModel, "someValue", true } } Save
%div{ data: { 'event-click' => 'unsaveOn | withArguments someModel, "someValue" } } Unsave

// View - useful with event like 'fire', 'onItemsAdded/Removed', 'observe(AndFire)'
@saveOn someModel, 'someValue', true
@unsaveOn someModel, 'someValue'

// Controller - maybe useful in similar instances as a View
@saveOn someModel, 'someValue', true
@unsaveOn someModel, 'someValue'

// Model - probably not really useful
@saveOn @, 'someValue', true
@unsaveOn @, 'someValue'
```

`toggle`:
```
// html - useful for on-the-fly setting/getting
.lock{ data: { 'event-click' => 'toggle | withArguments SomeView, "lockOrUnlockSomething"' } }

// View - useful with event like 'fire', 'onItemsAdded/Removed', 'observe(AndFire)'
@toggle someObject, 'someValue'

// Controller - maybe useful in similar instances as a View
@toggle someObject, 'someValue'

// Model - probably not really useful
@toggle someObject, 'someValue'
```

Again, I was a little unsure of where these should live. They are most useful for View's and maybe are better suited to be filters...