summaryrefslogtreecommitdiffstats
path: root/modules-available/locations/templates/locations.html
diff options
context:
space:
mode:
authorUdo Walter2017-09-13 17:01:30 +0200
committerUdo Walter2017-09-13 17:01:30 +0200
commit1724b55abdfcee25fe58f5f9fb763e99081043c9 (patch)
tree9864db93b8e1721559f7584a534246ce2123cff9 /modules-available/locations/templates/locations.html
parent[js_stupidtable] fixed stupidtable not working with collapsed tables (diff)
downloadslx-admin-1724b55abdfcee25fe58f5f9fb763e99081043c9.tar.gz
slx-admin-1724b55abdfcee25fe58f5f9fb763e99081043c9.tar.xz
slx-admin-1724b55abdfcee25fe58f5f9fb763e99081043c9.zip
[locations] fixed inconsistencies + small design changes
Diffstat (limited to 'modules-available/locations/templates/locations.html')
-rw-r--r--modules-available/locations/templates/locations.html46
1 files changed, 32 insertions, 14 deletions
diff --git a/modules-available/locations/templates/locations.html b/modules-available/locations/templates/locations.html
index c2dc610e..15dcdd42 100644
--- a/modules-available/locations/templates/locations.html
+++ b/modules-available/locations/templates/locations.html
@@ -1,6 +1,7 @@
<div>
- <div class="pull-right">
- <a href="?do=Locations&amp;action=showsubnets">{{lang_thisListBySubnet}}</a>
+ <div class="btn-group pull-right">
+ <a href="?do=Locations&amp;action=showlocations" class="btn btn-primary"><span class="glyphicon glyphicon-home"></span> {{lang_thisListByLocation}}</a>
+ <a href="?do=Locations&amp;action=showsubnets" class="btn btn-default"><span class="glyphicon glyphicon-list-alt"></span> {{lang_thisListBySubnet}}</a>
</div>
<h1>{{lang_locationsMainHeading}}</h1>
<table class="table table-condensed locations" style="margin-bottom:0px">
@@ -84,15 +85,17 @@
<input type="hidden" name="action" value="addlocations">
<table class="table table-condensed table-hover">
<tr id="lasttr">
- <td>
- <button class="btn btn-success btn-sm" type="button" onclick="slxAddLocationRow()">
+ <td width="50%">&emsp;</td>
+ <td class="text-right" colspan="2">
+ <button id="saveLocationRows" type="submit" class="btn btn-primary" style="display: none">
+ <span class="glyphicon glyphicon-floppy-disk"></span> {{lang_save}}
+ </button>
+ <button class="btn btn-success" type="button" onclick="slxAddLocationRow()">
<span class="glyphicon glyphicon-plus-sign"></span> {{lang_location}}
</button>
+
</td>
- <td width="80%">&emsp;</td>
- <td width="20%" align="right">
- <button type="submit" class="btn btn-primary">{{lang_save}}</button>
- </td>
+
</tr>
</table>
</form>
@@ -111,17 +114,29 @@
var slxAddCounter = 0;
var slxLastLocation = false;
+var newRowCounter = 0;
+
function slxAddLocationRow() {
+ $("#saveLocationRows").show();
var tr = $('#lasttr');
- tr.before('<tr>\
- <td>#</td>\
+ tr.before('<tr id="row' + slxAddCounter + '">\
<td><input class="form-control" type="text" name="newlocation[' + slxAddCounter + ']" placeholder="{{lang_locationName}}" pattern=".*\\S.*"></td>\
<td><select class="form-control" name="newparent[' + slxAddCounter + ']">\
<option value="0">{{lang_noParent}}</option>\
{{#list}}<option value="{{locationid}}">{{locationpad}} {{locationname}}</option>{{/list}}\
</select></td>\
+ <td class="text-center"><button class="btn btn-default btn-sm" type="button" onclick="removeNewLocationRow(' + slxAddCounter + ')"><span class="glyphicon glyphicon-remove-sign"></span></button></td>\
</tr>');
slxAddCounter++;
+ newRowCounter++;
+}
+
+function removeNewLocationRow(r) {
+ $("#row"+r).remove();
+ newRowCounter--;
+ if (newRowCounter === 0) {
+ $("#saveLocationRows").hide();
+ }
}
function slxOpenLocation(e, lid) {
@@ -134,7 +149,7 @@ function slxOpenLocation(e, lid) {
if (existing.is(slxLastLocation)) {
slxLastLocation = false;
} else {
- existing.show()[0].scrollIntoView();
+ existing.show();
$(e).closest('tr').addClass('active slx-bold');
slxLastLocation = existing;
}
@@ -146,23 +161,26 @@ function slxOpenLocation(e, lid) {
$(e).closest('tr').addClass('active slx-bold').after(tr);
td.load('?do=Locations&action=showlocation&locationid=' + lid, function() {
slxAttachCidr();
- $('#location-details-' + lid)[0].scrollIntoView();
});
slxLastLocation = tr;
}
function slxAddSubnetRow(e, lid) {
var tr = $('#loc-sub-' + lid);
- tr.before('<tr class="cidrmagic">\
+ tr.before('<tr id="row' + slxAddCounter + '" class="cidrmagic">\
<td>#</td>\
<td><input class="form-control cidrstart" type="text" name="newstartaddr[' + slxAddCounter + ']" pattern="\\d{1,3}\.\\d{1,3}\.\\d{1,3}\.\\d{1,3}"></td>\
<td><input class="form-control cidrend" type="text" name="newendaddr[' + slxAddCounter + ']" pattern="\\d{1,3}\.\\d{1,3}\.\\d{1,3}\.\\d{1,3}"></td>\
- <td></td>\
+ <td class="text-center"><button class="btn btn-default btn-sm" type="button" onclick="removeNewSubnetRow(' + slxAddCounter + ')"><span class="glyphicon glyphicon-remove-sign"></span></button></td>\
</tr>');
slxAddCounter++;
slxAttachCidr();
}
+function removeNewSubnetRow(r) {
+ $("#row"+r).remove();
+}
+
function slxConfirm() {
return confirm('{{lang_areYouSureNoUndo}}');
}