Removing validation because regex is hard

This commit is contained in:
kevgliss 2016-04-25 16:13:33 -07:00
parent 9b0e0fa9c2
commit 8e1b7c0036
2 changed files with 64 additions and 0 deletions

View File

@ -0,0 +1,33 @@
'use strict';
angular.module('lemur')
.controller('DomainsCreateController', function ($scope, $modalInstance, PluginService, DomainService, LemurRestangular){
$scope.domain = LemurRestangular.restangularizeElement(null, {}, 'domains');
$scope.save = function (domain) {
DomainService.create(domain).then(function () {
$modalInstance.close();
});
};
$scope.cancel = function () {
$modalInstance.dismiss('cancel');
};
})
.controller('DomainsEditController', function ($scope, $modalInstance, DomainService, DomainApi, editId) {
DomainApi.get(editId).then(function (domain) {
$scope.domain = domain;
});
$scope.save = function (domain) {
DomainService.update(domain).then(function () {
$modalInstance.close();
});
};
$scope.cancel = function () {
$modalInstance.dismiss('cancel');
};
});

View File

@ -0,0 +1,31 @@
<div class="modal-header">
<button type="button" class="close" ng-click="cancel()" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h3><span ng-show="!domain.fromServer">Create</span><span ng-show="domain.fromServer">Edit</span> Destination <span class="text-muted"><small>oh the places you will go!</small></span></h3>
</div>
<div class="modal-body">
<form name="createForm" class="form-horizontal" role="form" novalidate>
<div class="form-group"
ng-class="{'has-error': createForm.label.$invalid, 'has-success': !createForm.label.$invalid&&createForm.label.$dirty}">
<label class="control-label col-sm-2">
Name
</label>
<div class="col-sm-10">
<input name="label" ng-model="domain.name" placeholder="Label" class="form-control" required/>
<p ng-show="createForm.label.$invalid && !createForm.label.$pristine" class="help-block">You must enter an domain name</p>
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-2">
Sensitive
</label>
<div class="col-sm-10">
<checkbox name="sensitive" ng-model="domain.sensitive" class="form-control" ></checkbox>
</div>
</div>
</form>
</div>
<div class="modal-footer">
<button ng-click="save(domain)" type="submit" ng-disabled="createForm.$invalid" class="btn btn-primary">Save</button>
<button ng-click="cancel()" class="btn btn-danger">Cancel</button>
</div>