Fix boolean parameters

This commit is contained in:
Kane York 2015-07-15 11:00:31 -07:00
parent 5b11bbec68
commit 45c2636ea0
4 changed files with 15 additions and 2 deletions

View File

@ -43,7 +43,14 @@ export default Ember.Component.extend({
this.get('params')[this.get('info.identifier')] = value.toString();
}
return this.get('params')[this.get('info.identifier')];
}.property('params', 'pname'),
}.property('params', 'info.identifier'),
valueBool: function(key, value, previousValue) {
if (arguments.length > 1) {
this.get('params')[this.get('info.identifier')] = (!!value).toString();
}
return this.get('params')[this.get('info.identifier')] !== 'false';
}.property('params', 'info.identifier'),
valid: function() {
const type = this.get('info.type'),

View File

@ -35,7 +35,10 @@ const Query = RestModel.extend({
if (oldParams[pinfo.identifier]) {
newParams[name] = oldParams[name];
} else if (pinfo['default'] !== null) {
if (pinfo['default'] === false) { debugger; }
newParams[name] = pinfo['default'];
} else if (pinfo['type'] === 'boolean') {
newParams[name] = 'false';
} else {
newParams[name] = '';
}

View File

@ -1,6 +1,6 @@
{{#if info.nullable}}
{{combo-box valueAttribute="id" value=value nameProperty="name" content=boolTypes}}
{{else}}
{{input type="checkbox" checked=value}}
{{input type="checkbox" checked=valueBool}}
{{/if}}
<span class="param-name">{{info.identifier}}</span>

View File

@ -171,6 +171,9 @@
overflow-x: visible;
.ac-wrap {
display: inline-block;
input {
width: 100px !important; // override an inline style
}
}
input {
width: 190px;