Revision 25e4ec84 templates/user_routes.html
b/templates/user_routes.html | ||
---|---|---|
28 | 28 |
</div> |
29 | 29 |
|
30 | 30 |
<div class="panel-body"> |
31 |
|
|
32 |
|
|
31 |
|
|
32 |
|
|
33 | 33 |
<div class="table-responsive"> |
34 | 34 |
<table class="table table-striped table-bordered" id="routes_table"> |
35 | 35 |
<thead> |
... | ... | |
101 | 101 |
|
102 | 102 |
|
103 | 103 |
$.fn.dataTableExt.oApi.fnReloadAjax = function ( oSettings, sNewSource, fnCallback, bStandingRedraw ) |
104 |
{
|
|
104 |
{ |
|
105 | 105 |
// DataTables 1.10 compatibility - if 1.10 then versionCheck exists. |
106 | 106 |
// 1.10s API has ajax reloading built in, so we use those abilities |
107 | 107 |
// directly. |
108 | 108 |
if ( $.fn.dataTable.versionCheck ) { |
109 | 109 |
var api = new $.fn.dataTable.Api( oSettings ); |
110 |
|
|
110 |
|
|
111 | 111 |
if ( sNewSource ) { |
112 | 112 |
api.ajax.url( sNewSource ).load( fnCallback, !bStandingRedraw ); |
113 | 113 |
} |
... | ... | |
116 | 116 |
} |
117 | 117 |
return; |
118 | 118 |
} |
119 |
|
|
119 |
|
|
120 | 120 |
if ( sNewSource !== undefined && sNewSource !== null ) { |
121 | 121 |
oSettings.sAjaxSource = sNewSource; |
122 | 122 |
} |
123 |
|
|
123 |
|
|
124 | 124 |
// Server-side processing should just call fnDraw |
125 | 125 |
if ( oSettings.oFeatures.bServerSide ) { |
126 | 126 |
this.fnDraw(); |
127 | 127 |
return; |
128 | 128 |
} |
129 |
|
|
129 |
|
|
130 | 130 |
this.oApi._fnProcessingDisplay( oSettings, true ); |
131 | 131 |
var that = this; |
132 | 132 |
var iStart = oSettings._iDisplayStart; |
133 | 133 |
var aData = []; |
134 |
|
|
134 |
|
|
135 | 135 |
this.oApi._fnServerParams( oSettings, aData ); |
136 |
|
|
136 |
|
|
137 | 137 |
oSettings.fnServerData.call( oSettings.oInstance, oSettings.sAjaxSource, aData, function(json) { |
138 | 138 |
/* Clear the old information from the table */ |
139 | 139 |
that.oApi._fnClearTable( oSettings ); |
140 |
|
|
140 |
|
|
141 | 141 |
/* Got the data - add it to the table */ |
142 | 142 |
var aData = (oSettings.sAjaxDataProp !== "") ? |
143 | 143 |
that.oApi._fnGetObjectDataFn( oSettings.sAjaxDataProp )( json ) : json; |
144 |
|
|
144 |
|
|
145 | 145 |
for ( var i=0 ; i<aData.length ; i++ ) |
146 | 146 |
{ |
147 | 147 |
that.oApi._fnAddData( oSettings, aData[i] ); |
148 | 148 |
} |
149 |
|
|
149 |
|
|
150 | 150 |
oSettings.aiDisplay = oSettings.aiDisplayMaster.slice(); |
151 |
|
|
151 |
|
|
152 | 152 |
that.fnDraw(); |
153 |
|
|
153 |
|
|
154 | 154 |
if ( bStandingRedraw === true ) |
155 | 155 |
{ |
156 | 156 |
oSettings._iDisplayStart = iStart; |
157 | 157 |
that.oApi._fnCalculateEnd( oSettings ); |
158 | 158 |
that.fnDraw( false ); |
159 | 159 |
} |
160 |
|
|
160 |
|
|
161 | 161 |
that.oApi._fnProcessingDisplay( oSettings, false ); |
162 |
|
|
162 |
|
|
163 | 163 |
/* Callback user function - for event handlers etc */ |
164 | 164 |
if ( typeof fnCallback == 'function' && fnCallback !== null ) |
165 | 165 |
{ |
... | ... | |
176 | 176 |
$(document).ready( function(){ |
177 | 177 |
|
178 | 178 |
|
179 |
|
|
179 |
|
|
180 | 180 |
oTable = $('#routes_table').dataTable( { |
181 | 181 |
"bPaginate": true, |
182 | 182 |
"bFilter": true, |
... | ... | |
193 | 193 |
"fnInitComplete": function(oSettings, json) { |
194 | 194 |
oTable.fnSetColumnVis( 0,false ); |
195 | 195 |
update_size(); |
196 |
|
|
196 |
|
|
197 | 197 |
$('body').on('click', '.revertbutton', function () { |
198 | 198 |
var my = $(this); |
199 | 199 |
my.parent().html(oldhtml); |
... | ... | |
235 | 235 |
{"mData":"id", "bSearchable": false,"bSortable": false, "bvisible":false}, |
236 | 236 |
{"mData":"name", "sClass" : "alignCenter","bSearchable": true,"bSortable": true, |
237 | 237 |
"mRender": function (data, type, full) { |
238 |
if (!full.comments.trim()) { |
|
239 |
return '<small>'+data+'</small>'; |
|
240 |
} |
|
241 |
return '<a rel="tooltip" href="#" data-toggle="tooltip" data-placement="top" title='+full.comments+'><small>'+data+'</small>' |
|
238 |
if (full.comments !== null) { |
|
239 |
if (!full.comments.trim()) { |
|
240 |
return '<small>'+data+'</small>'; |
|
241 |
} |
|
242 |
return '<a rel="tooltip" href="#" data-toggle="tooltip" data-placement="top" title='+full.comments+'><small>'+data+'</small>' |
|
243 |
} else { |
|
244 |
return 'No comments' |
|
245 |
} |
|
242 | 246 |
} |
243 | 247 |
}, |
244 | 248 |
{"mData":"match", "sClass" : "alignCenter","bSearchable": true,"bSortable": true, |
245 | 249 |
"mRender": function (data, type, full) { |
246 |
return '<small>'+data+'</small>';
|
|
250 |
return '<small>'+data+'</small>'; |
|
247 | 251 |
} |
248 | 252 |
}, |
249 | 253 |
{"mData":"then", "sClass" : "alignCenter","bSearchable": true,"bSortable": true, |
250 | 254 |
"mRender": function (data, type, full) { |
251 |
return '<small>'+data+'</small>';
|
|
255 |
return '<small>'+data+'</small>'; |
|
252 | 256 |
} |
253 | 257 |
}, |
254 | 258 |
{"mData":"status", "sClass" : "alignCenter","bSearchable": true,"bSortable": true, |
... | ... | |
259 | 263 |
return '<span class="label label-default">DEACTIVATED</span>'; |
260 | 264 |
} |
261 | 265 |
else |
262 |
{
|
|
266 |
{ |
|
263 | 267 |
if (status == "OUTOFSYNC"){ |
264 | 268 |
return '<span class="label label-danger">ERROR</span>'; |
265 | 269 |
} |
... | ... | |
280 | 284 |
return '<span class="label label-danger">'+status+'</span>'; |
281 | 285 |
} |
282 | 286 |
} |
283 |
}
|
|
287 |
} |
|
284 | 288 |
} |
285 | 289 |
}, |
286 | 290 |
{"mData":"applier", "sClass" : "alignCenter","bSearchable": true,"bSortable": true, |
287 | 291 |
"mRender": function (data, type, full) { |
288 |
return '<small>'+data+' ('+full.peer+')</small>';
|
|
292 |
return '<small>'+data+' ('+full.peer+')</small>'; |
|
289 | 293 |
} |
290 | 294 |
}, |
291 | 295 |
{"mData":"expires", "sClass" : "alignCenter","bSearchable": true,"bSortable": true, |
292 | 296 |
"mRender": function (data, type, full) { |
293 |
return '<small>'+data+'</small>';
|
|
297 |
return '<small>'+data+'</small>'; |
|
294 | 298 |
}}, |
295 | 299 |
{"mData":"response", "sClass" : "alignCenter","bSearchable": true,"bSortable": true, |
296 | 300 |
"mRender": function (data, type, full) { |
297 | 301 |
status = full.status; |
298 | 302 |
toolt = '<a rel="tooltip" href="#" data-toggle="tooltip" data-placement="top"'; |
299 |
if (status == "EXPIRED" ||status == "ADMININACTIVE" || status == "INACTIVE" || status == "OUTOFSYNC"){
|
|
303 |
if (status == "EXPIRED" ||status == "ADMININACTIVE" || status == "INACTIVE" || status == "OUTOFSYNC"){ |
|
300 | 304 |
if (status == "INACTIVE" ){ |
301 | 305 |
title = "{% trans 'Deactivated by user' %}"; |
302 | 306 |
} |
... | ... | |
325 | 329 |
editurl = "{% url edit-route 'routename' %}".replace('routename', full.name.toString()); |
326 | 330 |
if (status == "ACTIVE" ){ |
327 | 331 |
btn = '<a href="'+editurl+'" class="btn-info btn btn-sm btn-outline">{% trans "Edit" %}</a>'; |
328 |
btn = btn + ' <button class="del_buttonpre btn-warning btn btn-sm btn-outline" id="'+full.name+'" data-routename="'+full.name+'">{% trans "Deactivate" %}</button>';
|
|
332 |
btn = btn + ' <button class="del_buttonpre btn-warning btn btn-sm btn-outline" id="'+full.name+'" data-routename="'+full.name+'">{% trans "Deactivate" %}</button>'; |
|
329 | 333 |
} |
330 | 334 |
if (status == 'EXPIRED' || status == 'ADMININACTIVE' || status == 'INACTIVE' ){ |
331 | 335 |
btn = '<a href="'+editurl+'" class="btn-info btn btn-sm btn-outline" id="edit_button_{{route.pk}}">{% trans "Reactivate" %}</a>'; |
... | ... | |
339 | 343 |
return btn; |
340 | 344 |
}, |
341 | 345 |
} |
342 |
|
|
346 |
|
|
343 | 347 |
] |
344 | 348 |
} ); |
345 | 349 |
$('#filterplaceholder').html(filterbtns); |
346 | 350 |
|
347 |
|
|
348 |
|
|
351 |
|
|
352 |
|
|
349 | 353 |
$('body').on('click', 'button[name="status_filter"]', function(){ |
350 | 354 |
var reg_exp = ''; |
351 | 355 |
var checkboxs = document.getElementsByName('status_filter'); |
... | ... | |
369 | 373 |
clearTimeout(window.refresh_size); |
370 | 374 |
window.refresh_size = setTimeout(function() { update_size(); }, 250); |
371 | 375 |
}); |
372 |
|
|
376 |
|
|
373 | 377 |
var update_size = function() { |
374 | 378 |
$(oTable).css({ width: $(oTable).parent().width() }); |
375 | 379 |
pw=$(oTable).parent().width(); |
... | ... | |
381 | 385 |
oTable.fnSetColumnVis( 7,true ); |
382 | 386 |
oTable.fnSetColumnVis( 5,true ); |
383 | 387 |
} |
384 |
oTable.fnAdjustColumnSizing();
|
|
388 |
oTable.fnAdjustColumnSizing(); |
|
385 | 389 |
} |
386 | 390 |
|
387 | 391 |
$("body").tooltip({ selector: '[data-toggle="tooltip"]' }); |
... | ... | |
389 | 393 |
</script> |
390 | 394 |
<style type="text/css"> |
391 | 395 |
|
392 |
|
|
396 |
|
|
393 | 397 |
.dl-horizontal dt { |
394 | 398 |
width: 70px; |
395 | 399 |
} |
Also available in: Unified diff