select control support displaying default value in setting page
This commit is contained in:
parent
7d6b5e2668
commit
5214504369
|
@ -10,7 +10,7 @@
|
||||||
scope: {
|
scope: {
|
||||||
option: '=',
|
option: '=',
|
||||||
ngModel: '=',
|
ngModel: '=',
|
||||||
placeholder: '=?',
|
defaultValue: '=?',
|
||||||
onChangeValue: '&'
|
onChangeValue: '&'
|
||||||
},
|
},
|
||||||
link: function (scope, element, attrs, ngModel) {
|
link: function (scope, element, attrs, ngModel) {
|
||||||
|
@ -206,6 +206,23 @@
|
||||||
scope.$watch('option', function () {
|
scope.$watch('option', function () {
|
||||||
element.find('[data-toggle="popover"]').popover();
|
element.find('[data-toggle="popover"]').popover();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
scope.$watch('defaultValue', function (value) {
|
||||||
|
var displayValue = value;
|
||||||
|
|
||||||
|
if (scope.option && scope.option.options) {
|
||||||
|
for (var i = 0; i < scope.option.options.length; i++) {
|
||||||
|
var optionItem = scope.option.options[i];
|
||||||
|
|
||||||
|
if (optionItem.value === value) {
|
||||||
|
displayValue = optionItem.name;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
scope.placeholder = displayValue;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}]);
|
}]);
|
||||||
|
|
|
@ -510,6 +510,17 @@ td {
|
||||||
color: #ffffff;
|
color: #ffffff;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.skin-aria-ng input::-webkit-input-placeholder,
|
||||||
|
.skin-aria-ng input:-moz-placeholder,
|
||||||
|
.skin-aria-ng input::-moz-placeholder,
|
||||||
|
.skin-aria-ng input:-ms-input-placeholder {
|
||||||
|
color: #999;
|
||||||
|
}
|
||||||
|
|
||||||
|
.skin-aria-ng select.placeholder {
|
||||||
|
color: #999;
|
||||||
|
}
|
||||||
|
|
||||||
/* font-awesome extend */
|
/* font-awesome extend */
|
||||||
.fa-half {
|
.fa-half {
|
||||||
font-size: 0.5em;
|
font-size: 0.5em;
|
||||||
|
|
|
@ -53,7 +53,7 @@
|
||||||
<div class="tab-pane" ng-class="{'active': context.currentTab == 'options'}">
|
<div class="tab-pane" ng-class="{'active': context.currentTab == 'options'}">
|
||||||
<div class="settings-table striped hoverable">
|
<div class="settings-table striped hoverable">
|
||||||
<ng-setting ng-repeat="option in context.availableOptions" option="option" lazy-save-timeout="0"
|
<ng-setting ng-repeat="option in context.availableOptions" option="option" lazy-save-timeout="0"
|
||||||
placeholder="context.globalOptions[option.key]"
|
default-value="context.globalOptions[option.key]"
|
||||||
on-change-value="setOption(key, value, optionStatus)"></ng-setting>
|
on-change-value="setOption(key, value, optionStatus)"></ng-setting>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -16,10 +16,11 @@
|
||||||
<textarea class="form-control" rows="6" placeholder="{{::placeholder}}" ng-disabled="!!option.readonly"
|
<textarea class="form-control" rows="6" placeholder="{{::placeholder}}" ng-disabled="!!option.readonly"
|
||||||
ng-if="option.type == 'text'"
|
ng-if="option.type == 'text'"
|
||||||
ng-model="optionValue" ng-change="changeValue(optionValue, true)"></textarea>
|
ng-model="optionValue" ng-change="changeValue(optionValue, true)"></textarea>
|
||||||
<select class="form-control" style="width: 100%;" ng-disabled="!!option.readonly"
|
<select class="form-control" style="width: 100%;" ng-disabled="!!option.readonly" ng-class="{'placeholder': !optionValue}"
|
||||||
ng-if="option.type == 'boolean' || option.type == 'option'"
|
ng-if="option.type == 'boolean' || option.type == 'option'"
|
||||||
ng-model="optionValue" ng-change="changeValue(optionValue, false)"
|
ng-model="optionValue" ng-change="changeValue(optionValue, false)"
|
||||||
ng-options="item.value as (item.name | translate) for item in option.options">
|
ng-options="item.value as (item.name | translate) for item in option.options">
|
||||||
|
<option value="" disabled="disabled" ng-bind="(placeholder | translate)" style="display: none;"></option>
|
||||||
</select>
|
</select>
|
||||||
<div class="form-control-icon" ng-if="optionStatus.isShowStatusIcon()">
|
<div class="form-control-icon" ng-if="optionStatus.isShowStatusIcon()">
|
||||||
<i class="fa form-control-feedback" ng-class="[optionStatus.getStatusIcon()]"></i>
|
<i class="fa form-control-feedback" ng-class="[optionStatus.getStatusIcon()]"></i>
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<section class="content no-padding">
|
<section class="content no-padding">
|
||||||
<div class="settings-table striped hoverable">
|
<div class="settings-table striped hoverable">
|
||||||
<ng-setting ng-repeat="option in context.availableOptions" option="option" placeholder="option.defaultValue"
|
<ng-setting ng-repeat="option in context.availableOptions" option="option"
|
||||||
ng-model="context.globalOptions[option.key]"
|
ng-model="context.globalOptions[option.key]" default-value="option.defaultValue"
|
||||||
on-change-value="setGlobalOption(key, value, optionStatus)"></ng-setting>
|
on-change-value="setGlobalOption(key, value, optionStatus)"></ng-setting>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|
|
@ -289,7 +289,8 @@
|
||||||
<div class="tab-pane" ng-class="{'active': context.currentTab == 'settings'}" ng-if="task && (task.status == 'active' || task.status == 'waiting' || task.status == 'paused')">
|
<div class="tab-pane" ng-class="{'active': context.currentTab == 'settings'}" ng-if="task && (task.status == 'active' || task.status == 'waiting' || task.status == 'paused')">
|
||||||
<div class="settings-table striped hoverable">
|
<div class="settings-table striped hoverable">
|
||||||
<ng-setting ng-repeat="option in context.availableOptions" option="option"
|
<ng-setting ng-repeat="option in context.availableOptions" option="option"
|
||||||
ng-model="context.options[option.key]" on-change-value="setOption(key, value, optionStatus)"></ng-setting>
|
ng-model="context.options[option.key]" default-value="option.defaultValue"
|
||||||
|
on-change-value="setOption(key, value, optionStatus)"></ng-setting>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
Reference in a new issue