Commit 805181a0 by Bence Dányi

firewall_gui: autocomplete for usernames

parent 87c7b63c
...@@ -293,7 +293,7 @@ function EntityController(url, init) { ...@@ -293,7 +293,7 @@ function EntityController(url, init) {
} }
$http.get(url + id + '/').success(function success(data) { $http.get(url + id + '/').success(function success(data) {
$scope.entity = data; $scope.entity = data;
['vlan', 'vlangroup', 'host', 'hostgroup', 'firewall'].forEach(function(t) { ['vlan', 'vlangroup', 'host', 'hostgroup', 'firewall', 'owner', 'domain', 'record'].forEach(function(t) {
$('.' + t).typeahead({ $('.' + t).typeahead({
/** /**
* Typeahead does AJAX queries * Typeahead does AJAX queries
......
...@@ -56,7 +56,7 @@ ...@@ -56,7 +56,7 @@
<div class="control-group" ng-class="hasError('owner')"> <div class="control-group" ng-class="hasError('owner')">
<label class="control-label" for="owner">Owner</label> <label class="control-label" for="owner">Owner</label>
<div class="controls"> <div class="controls">
<input type="text" autocomplete="off" id="owner" ng-model="entity.owner.name" /> <input type="text" class="owner" autocomplete="off" id="owner" ng-model="entity.owner.name" />
<span class="help-inline" ng-bind="getError('owner')"></span> <span class="help-inline" ng-bind="getError('owner')"></span>
</div> </div>
</div> </div>
......
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
<div class="control-group" ng-class="hasError('owner')"> <div class="control-group" ng-class="hasError('owner')">
<label class="control-label" for="owner">Owner</label> <label class="control-label" for="owner">Owner</label>
<div class="controls"> <div class="controls">
<input type="text" autocomplete="off" id="owner" ng-model="entity.owner.name" /> <input type="text" class="owner" autocomplete="off" id="owner" ng-model="entity.owner.name" />
<span class="help-inline" ng-bind="getError('owner')"></span> <span class="help-inline" ng-bind="getError('owner')"></span>
</div> </div>
</div> </div>
......
...@@ -58,7 +58,7 @@ ...@@ -58,7 +58,7 @@
<div class="control-group" ng-class="hasError('owner')"> <div class="control-group" ng-class="hasError('owner')">
<label class="control-label" for="owner">Owner</label> <label class="control-label" for="owner">Owner</label>
<div class="controls"> <div class="controls">
<input type="text" autocomplete="off" id="owner" ng-model="entity.owner.name" /> <input type="text" class="owner" autocomplete="off" id="owner" ng-model="entity.owner.name" />
<span class="help-inline" ng-bind="getError('owner')"></span> <span class="help-inline" ng-bind="getError('owner')"></span>
</div> </div>
</div> </div>
......
...@@ -55,7 +55,7 @@ ...@@ -55,7 +55,7 @@
<div class="control-group" ng-class="hasError('owner')"> <div class="control-group" ng-class="hasError('owner')">
<label class="control-label" for="owner">Owner</label> <label class="control-label" for="owner">Owner</label>
<div class="controls"> <div class="controls">
<input type="text" autocomplete="off" id="owner" ng-model="entity.owner.name" /> <input type="text" class="owner" autocomplete="off" id="owner" ng-model="entity.owner.name" />
<span class="help-inline" ng-bind="getError('owner')"></span> <span class="help-inline" ng-bind="getError('owner')"></span>
</div> </div>
</div> </div>
......
...@@ -56,7 +56,7 @@ ...@@ -56,7 +56,7 @@
<div class="control-group" ng-class="hasError('owner')"> <div class="control-group" ng-class="hasError('owner')">
<label class="control-label" for="owner">Owner</label> <label class="control-label" for="owner">Owner</label>
<div class="controls"> <div class="controls">
<input type="text" autocomplete="off" id="owner" ng-model="entity.owner.name" /> <input type="text" class="owner" autocomplete="off" id="owner" ng-model="entity.owner.name" />
<span class="help-inline" ng-bind="getError('owner')"></span> <span class="help-inline" ng-bind="getError('owner')"></span>
</div> </div>
</div> </div>
......
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
<div class="control-group" ng-class="hasError('owner')"> <div class="control-group" ng-class="hasError('owner')">
<label class="control-label" for="owner">Owner</label> <label class="control-label" for="owner">Owner</label>
<div class="controls"> <div class="controls">
<input type="text" autocomplete="off" id="owner" ng-model="entity.owner.name" /> <input type="text" class="owner" autocomplete="off" id="owner" ng-model="entity.owner.name" />
<span class="help-inline" ng-bind="getError('owner')"></span> <span class="help-inline" ng-bind="getError('owner')"></span>
</div> </div>
</div> </div>
......
...@@ -433,9 +433,10 @@ def autocomplete(request, entity): ...@@ -433,9 +433,10 @@ def autocomplete(request, entity):
'firewall': make_autocomplete(Firewall), 'firewall': make_autocomplete(Firewall),
'domain': make_autocomplete(Domain), 'domain': make_autocomplete(Domain),
'record': make_autocomplete(Record), 'record': make_autocomplete(Record),
'owner': make_autocomplete(User, 'username')
}[entity](request) }[entity](request)
except Exception as e: except Exception as e:
return HttpResponse('>:-3', status=500) return HttpResponse('>:-3'+str(e), status=500)
def set_field(object, attr, errors, **kwargs): def set_field(object, attr, errors, **kwargs):
......
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 sign in to comment