radar/ember-store — pull request #1 by brianpattison (2014-04-29 14:53:40+00:00)
Title: Use 'action' for VarientPicker sendAction

To call controller or router actions from within a component, you link the actions in the templates, and then call `this.sendAction('actionName')`

Something like this:

```javascript
App.SomeController = Ember.Controller.extend({
actions: {
doSomething: function(variant) {
console.log('doSomething');
},
updateSomething: function(variant) {
console.log('updateSomething');
}
}
});
```

```handlebars
{{view EmberStore.VariantPicker click="doSomething" change="updateSomething"}}
```

```coffeescript
EmberStore.VariantPicker = Ember.TextField.extend
didInsertElement: ->
view = this
$('#' + this.elementId).select2
width: '500px'
ajax:
url: '/api/variants'
datatype: "json"
data: (term, page) ->
q:
name_cont: term
results: (data, page) ->
results: data["variants"]
formatResult: (variant) ->
variant.name
formatSelection: (variant) ->
view.set('variant', variant)
variant.name

click: (e) ->
this.sendAction('click', this.get('variant'))

change: (e) ->
this.sendAction('change', this.get('variant'))
```