Skip to content

Instantly share code, notes, and snippets.

@Panman82
Created August 16, 2016 15:18
Show Gist options
  • Save Panman82/3ce7c3d5f9d88a331f0c7373f82a0ad2 to your computer and use it in GitHub Desktop.
Save Panman82/3ce7c3d5f9d88a331f0c7373f82a0ad2 to your computer and use it in GitHub Desktop.
Semantic UI Ember Calendar Component
{{!-- app/templates/components/ui-calendar.hbs --}}
<div class="ui input {{if icon 'left icon'}}">
<i class="{{icon}} icon"></i>
<input type="text" placeholder="{{placeholder}}" />
</div>
// app/components/ui-calendar.js
import Ember from 'ember';
import UiBase from 'semantic-ui-ember/mixins/base';
export default Ember.Component.extend( UiBase, {
module: 'calendar',
classNames: ['ui', 'calendar'],
icon: 'calendar',
placeholder: 'Date',
getSemanticIgnorableAttrs() {
return ['date','icon','placeholder'];
},
willInitSemantic( settings ) {
settings.type = 'date';
this._super( ...arguments );
},
didInitSemantic() {
this._super( ...arguments );
let date = this.get('date');
if ( date ) {
this.$().calendar('set date', date);
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment