Skip to content

Instantly share code, notes, and snippets.

@locks
Forked from aalasolutions-zz/application.hbs
Created October 2, 2015 12:10
Show Gist options
  • Save locks/bef3b53525e2aa5b33a8 to your computer and use it in GitHub Desktop.
Save locks/bef3b53525e2aa5b33a8 to your computer and use it in GitHub Desktop.
{{multiselect-div items=allLinks selected=model.topLinks}}
{{multiselect-div items=allLinks selected=model.rightLinks}}
import Ember from 'ember';
export default Ember.Component.extend({
tLeft: 'Select', // title for left element
tRight: 'Selected', // title for right box
items: null, // links
selected: null, // selected links will go here
label: null,
actions: {
addItemToGroup: function (item) {
var selected = this.get('selected');
selected.pushObject(item);
item.set('hidden', 'hidden');
},
removeItemFromGroup: function (item) {
var selected = this.get('selected');
selected.removeObject(item);
item.set('hidden', '');
}
}
});
<div class="small-40 medium-20 columns end ">
<h3>{{tLeft}}</h3>
<div class="availableTags">
{{#each _items key="id" as |link|}}
<label class="{{link.hidden}}" {{action 'addItemToGroup' link}}>{{link.name}}</label>
{{/each}}
</div>
</div>
<div class="small-40 medium-20 columns end">
<h3>{{tRight}}</h3>
<div class="removeTags">
{{#each selected key="id" as |link|}}
<label {{action 'removeItemFromGroup' link}}>{{link.name}}</label>
{{/each}}
</div>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment