Modal confirm dialogs for dangerous actions.

Squashed commit of the following:

commit 80513dd206
Author: Oliver Gorwits <oliver@cpan.org>
Date:   Sat Aug 31 08:26:39 2013 +0100

    use blockquote to make dialog more readable

commit bab8e4d00c
Author: Oliver Gorwits <oliver@cpan.org>
Date:   Sat Aug 31 08:16:49 2013 +0100

    add confirm dialog to user delete

commit 46c7d54973
Author: Oliver Gorwits <oliver@cpan.org>
Date:   Sat Aug 31 07:46:52 2013 +0100

    add confirm dialog to pseudo device delete

commit 00f26b92a9
Author: Oliver Gorwits <oliver@cpan.org>
Date:   Sat Aug 31 07:41:41 2013 +0100

    restore aria header ref

commit 1c04d32cd2
Author: Oliver Gorwits <oliver@cpan.org>
Date:   Sat Aug 31 07:38:39 2013 +0100

    add confirm dialog to topo link delete

commit 914a03a19c
Author: Oliver Gorwits <oliver@cpan.org>
Date:   Sat Aug 31 07:12:59 2013 +0100

    tidy dialogs

commit e4c3978ba8
Author: Oliver Gorwits <oliver@cpan.org>
Date:   Fri Aug 30 23:37:55 2013 +0100

    remove attr("data-

commit 626c8c3fdd
Author: Oliver Gorwits <oliver@cpan.org>
Date:   Fri Aug 30 23:36:47 2013 +0100

    log message for port controls

commit b614669c0c
Author: Oliver Gorwits <oliver@cpan.org>
Date:   Fri Aug 30 21:23:22 2013 +0100

    swap attr for data

commit 79ce5ec47d
Author: Oliver Gorwits <oliver@cpan.org>
Date:   Fri Aug 30 21:09:41 2013 +0100

    improve delete modal and add log message

commit 601671b383
Author: Oliver Gorwits <oliver@cpan.org>
Date:   Tue Aug 27 22:46:43 2013 +0100

    modal dialog which calls ajax
This commit is contained in:
Oliver Gorwits
2013-08-31 08:29:41 +01:00
parent aa2a5e3b20
commit c75167fe27
9 changed files with 213 additions and 52 deletions

View File

@@ -27,7 +27,8 @@
$('#nd_netmap-help').hide();
}
// activate tooltips and popovers
// activate modals, tooltips and popovers
$('.nd_modal').modal({show: false});
$("[rel=tooltip]").tooltip({live: true});
$("[rel=popover]").popover({live: true});
}
@@ -37,7 +38,7 @@
var tab = '[% tab.tag %]'
var target = '#' + tab + '_pane';
// sidebar form fields should change colour and have bin/copy icon
// sidebar form fields should change colour and have trash/copy icon
form_inputs.each(function() {device_form_state($(this))});
form_inputs.change(function() {device_form_state($(this))});
@@ -52,7 +53,7 @@
.toggleClass('icon-chevron-up icon-chevron-down');
});
// handler for bin icon in port filter box
// handler for trashcan icon in port filter box
var portfilter = $('#ports_form').find("input[name=f]");
$('.nd_field-clear-icon').click(function() {
portfilter.val('');
@@ -101,15 +102,24 @@
,async: true
,dataType: 'html'
,url: uri_base + '/ajax/control/admin/' + mode
,data: tr.find('input[data-form="' + mode + '"]').serializeArray()
,data: tr.find('input[data-form="' + mode + '"],textarea[data-form="' + mode + '"]').serializeArray()
,success: function() {
toastr.info('Queued '+ mode +' for device '+ tr.attr('data-for-device'));
toastr.info('Queued '+ mode +' for device '+ tr.data('for-device'));
}
// skip any error reporting for now
// TODO: fix sanity_ok in Netdisco Web
,error: function() {
toastr.error('Failed to queue '+ mode +' for device '+ tr.attr('data-for-device'));
toastr.error('Failed to queue '+ mode +' for device '+ tr.data('for-device'));
}
});
});
// bootstrap modal mucks about with mouse actions on higher elements
// so need to bury and raise it when needed
$('#ports_pane').on('show', '.nd_modal', function () {
$(this).toggleClass('nd_deep-horizon');
});
$('#ports_pane').on('hidden', '.nd_modal', function () {
$(this).toggleClass('nd_deep-horizon');
});
});