2012-04-25 22:48:27 +02:00
|
|
|
/**
|
|
|
|
* OpenSlides agenda functions
|
|
|
|
*
|
|
|
|
* :copyright: 2011, 2012 by OpenSlides team, see AUTHORS.
|
|
|
|
* :license: GNU GPL, see LICENSE for more details.
|
|
|
|
*/
|
2012-07-04 13:12:07 +02:00
|
|
|
|
2011-09-03 15:08:20 +02:00
|
|
|
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));
|
|
|
|
});
|
|
|
|
}
|
2011-08-31 23:47:31 +02:00
|
|
|
|
2011-09-03 15:08:20 +02:00
|
|
|
function hideClosedSlides(hide) {
|
|
|
|
if (hide) {
|
2012-07-04 13:12:07 +02:00
|
|
|
$('#hidelink').attr('title', 'show');
|
2011-09-03 18:11:05 +02:00
|
|
|
$('#hidelink').removeClass('hide').addClass('show');
|
2011-09-03 15:08:20 +02:00
|
|
|
$('.close_link.closed').parent().parent().each(function() {
|
|
|
|
hideLine($(this));
|
|
|
|
});
|
|
|
|
hidden = $('#menu-overview tr:hidden').size();
|
2012-12-09 12:59:56 +01:00
|
|
|
$('#hiddencount').text(interpolate(gettext(', of which %s are hidden.'), [hidden]));
|
2011-09-03 15:08:20 +02:00
|
|
|
} else {
|
|
|
|
$('#menu-overview tr').show();
|
2011-09-03 18:11:05 +02:00
|
|
|
$('#hidelink').attr('title','hide');
|
|
|
|
$('#hidelink').removeClass('show').addClass('hide');
|
2011-09-03 15:08:20 +02:00
|
|
|
$('#hiddencount').text('');
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
2011-09-03 11:42:44 +02:00
|
|
|
|
2011-09-03 15:08:20 +02:00
|
|
|
$(function() {
|
2012-07-04 15:49:33 +02:00
|
|
|
$('.close_link a').click(function(event) {
|
2011-08-31 23:47:31 +02:00
|
|
|
event.preventDefault();
|
|
|
|
slide = $(this);
|
|
|
|
$.ajax({
|
|
|
|
type: 'GET',
|
|
|
|
url: slide.attr('href'),
|
|
|
|
dataType: 'json',
|
|
|
|
success: function(data) {
|
|
|
|
if (data.closed) {
|
|
|
|
newclass = 'closed';
|
|
|
|
} else {
|
|
|
|
newclass = 'open';
|
|
|
|
}
|
2012-07-04 15:49:33 +02:00
|
|
|
slide.parent().removeClass('closed open').addClass(newclass);
|
2011-08-31 23:47:31 +02:00
|
|
|
slide.attr('href', data.link);
|
|
|
|
}
|
|
|
|
});
|
2011-08-31 18:25:03 +02:00
|
|
|
});
|
2012-04-18 18:29:31 +02:00
|
|
|
// filter to show/hide closed items
|
|
|
|
$('#hide_closed_items').click(function(event) {
|
|
|
|
// show all items
|
2011-09-03 15:08:20 +02:00
|
|
|
if ($.cookie('Slide.HideClosed') == 1) {
|
|
|
|
$.cookie('Slide.HideClosed', 0);
|
|
|
|
hideClosedSlides(false);
|
2012-04-18 18:29:31 +02:00
|
|
|
$('#hide_closed_items').attr('checked', false);
|
2012-07-04 13:12:07 +02:00
|
|
|
}
|
2012-04-18 18:29:31 +02:00
|
|
|
else { // hide closed items
|
2011-09-03 15:08:20 +02:00
|
|
|
$.cookie('Slide.HideClosed', 1);
|
|
|
|
hideClosedSlides(true);
|
2012-04-18 18:29:31 +02:00
|
|
|
$('#hide_closed_items').attr('checked', true);
|
2011-09-03 15:08:20 +02:00
|
|
|
}
|
2012-04-18 18:29:31 +02:00
|
|
|
});
|
2011-09-03 15:08:20 +02:00
|
|
|
if ($.cookie('Slide.HideClosed') === null) {
|
2012-04-18 18:29:31 +02:00
|
|
|
$('#hide_closed_items').attr('checked', false);
|
2011-09-03 15:08:20 +02:00
|
|
|
$.cookie('Slide.HideClosed', 0);
|
|
|
|
} else if ($.cookie('Slide.HideClosed') == 1) {
|
|
|
|
hideClosedSlides(true);
|
2012-04-18 18:29:31 +02:00
|
|
|
$('#hide_closed_items').attr('checked', true);
|
2011-09-03 15:08:20 +02:00
|
|
|
}
|
2011-08-31 18:25:03 +02:00
|
|
|
});
|