add confirm dialog to topo link delete

This commit is contained in:
Oliver Gorwits
2013-08-31 07:38:39 +01:00
parent 914a03a19c
commit 1c04d32cd2
4 changed files with 36 additions and 6 deletions

View File

@@ -152,6 +152,11 @@ div.content > div.tab-content table.nd_floatinghead thead {
text-align: center;
}
/* undo nd_center-cell when in a modial dialog (which lives in table cell) */
.table .nd_center-cell .modal-body {
text-align: left;
}
/* fix layout of form fields inside the (topology) table */
td div.input-append {
margin-bottom: 0px;

View File

@@ -38,7 +38,9 @@
<button class="btn btn-small nd_adminbutton" name="add" type="submit"><i class="icon-plus-sign"></i> Add</button>
</td>
</tr>
[% SET count = 0 %]
[% WHILE (row = results.next) %]
[% SET count = count + 1 %]
<tr>
<td class="nd_center-cell"><a class="nd_linkcell" href="[% uri_for('/device') %]?q=[% row.dev1 | uri %]">
[% (row.device1.dns || row.device1.name || row.device1.ip) | html_entity %]</a>
@@ -48,11 +50,31 @@
[% (row.device2.dns || row.device2.name || row.device2.ip) | html_entity %]</a></td>
<td class="nd_center-cell">[% row.port2 | html_entity %]</td>
<td class="nd_center-cell">
<input data-form="del" name="dev1" type="hidden" value="[% row.dev1 | html_entity %]">
<input data-form="del" name="port1" type="hidden" value="[% row.port1 | html_entity %]">
<input data-form="del" name="dev2" type="hidden" value="[% row.dev2 | html_entity %]">
<input data-form="del" name="port2" type="hidden" value="[% row.port2 | html_entity %]">
<button class="btn nd_adminbutton" name="del" type="submit"><i class="icon-trash text-error"></i></button>
<button class="btn" data-toggle="modal"
data-target="#nd_devdel-[% count %]" type="button"><i class="icon-trash text-error"></i></button>
<div id="nd_devdel-[% count %]" class="nd_modal modal hide fade" tabindex="-1"
role="dialog"aria-hidden="true">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">x</button>
<h3>Are you sure?</h3>
</div>
<div class="modal-body">
<p>The link between these two ports will be removed:</p>
<ul>
<li>[% (row.device1.dns || row.device1.name || row.device1.ip) | html_entity %], [% row.port1 | html_entity %]</li>
<li>[% (row.device2.dns || row.device2.name || row.device2.ip) | html_entity %], [% row.port2 | html_entity %]</li>
</ul>
<input data-form="del" name="dev1" type="hidden" value="[% row.dev1 | html_entity %]">
<input data-form="del" name="port1" type="hidden" value="[% row.port1 | html_entity %]">
<input data-form="del" name="dev2" type="hidden" value="[% row.dev2 | html_entity %]">
<input data-form="del" name="port2" type="hidden" value="[% row.port2 | html_entity %]">
</div>
<div class="modal-footer">
<button class="btn btn-success" data-dismiss="modal" aria-hidden="true">Cancel</button>
<button class="btn btn-danger nd_adminbutton" name="del" data-dismiss="modal">Confirm</button>
</div>
</div>
</td>
</tr>
[% END %]

View File

@@ -106,7 +106,7 @@
<button class="btn btn-info btn-small nd_adminbutton" name="macsuck">Macsuck</button>
<button class="btn btn-danger btn-small pull-right"
data-toggle="modal" data-target="#deleteConfirm" type="button">Delete</button>
data-toggle="modal" data-target="#nd_devdel" type="button">Delete</button>
<div id="nd_devdel" class="nd_modal modal hide fade" tabindex="-1"
role="dialog" aria-labelledby="nd_devdel_label" aria-hidden="true">

View File

@@ -59,6 +59,9 @@
,delay: 150
,minLength: 0
});
// activate modals
$('.nd_modal').modal({show: false});
}
// on load, establish global delegations for now and future