OpenSlides/openslides/agenda/static/javascript/agenda.js

86 lines
2.9 KiB
JavaScript
Raw Normal View History

/**
* OpenSlides agenda functions
*
* :copyright: 2011, 2012 by OpenSlides team, see AUTHORS.
* :license: GNU GPL, see LICENSE for more details.
*/
2011-08-31 23:47:31 +02:00
2011-09-03 15:08:20 +02:00
function hideClosedSlides(hide) {
if (hide) {
$('#hidelink').attr('title', 'show');
$('#hidelink').removeClass('hide').addClass('show');
$('.close_link .icon-checked-new').each(function() {
$(this).parents("li").first().hide();
2011-09-03 15:08:20 +02:00
});
var hidden = $(".agenda_list li:hidden").length;
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 {
$('.agenda_list li').show();
$('#hidelink').attr('title','hide');
$('#hidelink').removeClass('show').addClass('hide');
2011-09-03 15:08:20 +02:00
$('#hiddencount').text('');
}
return false;
}
2013-03-18 12:34:47 +01:00
$('#speaker_list_changed_form').submit(function() {
$('#sort_order').val($('#list_of_speakers').sortable("toArray"));
});
2011-09-03 15:08:20 +02:00
$(function() {
// change participant status (on/off)
$('.close_link').click(function(event) {
2011-08-31 23:47:31 +02:00
event.preventDefault();
var link = $(this);
2011-08-31 23:47:31 +02:00
$.ajax({
type: 'GET',
url: $(this).attr('href'),
2011-08-31 23:47:31 +02:00
dataType: 'json',
success: function(data) {
if (data.closed) {
newclass = 'icon-checked-new';
link.parent().parent().addClass('offline');
link.addClass('btn-success');
2011-08-31 23:47:31 +02:00
} else {
newclass = 'icon-unchecked-new';
link.parent().parent().removeClass('offline');
link.removeClass('btn-success');
2011-08-31 23:47:31 +02:00
}
link.children('i').removeClass('icon-checked-new icon-unchecked-new').addClass(newclass);
link.attr('href', data.link);
2011-08-31 23:47: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);
$('#hide_closed_items').attr('checked', false);
}
else { // hide closed items
2011-09-03 15:08:20 +02:00
$.cookie('Slide.HideClosed', 1);
hideClosedSlides(true);
$('#hide_closed_items').attr('checked', true);
2011-09-03 15:08:20 +02:00
}
});
2013-03-18 12:34:47 +01:00
// TODO: Fix this code and reactivate it again
//# if ($.cookie('Slide.HideClosed') === null) {
//# $('#hide_closed_items').attr('checked', false);
//# $.cookie('Slide.HideClosed', 0);
//# } else if ($.cookie('Slide.HideClosed') == 1) {
//# hideClosedSlides(true);
//# $('#hide_closed_items').attr('checked', true);
//# }
if ($('#list_of_speakers').length > 0) {
$('#list_of_speakers').sortable({axis: "y", containment: "parent", update: function(event, ui) {
$('#speaker_list_changed_form').show();
}});
$('#list_of_speakers').disableSelection();
}
});