From 4295ddb32a3d8256f9c084762f7f967c43e944e2 Mon Sep 17 00:00:00 2001 From: Bence Dányi <madbence@gmail.com> Date: Tue, 7 May 2013 15:03:04 +0200 Subject: [PATCH] firewall_gui: foreign network listing & typeahead added --- firewall_gui/static/js/project.js | 17 +++++++++++++++++ firewall_gui/static/partials/rule-edit.html | 6 ++++++ 2 files changed, 23 insertions(+) diff --git a/firewall_gui/static/js/project.js b/firewall_gui/static/js/project.js index c442947..9423f1c 100644 --- a/firewall_gui/static/js/project.js +++ b/firewall_gui/static/js/project.js @@ -136,6 +136,23 @@ function EntityController(url) { return true; } }); + $('#foreignNetwork').typeahead({ + source: function(query, process) { + $.ajax({ + url: '/firewall/autocomplete/vlangroup/', + type: 'post', + data: 'name=' + query, + success: function autocompleteSuccess(data) { + process(data.map(function(obj) { + return obj.name; + })); + } + }); + }, + matcher: function() { + return true; + } + }); }); } } diff --git a/firewall_gui/static/partials/rule-edit.html b/firewall_gui/static/partials/rule-edit.html index 447ea4f..b5b8659 100644 --- a/firewall_gui/static/partials/rule-edit.html +++ b/firewall_gui/static/partials/rule-edit.html @@ -45,6 +45,12 @@ </div> </div> <div class="control-group"> + <label class="control-label" for="foreignNetwork">Foreign network</label> + <div class="controls"> + <input type="text" data-provide="typeahead" autocomplete="off" id="foreignNetwork" value="{{rule.foreignNetwork.name}}" /> + </div> + </div> + <div class="control-group"> <div class="controls"> <label class="checkbox"> <input type="checkbox"> Remember me -- libgit2 0.26.0