Skip to content

Commit

Permalink
Update md-codelist
Browse files Browse the repository at this point in the history
Allow JSON strings to be passed as initial value.
  • Loading branch information
jlblcc authored and stansmith907 committed May 24, 2016
1 parent 63b9f25 commit f9c39de
Showing 1 changed file with 27 additions and 16 deletions.
43 changes: 27 additions & 16 deletions app/pods/components/input/md-codelist/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,66 +2,72 @@ import Ember from 'ember';

export default Ember.Component.extend({
/**
* [service description]
* @param {[type]} 'codelist' [description]
* @return {[type]} [description]
* Injected codelist service
*
* @type {Array}
*/
mdCodes: Ember.inject.service('codelist'),

/**
* [service description]
* @return {Object} [description]
* Injected icon service
*
* @type {Array}
*/
icons: Ember.inject.service('icon'),

/**
* [create description]
* Whether to allow creation of options.
* @type {Boolean}
*/
create: false,

/**
* [tooltip description]
* Indicates if tooltips should be rendered.
* @type {Boolean}
*/
tooltip: false,

/**
* [icon description]
* Indicates if icons should be rendered.
* @type {Boolean}
*/
icon: false,

/**
* [allowClear description]
* Whether to render clear button
* @type {Boolean}
*/
allowClear: false,

/**
* [mdCodeName description]
* The codelist name
*
* @type {String} mdCodeName
*/

/**
* [placeholder description]
* The string to display when empty.
*
* @type {String}
*/
placeholder: "Select one option",

/**
* [label description]
* Form label
*
* @type {String} label
*/

/**
* [width description]
* Select2 width
*
* @type {String} width
*/
width: "100%",

/**
* [disabled description]
* Indicates if input is disabled
*
* @type {Boolean} width
*/
disabled: false,
Expand Down Expand Up @@ -116,8 +122,12 @@ export default Ember.Component.extend({
return codelist;
}),

// Format options for the select tag
// Add tooltips,icons if requested
/**
* Format options for the select tag
* Add tooltips,icons if requested
*
* @return {undefined}
*/
didInsertElement: function() {
let tooltip = this.get('tooltip');
let icon = this.get('icon');
Expand Down Expand Up @@ -161,6 +171,7 @@ export default Ember.Component.extend({
templateResult: formatOption,
width: this.get('width'),
minimumResultsForSearch: 10,
closeOnSelect: !!this.$('.md-codelist select').prop('multiple'),
theme: 'bootstrap'
});
},
Expand Down

0 comments on commit f9c39de

Please sign in to comment.