Last active
April 18, 2017 20:14
-
-
Save cs3b/d8e9bb3be5d78e24f17c0ecc60d5bf4d to your computer and use it in GitHub Desktop.
ember pikaday demo
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'; | |
| import PikadayMixin from 'ember-pikaday/mixins/pikaday'; | |
| import PaperInput from 'ember-paper/components/paper-input'; | |
| import layout from 'ember-paper/templates/components/paper-input'; | |
| export default PaperInput.extend(PikadayMixin, { | |
| layout, | |
| format: 'YYYY-MM-DD', | |
| didInsertElement() { | |
| this._super(...arguments); | |
| this.set('field', this.element.children[1]); | |
| this.setupPikaday(); | |
| }, | |
| onPikadayOpen: function() { | |
| this.get('onOpen')(); | |
| }, | |
| onPikadayClose: function() { | |
| if (this.get('pikaday').getDate() === null || Ember.isEmpty(this.$(this.field).val())) { | |
| this.set('value', null); | |
| this.get('onSelection')(null); | |
| } else { | |
| this.set('value', this.get('pikaday').toString(this.get('format'))); | |
| } | |
| this.get('onClose')(); | |
| }, | |
| }); |
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({ | |
| appName: 'Ember Twiddle' | |
| }); |
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.12.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.12.0", | |
| "ember-template-compiler": "2.12.0", | |
| "ember-testing": "2.12.0" | |
| }, | |
| "addons": { | |
| "ember-data": "2.12.1", | |
| "ember-pikaday": "2.2.2", | |
| "ember-paper": "1.0.0-alpha.19" | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment