X-Git-Url: https://git.mdrn.pl/prawokultury.git/blobdiff_plain/341bba6a6521423f7d26115fe86195a551702cdc..b9516daaa9f53a5bdbea02bd679fc9f89387d727:/questions/static/questions/tagcloud.js diff --git a/questions/static/questions/tagcloud.js b/questions/static/questions/tagcloud.js new file mode 100644 index 0000000..992d573 --- /dev/null +++ b/questions/static/questions/tagcloud.js @@ -0,0 +1,21 @@ +$(function() { + var showTagsGroup = function(category_id) { + $('.questions-tags-group').hide(); + $('.questions-tags-group[data-category-id=' + category_id +']').show(); + } + $('#questions-categories a').click(function(e) { + e.preventDefault(); + var target = $(e.target); + if(target.hasClass('selected')) + return; + var category_id = target.attr('data-category-id'); + $('#questions-categories a').removeClass('selected'); + target.addClass('selected'); + showTagsGroup(category_id); + }); + var selected = $('#questions-categories a.selected'); + if(selected) { + var category_id = selected.attr('data-category-id'); + showTagsGroup(category_id); + } +}); \ No newline at end of file