From aae9a5a1b6c75095817c0914ef7b92e63903fc2e Mon Sep 17 00:00:00 2001 From: Aurélien Bompard Date: Thu, 7 Feb 2013 14:52:18 +0100 Subject: Fix the tags search view (#35) And factor some views/templates while I'm at it. And remove unused/obsolete stuff in the same move. --- hyperkitty/static/js/hyperkitty.js | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) (limited to 'hyperkitty/static/js/hyperkitty.js') diff --git a/hyperkitty/static/js/hyperkitty.js b/hyperkitty/static/js/hyperkitty.js index 6fb7ef8..d5898dc 100644 --- a/hyperkitty/static/js/hyperkitty.js +++ b/hyperkitty/static/js/hyperkitty.js @@ -296,8 +296,28 @@ function setup_quotes() { function setup_months_list() { var current = $("#months-list li.current").parent().prev(); - if (!current.length) { current = 0; } // overview - $("#months-list").accordion({ active: current }); + if (!current.length) { + current = false; // overview or search + } else { + current = current.prevAll("h3").length; + } + $("#months-list").accordion({ collapsible: true, active: current }); +} + +function setup_expander() { + $('span.expander').expander({ + slicePoint: 500, + userCollapseText : '\n[-]', + expandText : '\n[+]', + beforeExpand: function() { + $(this).removeClass("collapsed"); + $(this).addClass("expanded"); + }, + onCollapse: function() { + $(this).removeClass("expanded"); + $(this).addClass("collapsed"); + } + }); } @@ -313,4 +333,5 @@ $(document).ready(function() { setup_months_list(); setup_favorites(); setup_replies(); + setup_expander(); }); -- cgit