fixed active line #88

This commit is contained in:
Oskar Hahn 2012-04-18 18:07:24 +02:00
parent e9e9fa54b2
commit 0dde1738cf
3 changed files with 8 additions and 2 deletions

View File

@ -68,6 +68,11 @@ class Slide(object):
self.weight = weight self.weight = weight
self.name = name self.name = name
@property
def active(self):
from api import get_active_slide
return get_active_slide(True) == self.key
def get_items(self): def get_items(self):
try: try:
return self.model.objects.all() return self.model.objects.all()

View File

@ -2,7 +2,7 @@ $(function() {
// activate an element to show it on projector // activate an element to show it on projector
$('.activate_link').click(function(event) { $('.activate_link').click(function(event) {
event.preventDefault(); event.preventDefault();
link = $(this); var link = $(this);
$.ajax({ $.ajax({
type: 'GET', type: 'GET',
url: $(this).attr('href'), url: $(this).attr('href'),
@ -12,6 +12,7 @@ $(function() {
$('.activate_link').removeClass('active'); $('.activate_link').removeClass('active');
$('li').removeClass('activeline'); $('li').removeClass('activeline');
link.addClass('active'); link.addClass('active');
link.parent().addClass('activeline');
}, },
error: function () { error: function () {
alert("Ajax Error"); alert("Ajax Error");

View File

@ -2,7 +2,7 @@
{% load i18n %} {% load i18n %}
<ul style="line-height: 180%"> <ul style="line-height: 180%">
<li> <li class="{% if slides.active %}activeline{% endif %}">
<a href="{% url projector_activate_slide slides.key %}" class="activate_link {% if slides.active %}active{% endif %}"> <a href="{% url projector_activate_slide slides.key %}" class="activate_link {% if slides.active %}active{% endif %}">
<div></div> <div></div>
</a> </a>