hide closed elements in the agenda

This commit is contained in:
Oskar Hahn 2011-09-03 15:08:20 +02:00
parent b626d049fe
commit aab2916d6d
2 changed files with 46 additions and 5 deletions

View File

@ -66,11 +66,11 @@
<div></div> <div></div>
</a> </a>
</td> </td>
<td><i>{% trans "Agenda" %} ({{ items|length }} {% trans "items" %})</i></td> <td><i>{% trans "Agenda" %} ({{ items|length }} {% trans "items" %}<span id="hiddencount"></span>)</i></td>
{% if perms.agenda.can_manage_agenda %} {% if perms.agenda.can_manage_agenda %}
<td></td> <td></td>
{% endif %} {% endif %}
<td style="width: 1px;white-space: nowrap"><a href="{% url print_agenda %}" title="{%trans 'Print agenda' %}"><img src="/static/images/icons/application-pdf.png"></a></td> <td id="action_field" style="width: 1px;white-space: nowrap"><a href="{% url print_agenda %}" title="{%trans 'Print agenda' %}"><img src="/static/images/icons/application-pdf.png"></a></td>
</tr> </tr>
{% for item in items %} {% for item in items %}
{% if not item.hidden or perms.agenda.can_manage_agenda %} {% if not item.hidden or perms.agenda.can_manage_agenda %}

View File

@ -22,11 +22,36 @@ function renderSlide(slide) {
return 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() { $(function() {
$('.activate_link').click(function(event) { $('.activate_link').click(function(event) {
event.preventDefault(); event.preventDefault();
$.ajax({ $.ajax({
@ -61,5 +86,21 @@ $(function() {
} }
}); });
}); });
// hide closed items
$('#action_field a').after($('<a id="hidelink" href="#">hide</a>').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); ko.applyBindings(ViewModel);
}); });