From aab2916d6dd9d1508fe90faba10bcfeec7f65f97 Mon Sep 17 00:00:00 2001 From: Oskar Hahn Date: Sat, 3 Sep 2011 15:08:20 +0200 Subject: [PATCH] hide closed elements in the agenda --- .../agenda/templates/agenda/overview.html | 4 +- openslides/static/javascript/agenda.js | 47 +++++++++++++++++-- 2 files changed, 46 insertions(+), 5 deletions(-) diff --git a/openslides/agenda/templates/agenda/overview.html b/openslides/agenda/templates/agenda/overview.html index 977d862a0..9ce74c3ef 100644 --- a/openslides/agenda/templates/agenda/overview.html +++ b/openslides/agenda/templates/agenda/overview.html @@ -66,11 +66,11 @@
- {% trans "Agenda" %} ({{ items|length }} {% trans "items" %}) + {% trans "Agenda" %} ({{ items|length }} {% trans "items" %}) {% if perms.agenda.can_manage_agenda %} {% endif %} - + {% for item in items %} {% if not item.hidden or perms.agenda.can_manage_agenda %} diff --git a/openslides/static/javascript/agenda.js b/openslides/static/javascript/agenda.js index 5028234f6..b55c91f33 100644 --- a/openslides/static/javascript/agenda.js +++ b/openslides/static/javascript/agenda.js @@ -22,11 +22,36 @@ function renderSlide(slide) { return } +function hideLine(object) { + if (object == []) { + return; + } + object.hide(); + id = object.children('td.tabledrag-hide').children('input.menu-mlid').attr('value'); + $('.menu-plid[value=\'' + id + '\']').parent().parent().each(function() { + hideLine($(this)); + }); +} + + +function hideClosedSlides(hide) { + if (hide) { + $('#hidelink').text('show'); + $('.close_link.closed').parent().parent().each(function() { + hideLine($(this)); + }); + hidden = $('#menu-overview tr:hidden').size(); + $('#hiddencount').text(' ' + hidden + ' davon verborgen.'); + } else { + $('#menu-overview tr').show(); + $('#hidelink').text('hide'); + $('#hiddencount').text(''); + } + return false; +} + $(function() { - - - $('.activate_link').click(function(event) { event.preventDefault(); $.ajax({ @@ -61,5 +86,21 @@ $(function() { } }); }); + // hide closed items + $('#action_field a').after($('hide').click(function () { + if ($.cookie('Slide.HideClosed') == 1) { + $.cookie('Slide.HideClosed', 0); + hideClosedSlides(false); + } else { + $.cookie('Slide.HideClosed', 1); + hideClosedSlides(true); + } + })); + if ($.cookie('Slide.HideClosed') === null) { + $.cookie('Slide.HideClosed', 0); + } else if ($.cookie('Slide.HideClosed') == 1) { + hideClosedSlides(true); + } + ko.applyBindings(ViewModel); });