Landing Page for internal area

This commit is contained in:
Martin Bauer 2013-09-15 14:48:40 +02:00
parent f0746172ec
commit 49ba4e5223
7 changed files with 120 additions and 23 deletions

Binary file not shown.

View File

@ -17,6 +17,7 @@ from django.conf.urls.static import static
admin.autodiscover()
urlpatterns = patterns('',
url(r'$^', website.views.home_view),
url(r'^events/', include( eventplanner.urls.urlpatterns) ),
url(r'^admin/', include(admin.site.urls) ),
url(r'^admin/doc/', include('django.contrib.admindocs.urls') ),
@ -24,7 +25,6 @@ urlpatterns = patterns('',
url(r'^musicians/$', MusicianList.as_view() ),
url(r'^musicians/(?P<username>[\w]+)$', user_edit ),
url(r'^admin_area/$', intern_area.views.login_site ),
url(r'^website/$', website.views.home_view),
url(r'^login/$', website.views.login_view),
url(r'^logout/$', website.views.logout_view),
url(r'^messages/$', messages.views.message_view ),

View File

@ -3,6 +3,7 @@ from django.utils.translation import ugettext as _
from musicians.models import Musician
from datetime import datetime
class Event ( models.Model ):
@ -36,7 +37,13 @@ class Event ( models.Model ):
for m in Musician.objects.all():
if not m in self.participants.all():
EventParticipation.objects.create( event=self, musician = m, status='?', comment = '' )
@property
def displaytime(self):
if self.meeting_time is None or self.meeting_time == "":
return self.time
else:
return self.meeting_time
@ -56,6 +63,16 @@ class EventParticipation( models.Model ):
def get_musician_username(self):
return self.musician.user.username
@staticmethod
def hasUserSetParticipationForAllEvents( user ):
futurePart = EventParticipation.objects.filter( event__date__gte = datetime.now() )
maybeObjects = futurePart.filter( musician__user = user ).filter( status = '?' )
if len( maybeObjects ) > 0:
return False
else:
return True
@staticmethod
def get_or_create( musician , event ):

View File

@ -73,7 +73,6 @@ def eventplanning( request ):
# All events in the future sorted by date
all_future_events = list ( Event.objects.filter( date__gte = datetime.date.today() ) )
musician = get_object_or_404( Musician, user=request.user )
for e in all_future_events:

View File

@ -103,8 +103,7 @@ $.ajaxSetup({
<ul class="nav pull-right">
{% block menu_contents %}
<li><a href="/index.html">HOME</a></li>
<li><a href="/about-us.html">ABOUT US</a></li>
<li><a href="/">HOME</a></li>
{% endblock %}
@ -116,13 +115,12 @@ $.ajaxSetup({
<b class="caret"></b>
</a>
<ul class="dropdown-menu">
<li><a href="/events">Termine</a></li>
<li><a href="/logout">Logout</a></li>
<li><a href="/events"> Termine</a></li>
<li><a href="/messages">Forum</a></li>
<li><a href="/logout"> Logout</a></li>
</ul>
</li>
{% endif %}
</ul>
</div>
</div>

View File

@ -4,7 +4,71 @@
{% load sekizai_tags staticfiles %}
{% block feature_slider %}
{% addtoblock "css" %}
<style>
#eventManagement.slide .info {
position: absolute;
top: 260px;
left: 8%;
width: 24%;
display: none;
z-index: 10;
}
#eventManagement.slide .info a {
text-transform: uppercase;
color: rgb(255, 255, 255);
background: none repeat scroll 0% 0% rgb(166, 3, 3);
font-size: 25px;
font-weight: bolder;
padding: 15px 24px;
border: 0px none;
border-radius: 6px 6px 6px 6px;
transition: background 0.2s linear 0s, box-shadow 0.2s linear 0s;
}
#eventManagement.slide .info .subtitle {
margin: 25px;
font-size: 20px;
font-style: italic;
}
#eventManagement.slide .info .subtitlebg
{
background: none repeat scroll 0% 0% rgb(243, 243, 243);
padding: 15px 24px;
border-radius: 6px 6px 6px 6px;
}
</style>
{% endaddtoblock %}
<section id="feature_slider" class="">
<article class="slide" id="eventManagement" style="background: url('{{STATIC_URL}}/img/slides/blechreiz01/andi2.jpg') repeat-x top center;">
<div class="info">
<a href="/events">Einsatzplanung</a>
<div class="subtitle subtitlebg">
{% if hasParticipationSetForAllEvents %}
Sehr gut - du hast dich für alles eingetragen
{% else %}
Du hast dich noch nicht für alle Termine eingetragen!!
{% endif %}
</div>
</div>
</article>
<article class="slide" id="eventManagement" style="background: url('{{STATIC_URL}}/img/backgrounds/silver.jpg') repeat-x top center;">
<img class="asset left-30 sp600 t120 z1" src="{{STATIC_URL}}/img/slides/blechreiz01/gruppe.png" />
<div class="info">
<a href="/messages">Forum</a>
<div class="subtitle"> Nachricht an alle schreiben... </div>
</div>
</article>
</section>
{% endblock %}
{% block content %}
@ -15,14 +79,9 @@
{% addtoblock "js" %}
<script type="text/javascript">
$(function () {
var currentDate = new Date(),
finished = false,
availiableExamples = {
set35daysFromNow: 35 * 24 * 60 * 60 * 1000,
set5minFromNow : 5 * 60 * 1000,
set1minFromNow : 1 * 60 * 1000
};
function callback(event) {
$this = $(this);
$this.find('span#'+event.type).html(event.value);
@ -37,7 +96,7 @@
}
}
$('div#clock').countdown(availiableExamples.set35daysFromNow + currentDate.valueOf(), callback);
$('div#clock').countdown(new Date().valueOf() + {{epoch}} , callback);
});
</script>
{% endaddtoblock %}
@ -48,11 +107,18 @@
<div class="head">
<div class="container">
<div class="span6 text">
<h4>Unser nächstes Konzert</h4>
<h4>Der nächste Termin:</h4>
<p>
Ist in Rohr um 19:00 in der Was WeissIch Kirche <span>Bis dann</span>
<br />
Dorfplatz 5, Rohr
{{event.title}} ist am {{event.date}} um {{event.displaytime | time:"H:i" }} in {{event.location}}
<br/>
{% if participation == "?" %}
Du hast dich noch nicht für diesen Termin eingetragen!
{% elif participation == "Yes" %}
Du hast für diesen Termin zugesagt.
{% elif participation == "No" %}
Du hast für diesen Termin abgesagt.
{%endif %}
</p>
</div>
<div class="span6 count" id="clock">

View File

@ -9,8 +9,25 @@ from django.http import HttpResponse
from django.utils import simplejson
from eventplanner.models import Event, EventParticipation
from datetime import datetime
def home_view(request):
return render( request, 'website/mainpage.html' )
events = Event.objects.filter( date__gte = datetime.now() ).order_by('date')[:1]
context = dict()
part = EventParticipation.objects.filter( musician__user = request.user ).filter( event = events[0] )
eventTime = datetime( events[0].date.year, events[0].date.month, events[0].date.day,
events[0].displaytime.hour, events[0].displaytime.minute )
context['hasParticipationSetForAllEvents'] = EventParticipation.hasUserSetParticipationForAllEvents( request.user)
context['event'] = events[0]
context['epoch'] = int( (eventTime - datetime.now() ).total_seconds() * 1000 )
context['participation'] = part[0].status
return render( request, 'website/mainpage.html', context )
def logout_view(request):