Skip to content

Instantly share code, notes, and snippets.

@lxcodes
Forked from SaladFork/ember-select.js
Last active August 29, 2015 14:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lxcodes/350a4b302e6c890f529e to your computer and use it in GitHub Desktop.
Save lxcodes/350a4b302e6c890f529e to your computer and use it in GitHub Desktop.
var get = Ember.get, set = Ember.set, computed = Ember.computed, defineProperty = Ember.defineProperty, observer = Ember.observer;
Ember.Select.reopen({
optionDisabledPath: null
});
Ember.SelectOption.reopen({
attributeBindings: ['disabled'],
init: function() {
this.disabledPathDidChange();
this._super();
},
disabledPathDidChange: observer('parentView.optionDisabledPath', function() {
var disabledPath = get(this, 'parentView.optionDisabledPath');
if (!disabledPath) { return; }
defineProperty(this, 'disabled', computed(function() {
return get(this, disabledPath);
}).property(disabledPath));
})
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment