- try to reduce code duplication by using same route handler for ajax and csv, using request->is_ajax to switch the template, and set content-type - use new HTML5 "download" attribute on links so content-disposition header is no longer necessary - download CSV icon is placed on all tables (per report/device/serach section) - update download CSV link using javascript just before table content is fetched - this is necessary to make sure updated sidebar query params are included The idea here is to allow us to support CSV download in the pages which display tables by only doing the following: - (existing routes:) replace "ajax" with "get" route handler - add logic to switch template in handler, based on request->is_ajax - write _csv.tt version of the template, to spit out CSV file content This makes it much easier for new devs to write reports supporting CSV, I think?
44 lines
1.8 KiB
Plaintext
44 lines
1.8 KiB
Plaintext
<i class="nd_sidebar-toggle icon-wrench icon-large" id="nd_sidebar-toggle-img-out"
|
|
rel="tooltip" data-placement="left" data-offset="5" data-title="Show Sidebar"></i>
|
|
<div class="container-fluid">
|
|
<div class="nd_sidebar nd_sidebar-pinned">
|
|
<div class="well">
|
|
<i class="nd_sidebar-toggle icon-signout" id="nd_sidebar-toggle-img-in"
|
|
rel="tooltip" data-placement="left" data-offset="5" data-title="Hide Sidebar"></i>
|
|
<i class="nd_sidebar-pin icon-pushpin nd_sidebar-pin-clicked"
|
|
rel="tooltip" data-placement="left" data-offset="5" data-title="Unpin Sidebar"></i>
|
|
|
|
<div class="tab-content">
|
|
<div id="[% report.tag %]_search" class="tab-pane active">
|
|
<form id="[% report.tag %]_form" class="nd_sidebar-form form-stacked"
|
|
method="get" action="[% uri_for('/report') %]">
|
|
[% TRY %]
|
|
[% INCLUDE "sidebar/report/${report.tag}.tt" %]
|
|
<script type="text/javascript">has_sidebar["[% report.tag %]"] = 1;</script>
|
|
[% CATCH %]
|
|
<script type="text/javascript">has_sidebar["[% report.tag %]"] = 0;</script>
|
|
[% END %]
|
|
</form>
|
|
</div> <!-- /tab-pane -->
|
|
</div> <!-- /tab-content -->
|
|
</div>
|
|
</div>
|
|
|
|
<div class="content">
|
|
<ul id="nd_search-results" class="nav nav-tabs">
|
|
<li class="active"><a id="[% report.tag %]_link" class="nd_single-tab"
|
|
href="#[% report.tag %]_pane">[% report.label %]</a></li>
|
|
<span id="nd_device-name">
|
|
<a id="nd_csv-download" href="#" download="netdisco_report.csv">
|
|
<i id="nd_csv-download-icon" class="icon-file-text-alt"></i></a>
|
|
</span>
|
|
</ul>
|
|
<div class="tab-content">
|
|
<div class="tab-pane active" id="[% report.tag %]_pane"></div>
|
|
</div>
|
|
</div>
|
|
|
|
<script type="text/javascript">
|
|
[%+ INCLUDE 'js/report.js' -%]
|
|
</script>
|