Eventplanning: New "needsAction" state

This commit is contained in:
Martin Bauer
2014-06-22 10:33:39 +02:00
parent 290db91956
commit df22b838fa
4 changed files with 42 additions and 13 deletions

View File

@@ -120,7 +120,8 @@ class Event ( models.Model ):
class EventParticipation( models.Model ):
OPTIONS = ( ('?' , _('?' )),
('Yes', _('Yes')),
('No' , _('No' ))
('No' , _('No' )),
('-' , _( '-' ))
)
event = models.ForeignKey( Event, verbose_name=_("event") )
@@ -149,8 +150,8 @@ class EventParticipation( models.Model ):
futurePart = EventParticipation.objects.filter( event__date__gte = datetime.now() )
maybeObjects = futurePart.filter( user = user ).filter( status = '?' )
if len( maybeObjects ) > 0:
notYetEntered = futurePart.filter( user = user ).filter( status = '-' )
if len( notYetEntered ) > 0:
return False
else:
return True
@@ -175,7 +176,7 @@ class EventParticipation( models.Model ):
try:
result = EventParticipation.objects.get( event = event, user = user )
except EventParticipation.DoesNotExist:
result = EventParticipation.objects.create( event = event, user = user, status='?', comment = '' )
result = EventParticipation.objects.create( event = event, user = user, status='-', comment = '' )
return result

View File

@@ -180,6 +180,15 @@
<h2>Termine</h2>
<div class="span12">
<div class="alert alert-info">
Es gibt jetzt einen vierten Zustand "nicht eingetragen", angezeigt durch nur
blaue Buttons.<br>
"?" bedeutet jetzt: Ich habe mich eingetragen weiss aber noch nicht ob ich komme.
Bitte nur selten benutzen!
</div>
<div class="box-content">
<table id="eventTable" class="table table-striped">

View File

@@ -71,10 +71,14 @@
} else if ( $(this).data('status') == "No" )
{
$(this).data( "status", "-" );
$(this).children("span.text").html("-");
} else if ( $(this).data('status') == "-" )
{
$(this).data( "status", "Yes" )
.addClass("btn-success");
$(this).children("span.text").html("Ja");
}
}
$('#saveButton').removeAttr('disabled');
});
@@ -132,11 +136,18 @@
<div class="container">
<form>
<div class="row">
<div class="row-fluid eventTable">
<div class="row-fluid eventTable">
<div class="span12">
<h2>Termine</h2>
<div class="alert alert-info">
Es gibt jetzt einen vierten Zustand "nicht eingetragen", angezeigt durch "-".<br>
"?" bedeutet jetzt: Ich habe mich eingetragen weiss aber noch nicht ob ich komme.
Bitte nur selten benutzen!
</div>
<div class="box-content">
<table class="table table-striped">
@@ -179,10 +190,14 @@
<button class="btn btn-mini btn-danger eventButton" title="{{p.comment}}" data-status="{{p.status}}">
<span class="text {% if p.comment %}with_comment{% endif %}">Nein</span>
</button>
{% else %}
<button class="btn btn-mini btn-warning eventButton" title="{{p.comment}}" data-status="{{p.status}}">
{% elif p.status == "?" %}
<button class="btn btn-mini btn-warning eventButton" title="{{p.comment}}" data-status="{{p.status}}">
<span class="text {% if p.comment %}with_comment{% endif %}">?</span>
</button>
{% else %}
<button class="btn btn-mini eventButton" title="{{p.comment}}" data-status="{{p.status}}">
<span class="text {% if p.comment %}with_comment{% endif %}">-</span>
</button>
{% endif %}
</td>
{% else %}