2012-04-25 22:48:27 +02:00
|
|
|
/**
|
|
|
|
* OpenSlides assignment functions
|
|
|
|
*
|
|
|
|
* :copyright: 2011, 2012 by OpenSlides team, see AUTHORS.
|
|
|
|
* :license: GNU GPL, see LICENSE for more details.
|
|
|
|
*/
|
|
|
|
|
2011-09-03 11:42:44 +02:00
|
|
|
$(function() {
|
2011-09-05 23:13:18 +02:00
|
|
|
$('a.elected').parent().parent().children('td').addClass('elected');
|
2011-09-03 11:42:44 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$('.election_link').click(function(event) {
|
|
|
|
event.preventDefault();
|
|
|
|
line = $(this);
|
|
|
|
$.ajax({
|
|
|
|
type: 'GET',
|
|
|
|
url: line.attr('href'),
|
|
|
|
dataType: 'json',
|
|
|
|
success: function(data) {
|
2011-09-05 23:13:18 +02:00
|
|
|
if (line.hasClass('elected') && !data.elected) {
|
|
|
|
line.removeClass('elected')
|
|
|
|
line.parent().parent().children('td').removeClass('elected')
|
|
|
|
} else if (!line.hasClass('elected') && data.elected) {
|
|
|
|
line.addClass('elected')
|
|
|
|
line.parent().parent().children('td').addClass('elected')
|
2011-09-03 11:42:44 +02:00
|
|
|
}
|
|
|
|
line.attr('href', data.link);
|
|
|
|
},
|
|
|
|
error: function () {
|
|
|
|
alert("Ajax Error");
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
$('.close_link').click(function(event) {
|
|
|
|
event.preventDefault();
|
|
|
|
slide = $(this);
|
|
|
|
$.ajax({
|
|
|
|
type: 'GET',
|
|
|
|
url: slide.attr('href'),
|
|
|
|
dataType: 'json',
|
|
|
|
success: function(data) {
|
|
|
|
if (data.closed) {
|
|
|
|
newclass = 'closed';
|
|
|
|
} else {
|
|
|
|
newclass = 'open';
|
|
|
|
}
|
|
|
|
slide.removeClass('closed open').addClass(newclass);
|
|
|
|
slide.attr('href', data.link);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|