Revision cb2bec3d
b/static/js/jquery.cookie.js | ||
---|---|---|
1 |
function createCookie(name,value,days) { |
|
2 |
if (days) { |
|
3 |
var date = new Date(); |
|
4 |
date.setTime(date.getTime()+(days*24*60*60*1000)); |
|
5 |
var expires = "; expires="+date.toGMTString(); |
|
6 |
} |
|
7 |
else var expires = ""; |
|
8 |
document.cookie = name+"="+value+expires+"; path=/"; |
|
9 |
} |
|
10 |
|
|
11 |
function readCookie(name) { |
|
12 |
var nameEQ = name + "="; |
|
13 |
var ca = document.cookie.split(';'); |
|
14 |
for(var i=0;i < ca.length;i++) { |
|
15 |
var c = ca[i]; |
|
16 |
while (c.charAt(0)==' ') c = c.substring(1,c.length); |
|
17 |
if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length); |
|
18 |
} |
|
19 |
return null; |
|
20 |
} |
|
21 |
|
|
22 |
function eraseCookie(name) { |
|
23 |
createCookie(name,"",-1); |
|
24 |
} |
b/templates/base.html | ||
---|---|---|
11 | 11 |
<link rel="stylesheet" type="text/css" href="/static/css/smoothness/jquery-ui-1.8.13.custom.css"> |
12 | 12 |
<script type="text/javascript" src="/static/js/jquery-ui-1.8.12.custom.min.js"></script> |
13 | 13 |
<script type="text/javascript" src="/static/js/jquery.tooltip.min.js"></script> |
14 |
<script type="text/javascript" src="/static/js/jquery.cookie.js"></script> |
|
14 | 15 |
<script type="text/javascript"> |
15 | 16 |
|
16 | 17 |
function setlang(lang){ |
... | ... | |
18 | 19 |
$("#langform").submit(); |
19 | 20 |
} |
20 | 21 |
|
21 |
//function highlight(elemId){ |
|
22 |
// var elem = $(elemId); |
|
23 |
// elem.css("background-color", "#ffffbb"); |
|
24 |
// setTimeout(function() { $(elemId).animate({ backgroundColor: "white" }, 2000)}, 1500); |
|
25 |
//} |
|
26 |
// |
|
27 |
// |
|
28 |
//$(document).ready( function(){ |
|
29 |
// if (document.location.hash) { |
|
30 |
// highlight(document.location.hash); |
|
31 |
// } |
|
32 |
// $('a[href*=#]').click(function(){ |
|
33 |
// var elemId = '#' + $(this).attr('href').split('#')[1]; |
|
34 |
// highlight(elemId); |
|
35 |
// }); |
|
36 |
//}); |
|
37 |
|
|
38 | 22 |
</script> |
39 | 23 |
{% block extrahead %}{% endblock %} |
40 | 24 |
</head> |
b/templates/user_routes.html | ||
---|---|---|
7 | 7 |
<script type="text/javascript" src="/static/js/jquery.dataTables.js"></script> |
8 | 8 |
<script type="text/javascript"> |
9 | 9 |
$(document).ready( function(){ |
10 |
var noaction = readCookie('noaction'); |
|
11 |
if (noaction == 'true'){ |
|
12 |
$('#hide_noaction').attr('checked','checked'); |
|
13 |
} |
|
10 | 14 |
$("#hid_mid").val(''); |
11 | 15 |
$('#dialog').dialog({ |
12 | 16 |
height: 220, |
... | ... | |
55 | 59 |
} |
56 | 60 |
}); |
57 | 61 |
|
58 |
$('#routes_table').dataTable( {
|
|
62 |
$('#routes_table').dataTable({ |
|
59 | 63 |
"bJQueryUI": true, |
60 | 64 |
"aoColumns": [ |
61 | 65 |
{"bVisible": false, "bSearchable": false,"bSortable": false }, |
... | ... | |
73 | 77 |
"sLengthMenu": '{% trans "Display" %} <select><option value="25">25</option><option value="50">50</option><option value="-1">{% trans "All" %}</option></select> rules' |
74 | 78 |
}, |
75 | 79 |
"iDisplayLength": 25, |
76 |
} ); |
|
80 |
}); |
|
81 |
$.fn.dataTableExt.afnFiltering = new Array(); |
|
82 |
$.fn.dataTableExt.afnFiltering.push( |
|
83 |
function( oSettings, aData, iDataIndex ) { |
|
84 |
// 4 here is the column where my statuses are. |
|
85 |
var status_middle = $(aData[4]); |
|
86 |
var status = $(status_middle[0]).text(); |
|
87 |
if (( status == "EXPIRED" || status == "ADMININACTIVE" || status == "ERROR") && ($('#hide_noaction').attr('checked'))) { |
|
88 |
return false; |
|
89 |
} |
|
90 |
else { |
|
91 |
return true; |
|
92 |
} |
|
93 |
|
|
94 |
}); |
|
95 |
var oTable = $('#routes_table').dataTable(); |
|
96 |
oTable.fnDraw(); |
|
97 |
$('#hide_noaction').change( function(){ |
|
98 |
var noaction = $('#hide_noaction').attr('checked'); |
|
99 |
createCookie("noaction", noaction, 30); |
|
100 |
oTable.fnDraw(); |
|
101 |
}); |
|
102 |
|
|
77 | 103 |
$( ".button_place #routebutton" ).button({ |
78 | 104 |
icons: { |
79 | 105 |
primary: "ui-icon-circle-plus" |
... | ... | |
147 | 173 |
<div class='button_place' style="float:right"> |
148 | 174 |
<button id="consolebutton">Console</button> <a href="{% url add-route %}" id="routebutton">Add Rule</a> |
149 | 175 |
</div> |
176 |
<br><br> |
|
177 |
<table cellpadding="0" cellspacing="0" border="0" style="width:220px; clear:both;"> |
|
178 |
<tbody> |
|
179 |
<tr> |
|
180 |
<td align="left">Hide Expired, AdminInactive, Error</td> |
|
181 |
<td align="left"> |
|
182 |
<input type="checkbox" id="hide_noaction" name="hide_noaction" value="Hide" /> |
|
183 |
</td> |
|
184 |
</tr> |
|
185 |
</tbody> |
|
186 |
</table> |
|
187 |
<br> |
|
150 | 188 |
<table class="display" width="100%" id="routes_table"> |
151 | 189 |
<thead> |
152 | 190 |
<tr> |
... | ... | |
177 | 215 |
class="expiresclass" |
178 | 216 |
style="border-bottom:2px dashed red;" |
179 | 217 |
title="Expires {% ifequal route.days_to_expire '0' %}today{% else%}in {{route.days_to_expire}} day{{ route.days_to_expire|pluralize }}{% endifequal %}" |
180 |
{% endif %}>{{route.status}} |
|
181 |
</span> |
|
218 |
{% endif %}>{{route.status}}</span> |
|
182 | 219 |
</td> |
183 | 220 |
{% comment %}<td style="text-align: center;">{{ route.response }}</td>{% endcomment %} |
184 | 221 |
<td style="text-align: center;">{{ route.applier }}</td> |
Also available in: Unified diff