summaryrefslogtreecommitdiffstats
path: root/sitestatic
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2014-03-09 17:40:58 +0100
committerDan McGee <dan@archlinux.org>2014-03-09 17:40:58 +0100
commit2e06e74d3a2a09cbb2a2521cdd55d6543cb56674 (patch)
tree860109cbecc81433191409805497f5c391b7da12 /sitestatic
parent81a2051e346bb41fb9756695566f735d5035bfd8 (diff)
downloadarchweb-2e06e74d3a2a09cbb2a2521cdd55d6543cb56674.tar.gz
archweb-2e06e74d3a2a09cbb2a2521cdd55d6543cb56674.tar.xz
Use localStorage to save/restore signoffs filters
Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'sitestatic')
-rw-r--r--sitestatic/archweb.js18
1 files changed, 18 insertions, 0 deletions
diff --git a/sitestatic/archweb.js b/sitestatic/archweb.js
index 209d6f6..8212e85 100644
--- a/sitestatic/archweb.js
+++ b/sitestatic/archweb.js
@@ -444,6 +444,7 @@ function filter_signoffs() {
$('#filter-count').text(rows.length);
/* make sure we update the odd/even styling from sorting */
$('.results').trigger('applyWidgets', [false]);
+ filter_signoffs_save();
}
function filter_signoffs_reset() {
$('#signoffs_filter .arch_filter').attr('checked', 'checked');
@@ -451,6 +452,23 @@ function filter_signoffs_reset() {
$('#id_pending').removeAttr('checked');
filter_signoffs();
}
+function filter_signoffs_save() {
+ var state = $('#signoffs_filter').serializeArray();
+ localStorage['filter_signoffs'] = JSON.stringify(state);
+}
+function filter_signoffs_load() {
+ var state = localStorage['filter_signoffs'];
+ if (!state)
+ return;
+ state = JSON.parse(state);
+ $('#signoffs_filter .arch_filter').removeAttr('checked');
+ $('#signoffs_filter .repo_filter').removeAttr('checked');
+ $('#id_pending').removeAttr('checked');
+ $.each(state, function (i, v) {
+ // this assumes our only filters are checkboxes
+ $('#signoffs_filter input[name="' + v['name'] + '"]').attr('checked', 'checked');
+ });
+}
function collapseNotes(elements) {
// Remove any trailing <br/> tags from the note contents