fixes to main app to support reports
This commit is contained in:
@@ -5,6 +5,9 @@ use Dancer ':syntax';
|
|||||||
get '/report/*' => sub {
|
get '/report/*' => sub {
|
||||||
my ($tag) = splat;
|
my ($tag) = splat;
|
||||||
|
|
||||||
|
# trick the ajax into working as if this were a tabbed page
|
||||||
|
params->{tab} = $tag;
|
||||||
|
|
||||||
var(nav => 'reports');
|
var(nav => 'reports');
|
||||||
template 'report', {
|
template 'report', {
|
||||||
report => setting('reports')->{ $tag },
|
report => setting('reports')->{ $tag },
|
||||||
|
|||||||
@@ -44,7 +44,8 @@ function do_search (event, tab) {
|
|||||||
|
|
||||||
// update browser search history with the new query.
|
// update browser search history with the new query.
|
||||||
// however if it's the same tab, this is a *replace* of the query url.
|
// however if it's the same tab, this is a *replace* of the query url.
|
||||||
if (window.History && window.History.enabled) {
|
// and just skip this bit if it's the reports display.
|
||||||
|
if (path != 'report' && window.History && window.History.enabled) {
|
||||||
is_from_history_plugin = 1;
|
is_from_history_plugin = 1;
|
||||||
window.History.replaceState(
|
window.History.replaceState(
|
||||||
{name: tab, fields: $(form).serializeArray()},
|
{name: tab, fields: $(form).serializeArray()},
|
||||||
|
|||||||
0
Netdisco/share/views/ajax/report/duplexmismatch.tt
Normal file
0
Netdisco/share/views/ajax/report/duplexmismatch.tt
Normal file
@@ -7,6 +7,11 @@
|
|||||||
$('[% "#${tab.tag}_form" %]').submit(function(event){ do_search(event, '[% tab.tag %]'); });
|
$('[% "#${tab.tag}_form" %]').submit(function(event){ do_search(event, '[% tab.tag %]'); });
|
||||||
[% END %]
|
[% END %]
|
||||||
|
|
||||||
|
// and for the reports page
|
||||||
|
[% IF report %]
|
||||||
|
$('[% "#${report.tag}_form" %]').submit(function(event){ do_search(event, '[% report.tag %]'); });
|
||||||
|
[% END %]
|
||||||
|
|
||||||
// on page load, load the content for the active tab
|
// on page load, load the content for the active tab
|
||||||
[% IF params.tab %]
|
[% IF params.tab %]
|
||||||
$('#[% params.tab %]_form').trigger("submit");
|
$('#[% params.tab %]_form').trigger("submit");
|
||||||
|
|||||||
11
Netdisco/share/views/js/report.js
Normal file
11
Netdisco/share/views/js/report.js
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
// used by the tabbing interface to make sure the correct
|
||||||
|
// ajax content is loaded
|
||||||
|
var path = 'report';
|
||||||
|
|
||||||
|
// 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) { }
|
||||||
|
|
||||||
|
// on load, check initial Device Search Options form state,
|
||||||
|
// and on each change to the form fields
|
||||||
|
$(document).ready(function() { });
|
||||||
@@ -12,7 +12,6 @@
|
|||||||
<div id="[% report.tag %]_search" class="tab-pane active">
|
<div id="[% report.tag %]_search" class="tab-pane active">
|
||||||
<form id="[% report.tag %]_form" class="nd_sidesearchform form-stacked"
|
<form id="[% report.tag %]_form" class="nd_sidesearchform form-stacked"
|
||||||
method="get" action="[% uri_for('/report') %]">
|
method="get" action="[% uri_for('/report') %]">
|
||||||
<input name="tab" value="[% report.tag %]" type="hidden"/>
|
|
||||||
[% TRY %]
|
[% TRY %]
|
||||||
[% INCLUDE "sidebar/report/${report.tag}.tt" %]
|
[% INCLUDE "sidebar/report/${report.tag}.tt" %]
|
||||||
<script type="text/javascript">has_sidebar["[% report.tag %]"] = 1;</script>
|
<script type="text/javascript">has_sidebar["[% report.tag %]"] = 1;</script>
|
||||||
@@ -33,3 +32,7 @@
|
|||||||
<div class="tab-pane active" id="[% report.tag %]_pane"></div>
|
<div class="tab-pane active" id="[% report.tag %]_pane"></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<script type="text/javascript">
|
||||||
|
[%+ INCLUDE 'js/report.js' -%]
|
||||||
|
</script>
|
||||||
|
|||||||
Reference in New Issue
Block a user