-
-
Save danmeyers/a5a49519c1c53c0ec267d15a24853195 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: { | |
setValue(newValue) { | |
this.sendAction('valueChanges', newValue); | |
}, | |
toggleValue(newValue, isSelected) { | |
if (isSelected) { | |
this.send('addValue', newValue); | |
} else { | |
this.send('removeValue', newValue); | |
} | |
}, | |
addValue(newValue) { | |
this.sendAction('valueChanges', [...this.get('value'), newValue]); | |
}, | |
removeValue(newValue) { | |
this.sendAction('valueChanges', 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-data": "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