Commit 1e6eaff2 authored by Cristian Weiland's avatar Cristian Weiland

Fix modal cancel option

Signed-off-by: Cristian Weiland's avatarCristian Weiland <cw14@inf.ufpr.br>
parent 4121d206
......@@ -38,10 +38,11 @@
</div>
<div class="col-xs-12">Cuidado! Alterar o subtipo poderá alterar suas respostas no campo Exemplo
e nas Opções Avançadas (Máscara e Expressão Regular).<br><br>
</div>
</div>
<div>
<div ng-show="field.type!='checkbox' && field.type!='select'">
<div ng-show="field.type=='text'">
<div class="col-xs-4 control-label">* Valores:</div>
<div class="col-xs-8 control-label">
<input class="form-group form-control" type="text" ng-disabled="true" placeholder="Opções"/>
......@@ -98,12 +99,12 @@
</div>
<div class="col-xs-12 control-label" ng-show="!field.more">
<button type="button" style="float:right" class="btn btn-default" ng-click="moreOptions()">
<button type="button" ng-disabled="field.type!='text'" style="float:right" class="btn btn-default" ng-click="editOptions(true)">
<span class="glyphicon glyphicon-plus"></span> Opções avançadas</button>
</div>
<div class="control-label" ng-show="field.more">
<button type="button" style="float:right" class="btn btn-default" ng-click="lessOptions()">
<button type="button" style="float:right" class="btn btn-default" ng-click="editOptions(false)">
<span class="glyphicon glyphicon-minus"></span> Menos opções</button>
<div class="col-xs-12">
<div class="col-xs-4 control-label">Máscara:</div>
......
......@@ -444,6 +444,7 @@ angular.module('datasid.projects',['cgBusy', 'datasid.point'])
};
$scope.cancel = function () {
// Preciso fazer o backup e recuperar ele.
$modalInstance.dismiss('cancel');
};
}
......@@ -541,12 +542,8 @@ angular.module('datasid.projects',['cgBusy', 'datasid.point'])
$scope.field.options.length--;
};
$scope.moreOptions = function () {
$scope.field.more = true;
};
$scope.lessOptions = function () {
$scope.field.more = false;
$scope.editOptions = function (param) {
$scope.field.more = param;
};
$scope.submit = function () {
......@@ -592,21 +589,31 @@ angular.module('datasid.projects',['cgBusy', 'datasid.point'])
if(!group.multivalue) {
count = (group.fields[i].options) ? group.fields[i].options.length : 2;
$scope.field = group.fields[i];
if(!$scope.field.options) {
$scope.field.options = [];
count = 1;
}
}
else {
count = (group.list.fields[i].options) ? group.list.fields[i].options.length : 2;
$scope.field = group.list.fields[i];
if(!$scope.field.options) {
$scope.field.options = [];
count = 1;
}
}
// If the user click in cancel, I have to leave everything like it was.
var backup = {
section: $scope.field.section
, title: $scope.field.title
, type: $scope.field.type
, subtype: $scope.field.subtype
, regexp: $scope.field.regexp || ''
, mask: $scope.field.mask || ''
, maskComplement: $scope.field.maskComplement || ''
, placeholder: $scope.field.placeholder || ''
};
if($scope.field.regexp) backup.regexp = $scope.field.regexp;
if($scope.field.mask) backup.mask = $scope.field.mask;
if($scope.field.maskComplement) backup.maskComplement = $scope.field.maskComplement;
$scope.$watch('field.mask', function() {
if($scope.field.mask === '')
......@@ -636,7 +643,8 @@ angular.module('datasid.projects',['cgBusy', 'datasid.point'])
});
$scope.submit = function () {
if(!$scope.field.title || !$scope.field.type || ($scope.field.type=='select' && !$scope.field.options) || !$scope.field.section) {
if(!$scope.field.title || !$scope.field.type || ($scope.field.type=='select' && !$scope.field.options)
|| !$scope.field.section) {
$alert.error('Campo obrigatório não preenchido!');
return ;
}
......@@ -690,12 +698,8 @@ angular.module('datasid.projects',['cgBusy', 'datasid.point'])
$scope.field.options.length--;
};
$scope.moreOptions = function () {
$scope.field.more = true;
};
$scope.lessOptions = function () {
$scope.field.more = false;
$scope.editOptions = function (param) {
$scope.field.more = param;
};
$scope.cancel = function () {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment