- 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?
		
			
				
	
	
		
			24 lines
		
	
	
		
			816 B
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
			
		
		
	
	
			24 lines
		
	
	
		
			816 B
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
| <table class="table table-bordered table-condensed table-striped nd_floatinghead">
 | |
|   <thead>
 | |
|     <tr>
 | |
|       <th>Device</th>
 | |
|       <th class="nd_center-cell">Port</th>
 | |
|       <th class="nd_center-cell">Description</th>
 | |
|       <th class="nd_center-cell">Duplex</th>
 | |
|     </tr>
 | |
|   </thead>
 | |
|   </tbody>
 | |
|     [% WHILE (row = results.next) %]
 | |
|     <tr>
 | |
|       <td>[% row.device.dns || row.device.ip | html_entity %]</td>
 | |
|       <td class="nd_center-cell"><a class="nd_linkcell"
 | |
|         href="[% device_ports %]&q=[% row.device.dns || row.device.ip | uri %]&f=[% row.port | uri %]&c_duplex=on">
 | |
|           [% row.port | html_entity %]</a></td>
 | |
|       <td class="nd_center-cell">[% row.name | html_entity %]</td>
 | |
|       <td class="nd_center-cell">[% row.duplex.ucfirst | html_entity %]</td>
 | |
|     </tr>
 | |
|     [% END %]
 | |
|   </tbody>
 | |
| </table>
 | |
| 
 |