Forked from danmeyers/components.sq-option-set.js
Last active
March 21, 2017 17:36
-
-
Save lennyburdette/4d40f5376853b89b9b3742828a2ba331 to your computer and use it in GitHub Desktop.
sq-option-set
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import Ember from 'ember'; | |
| export default Ember.Component.extend({ | |
| actions: { | |
| toggleValue(newValue, isSelected) { | |
| if (isSelected) { | |
| this.send('addValue', newValue); | |
| } else { | |
| this.send('removeValue', newValue); | |
| } | |
| }, | |
| addValue(newValue) { | |
| this.sendAction('valueChanged', [...this.get('value'), newValue]); | |
| }, | |
| removeValue(newValue) { | |
| this.sendAction('valueChanged', this.get('value').without(newValue)); | |
| } | |
| } | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import Ember from 'ember'; | |
| export default Ember.Controller.extend({ | |
| someArray: Ember.computed(function() { | |
| return "red orange yellow green blue indigo violet".w() | |
| }), | |
| currentValue: "red", | |
| multipleValues: Ember.computed(function() { | |
| return "orange green".w(); | |
| }) | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import Ember from 'ember'; | |
| export function eq([a, b]) { | |
| return a === b; | |
| } | |
| export default Ember.Helper.helper(eq); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import Ember from 'ember'; | |
| export function includes([needle, haystack]) { | |
| return haystack.includes(needle); | |
| } | |
| export default Ember.Helper.helper(includes); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import Ember from 'ember'; | |
| export function isArray([array]) { | |
| return Ember.isArray(array); | |
| } | |
| export default Ember.Helper.helper(isArray); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "version": "0.11.1", | |
| "EmberENV": { | |
| "FEATURES": {} | |
| }, | |
| "options": { | |
| "use_pods": false, | |
| "enable-testing": false | |
| }, | |
| "dependencies": { | |
| "jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.js", | |
| "ember": "2.11.0", | |
| "ember-template-compiler": "2.11.0", | |
| "ember-testing": "2.11.0" | |
| }, | |
| "addons": {} | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment