Skip to content

Commit

Permalink
[qadmin] fix for issue #32 (#33)
Browse files Browse the repository at this point in the history
  • Loading branch information
netzulo authored Jul 21, 2018
1 parent 400ea0d commit 0d44ea7
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 1 deletion.
4 changes: 4 additions & 0 deletions app/components/dropdown-generic/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export default Component.extend({
idLabel: null, // internal
idInput: null, // internal
defaultText: 'Select an option',
isMultiple: null,
init() {
this._super(...arguments);
if(this.get('ids') !== null) {
Expand All @@ -18,5 +19,8 @@ export default Component.extend({
if (this.get('defaultText') !== null) {
this.set('defaultText', this.get('defaultText'));
}
if (this.get('isMultiple') !== null) {
this.set('isMultiple', this.get('isMultiple'));
}
}
});
16 changes: 16 additions & 0 deletions app/components/dropdown-generic/template.hbs
Original file line number Diff line number Diff line change
@@ -1,6 +1,21 @@
<label id={{idLabel}} class="col-lg-2" for={{idInput}}>
{{labelText}}
</label>
{{#if isMultiple}}
<select id={{idInput}} class="form-control col-lg-10" multiple="multiple">
<option value="0" selected="selected">{{defaultText}}</option>
<optgroup label="Sub Elements list">
<option value="1">Link 1.1</option>
<option value="2">Link 1.2</option>
</optgroup>
<option value="1">Link 1.1</option>
<option value="2">Link 1.2</option>
<optgroup label="Sub Elements list" disabled="disabled">
<option value="1">Link 1.1</option>
<option value="2">Link 1.2</option>
</optgroup>
</select>
{{else}}
<select id={{idInput}} class="form-control col-lg-10">
<option value="0" selected="selected">{{defaultText}}</option>
<optgroup label="Sub Elements list">
Expand All @@ -14,5 +29,6 @@
<option value="2">Link 1.2</option>
</optgroup>
</select>
{{/if}}

{{yield}}
4 changes: 3 additions & 1 deletion app/templates/qacode/forms/inputs.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
{{input-generic ids="test001" labelText="Input text 1"}}

<h3 class="col-lg-12 text-center">Dropdowns</h3>
{{dropdown-generic ids="test002" labelText="Input text 2"}}
{{dropdown-generic ids="test002" labelText="Simple Select"}}

{{dropdown-generic ids="test003" labelText="Select with multiple attr" isMultiple="true" }}

<h4 class="col-lg-12 text-center">Dropdowns</h4>
<p class="col-lg-12 text-center"><i>with ember-bootstrap components</i></p>
Expand Down

0 comments on commit 0d44ea7

Please sign in to comment.