Make dynamic select form turn on or off using checkbox

This commit is contained in:
AhyoungRyu 2017-03-06 20:08:31 +09:00
parent 252055571b
commit f2e32592ba
3 changed files with 41 additions and 14 deletions

View file

@ -89,6 +89,18 @@ limitations under the License.
</a>
</li>
<li role="separator" class="divider"></li>
<li style="padding-top:8px"
ng-if="paragraph.settings.forms[$root.keys(paragraph.settings.forms)].options &&
paragraph.settings.forms[$root.keys(paragraph.settings.forms)].type != 'checkbox'">
<span ng-if="isAutoRunTrue == true" class="fa fa-toggle-on shortcut-icon" style="padding:3px 8px 8px 20px"></span>
<span ng-if="isAutoRunTrue == false" class="fa fa-toggle-off shortcut-icon" style="padding:3px 8px 8px 20px"></span>Auto Run
<form style="display:inline; float:right">
<input type="checkbox"
style="width:16px; margin-right:20px"
ng-model="isAutoRunTrue"
ng-change="turnOnAutoRun()"/>
</form>
</li>
<li>
<a ng-click="$event.stopPropagation()" class="dropdown"><span class="fa fa-arrows-h shortcut-icon"></span>Width
<form style="display:inline; margin-left:5px; float:right">

View file

@ -19,33 +19,41 @@ limitations under the License.
ng-init="loadForm(formulaire, paragraph.settings.params)">
<label class="control-label input-sm" ng-class="{'disable': paragraph.status == 'RUNNING' || paragraph.status == 'PENDING' }">{{formulaire.name}}</label>
<div>
<input class="form-control input-sm"
ng-if="!paragraph.settings.forms[formulaire.name].options"
ng-enter="runParagraphFromButton(getEditorValue())"
ng-model="paragraph.settings.params[formulaire.name]"
ng-class="{'disable': paragraph.status == 'RUNNING' || paragraph.status == 'PENDING' }"
name="{{formulaire.name}}" />
</div>
<div ng-if="isAutoRunTrue == true">
<select class="form-control input-sm"
ng-if="paragraph.settings.forms[formulaire.name].options && paragraph.settings.forms[formulaire.name].type != 'checkbox'"
ng-enter="runParagraphFromButton(getEditorValue())"
ng-change="runParagraphFromButton(getEditorValue())"
ng-model="paragraph.settings.params[formulaire.name]"
ng-class="{'disable': paragraph.status == 'RUNNING' || paragraph.status == 'PENDING' }"
name="{{formulaire.name}}"
ng-options="option.value as (option.displayName||option.value) for option in paragraph.settings.forms[formulaire.name].options">
</select>
<div ng-if="paragraph.settings.forms[formulaire.name].type == 'checkbox'">
<label ng-repeat="option in paragraph.settings.forms[formulaire.name].options"
class="checkbox-item input-sm">
<input type="checkbox"
ng-class="{'disable': paragraph.status == 'RUNNING' || paragraph.status == 'PENDING' }"
ng-checked="paragraph.settings.params[formulaire.name].indexOf(option.value) > -1"
ng-click="toggleCheckbox(formulaire, option, false)"/>{{option.displayName||option.value}}
</label>
</div>
</div>
<div ng-if="isAutoRunTrue == false">
<select class="form-control input-sm"
ng-if="paragraph.settings.forms[formulaire.name].options && paragraph.settings.forms[formulaire.name].type != 'checkbox'"
ng-enter="runParagraphFromButton(getEditorValue())"
ng-model="paragraph.settings.params[formulaire.name]"
ng-class="{'disable': paragraph.status == 'RUNNING' || paragraph.status == 'PENDING' }"
name="{{formulaire.name}}"
ng-options="option.value as (option.displayName||option.value) for option in paragraph.settings.forms[formulaire.name].options">
</select>
</div>
<div ng-if="paragraph.settings.forms[formulaire.name].type == 'checkbox'">
<label ng-repeat="option in paragraph.settings.forms[formulaire.name].options"
class="checkbox-item input-sm">
<input type="checkbox"
ng-class="{'disable': paragraph.status == 'RUNNING' || paragraph.status == 'PENDING' }"
ng-checked="paragraph.settings.params[formulaire.name].indexOf(option.value) > -1"
ng-click="toggleCheckbox(formulaire, option, false)"/>{{option.displayName||option.value}}
</label>
</div>
</div>
</form>

View file

@ -25,6 +25,7 @@ function ParagraphCtrl($scope, $rootScope, $route, $window, $routeParams, $locat
'ngInject';
var ANGULAR_FUNCTION_OBJECT_NAME_PREFIX = '_Z_ANGULAR_FUNC_';
$rootScope.keys = Object.keys;
$scope.parentNote = null;
$scope.paragraph = {};
$scope.paragraph.results = {};
@ -113,6 +114,8 @@ function ParagraphCtrl($scope, $rootScope, $route, $window, $routeParams, $locat
if (!$scope.paragraph.config) {
$scope.paragraph.config = {};
}
// set dynamic select form's 'Auto Run' true by default
$scope.isAutoRunTrue = true;
noteVarShareService.put($scope.paragraph.id + '_paragraphScope', paragraphScope);
@ -376,6 +379,10 @@ function ParagraphCtrl($scope, $rootScope, $route, $window, $routeParams, $locat
$scope.runParagraph(paragraphText, false, false)
};
$scope.turnOnAutoRun = function () {
$scope.isAutoRunTrue = !$scope.isAutoRunTrue;
};
$scope.moveUp = function(paragraph) {
$scope.$emit('moveParagraphUp', paragraph);
};