Created
July 2, 2015 20:48
-
-
Save basz/0afab2cd47d085c82099 to your computer and use it in GitHub Desktop.
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'; | |
| /** | |
| * MaterializeCSS Dropdown Component | |
| * | |
| * @see http://materializecss.com/dropdown.html | |
| */ | |
| export default Ember.Component.extend({ | |
| tagName: 'a', | |
| classNames: ['dropdown-button'], | |
| attributeBindings: [ | |
| 'data-activates', 'data-induration', 'data-outduration', 'data-constrainwidth', 'data-hover', 'data-gutter', | |
| 'data-beloworigin' | |
| ], | |
| didInsertElement: function () { | |
| this._super(); | |
| Ember.run.scheduleOnce('afterRender', this, this.afterRenderEvent); | |
| }, | |
| afterRenderEvent: function () { | |
| Ember.assert("Required attribute 'data-activates' not specified on 'materialize/dropdown-button' component", !Ember.isNone(this.get('attrs.data-activates'))); | |
| this.$().dropdown({ | |
| hover: this.getWithDefault('attrs.data-hover', false), | |
| constrainWidth: this.getWithDefault('attrs.data-constrainwidth', true), | |
| inDuration: this.getWithDefault('attrs.data-induration', 300), | |
| outDuration: this.getWithDefault('attrs.data-outduration', 300), | |
| gutter: this.getWithDefault('attrs.data-gutter', 0), | |
| belowOrigin: this.getWithDefault('attrs.data-beloworigin', true) | |
| }); | |
| } | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment