The reason for this is that DataTables keys local data on the page path, so each tab should have its own path. We're already doing this for reports and admin tasks, so it also makes sense to have consistency with search and device tabs. Squashed commit of the following: commit 4ad33a23a81122496adfe561ad14f039e6255eff Author: Oliver Gorwits <oliver@cpan.org> Date: Sat Oct 25 14:46:17 2014 +0100 fix search preference selection commit 363e094935d386961e8773f787af41c46b83129a Author: Oliver Gorwits <oliver@cpan.org> Date: Sat Oct 25 14:36:45 2014 +0100 fix css selector to match begins with /search commit 43c972ee0d9401f74dcc3bd30052dba130b0d068 Author: Oliver Gorwits <oliver@cpan.org> Date: Sat Oct 25 14:18:24 2014 +0100 fix history push commit 84f83eb46874b0222c0484014389713e4f027c8a Author: Oliver Gorwits <oliver@cpan.org> Date: Sat Oct 25 14:06:44 2014 +0100 update sidebar form for tab-path, remove hidden tab name field commit 344d4679a83f714c998cd475c041f8effab0c696 Author: Oliver Gorwits <oliver@cpan.org> Date: Sat Oct 25 14:05:49 2014 +0100 update template links for tab path commit 9cf370d7eb4413aac6fc19c2c13a9bf670600965 Author: Oliver Gorwits <oliver@cpan.org> Date: Sat Oct 25 14:04:57 2014 +0100 move tab-specific JS from common into specific includes files commit c2d8592a18e389535368d1e74fed29fe5a0eabd8 Author: Oliver Gorwits <oliver@cpan.org> Date: Sat Oct 25 14:02:46 2014 +0100 fix mode commit 52487cea47eaaea7f5c74536ad6d4bb2a8d6ba4c Author: Oliver Gorwits <oliver@cpan.org> Date: Sat Oct 25 14:01:15 2014 +0100 move from tab param to tabname template var commit b5a2424631a0050d5de3bc658746a40cd822e869 Merge:531782bd8102bfAuthor: Oliver Gorwits <oliver@cpan.org> Date: Sat Oct 25 10:50:00 2014 +0100 Merge branch 'master' into em-device-ports-json
64 lines
2.1 KiB
JavaScript
64 lines
2.1 KiB
JavaScript
// used by the tabbing interface to make sure the correct
|
|
// ajax content is loaded
|
|
var path = 'report';
|
|
|
|
// colored input fields in the Report Options sidebar forms
|
|
var form_inputs = $(".nd_colored-input");
|
|
|
|
// this is called by do_search to support local code
|
|
// here, when tab changes need to strike/unstrike the navbar search
|
|
function inner_view_processing(tab) {
|
|
|
|
// activate modals, tooltips and popovers
|
|
$('.nd_modal').modal({show: false});
|
|
$("[rel=tooltip]").tooltip({live: true});
|
|
$("[rel=popover]").popover({live: true});
|
|
}
|
|
|
|
// on load, check initial Report Options form state,
|
|
// and on each change to the form fields
|
|
$(document).ready(function() {
|
|
var tab = '[% report.tag %]'
|
|
var target = '#' + tab + '_pane';
|
|
|
|
// sidebar form fields should change colour and have trash icon
|
|
form_inputs.each(function() {device_form_state($(this))});
|
|
form_inputs.change(function() {device_form_state($(this))});
|
|
|
|
// handler for bin icon in search forms
|
|
$('.nd_field-clear-icon').click(function() {
|
|
var name = $(this).data('btn-for');
|
|
var input = $('[name=' + name + ']');
|
|
input.val('');
|
|
device_form_state(input); // reset input field
|
|
});
|
|
|
|
$('#nd_ipinventory-subnet').on('input', function(event) {
|
|
if ($(this).val().indexOf(':') != -1) {
|
|
$('#never').attr('disabled', 'disabled');
|
|
}
|
|
else {
|
|
$('#never').removeAttr('disabled');
|
|
}
|
|
});
|
|
|
|
// activate typeahead on prefix/subnet box
|
|
$('#nd_ipinventory-subnet').autocomplete({
|
|
source: function (request, response) {
|
|
return $.get( uri_base + '/ajax/data/subnet/typeahead', request, function (data) {
|
|
return response(data);
|
|
});
|
|
}
|
|
,delay: 150
|
|
,minLength: 3
|
|
});
|
|
|
|
// for the report pages
|
|
$('[% "#${report.tag}_form" %]').submit(function (event) {
|
|
var pgtitle = update_page_title('[% report.tag %]');
|
|
update_browser_history('[% report.tag %]', pgtitle, '1');
|
|
update_csv_download_link('report', '[% report.tag %]', '1');
|
|
do_search(event, '[% report.tag %]');
|
|
});
|
|
});
|