Code bereinigt und Seitenstruktur verfeinert.

Das Layout der einzelnen Seiten ist jetzt einheitlich:
- jumbotron
- Naviation der Unterseiten (wenn Vorhanden)
- Hauptinhalt
- Pager (bei mehrseiteigen Ergebnissen)
- Kommentare (wenn Kommentare möglich)
- Buttonleiste zum bearbeiten (wen erlaubt)

* Viele kleine HTML5 Fehler wurden bereinigt
* CSS Dateien wurden angepasst
* Nicht mehr benötigte Dateien in STATIC gelöscht
* externe Pakete aus utlis/ entfernt, als Vobreitung für virtenv Nutzung.
This commit is contained in:
Christian Berg
2014-11-30 16:49:23 +01:00
committed by Christian Berg
parent 86a0db050d
commit 34f5bdca58
1062 changed files with 1690 additions and 100089 deletions

View File

@@ -0,0 +1,14 @@
# -*- encoding: UTF-8 -*-
"""
Created on 30.09.2011
@author: christian
"""
from . import models
def upcoming_events(request):
return {
'current_event': models.Event.objects.current_event(),
'next_event': models.Event.objects.next_event(),
'upcoming_events': models.Event.objects.upcoming(),
}

39
events/event_urls.py Normal file
View File

@@ -0,0 +1,39 @@
# -*- encoding: utf-8 -*-
from django.conf.urls import patterns, include, url
from . import views
urlpatterns = patterns(
'',
url(r'^$', views.UpcomingEvents.as_view(), name='upcoming-events'),
url(
r'^(?P<year>[\d]{4})/$',
views.EventArchiveYear.as_view(),
name='event-archive'
),
url(
r'^(?P<year>[\d]{4})/(?P<month>[\d]+)/$',
views.EventArchiveMonth.as_view(),
name='event-archive'
),
url(
r'^(?P<year>[\d]{4})/(?P<month>[\d]+)/(?P<pk>[\d]+)/$',
views.EventDetail.as_view(),
name='event-detail'
),
url(
r'^(?P<year>[\d]{4})/(?P<month>[\d]+)/(?P<pk>[\d]+)/edit/$',
views.EventForm.as_view(),
name='event-form'
),
url(
r'^add/$',
views.EventForm.as_view(),
name='event-form'
),
url(
r'^archive/$',
views.EventArchiveIndex.as_view(),
name='event-archive'
),
)

34
events/gallery_urls.py Normal file
View File

@@ -0,0 +1,34 @@
# -*- encoding: utf-8 -*-
from django.conf.urls import patterns, include, url
from . import views
urlpatterns = patterns(
'',
url(r'^$', views.EventGallery.as_view(), name='event-gallery'),
url(
r'^(?P<event>[\d]+)/$',
views.EventPhotoList.as_view(),
name='event-photo-list'
),
url(
r'^(?P<event>[\d]+)/(?P<pk>[\d]+)/$',
views.EventPhoto.as_view(),
name='event-photo'
),
url(
r'^(?P<event>[\d]+)/upload/$',
views.EventPhotoUpload.as_view(),
name='event-photo-upload'
),
url(
r'^delete/(?P<pk>[\d]+)/$',
views.DeleteEventPhoto.as_view(),
name='delete-event-photo'
),
url(
r'^upload/$',
views.EventPhotoUpload.as_view(),
name='event-photo-upload'
),
)

View File

@@ -2,50 +2,75 @@
{% load i18n comments%}
{% block title %}
{% trans 'Event Archive' %} {% if month %}{{ month|date:'F Y' }} {% else %}{% if year %}{{year}}{% endif %}{% endif %}
{% trans 'Event Archive' %} {% if month %}{{ month|date:'F Y' }} {% else %}{% if year %}{{year}}{% endif %}{% endif %}
{% endblock %}
{% block content %}
<h2>{% trans 'Event Archive' %} {% if month %}{{ month|date:'F Y' }} {% else %}{% if year %}{{year}}{% endif %}{% endif %}</h2>
{% for event in event_list %}
{% ifchanged %}<h3 class="clearfix">{{ event.start|date:'F Y' }}</h3>{% endifchanged %}
<div class="clearfix">
{% get_comment_count for event as comment_count %}
<a href="{{ event.get_absolute_url }}"><img src="{{ event.get_thumbnail.url }}" alt=" {% trans 'Event Image' %}" class="thumbnail"/></a>
<h4><a href="{{ event.get_absolute_url }}">{{ event.name }}</a></h4>
{{event.description}}
<img src="{{ STATIC_URL }}/icons/date.png" alt="{% trans 'Start' %}:" title="{% trans 'Start' %}">
{{ event.start|date }}
{% if event.end %}
{% trans "from" %} {{ event.start|time:'H:i' }} {% trans "to" %} {{ event.end|time:'H:i' }}
{% else %}
{{ event.start|time:'H:i' }}
{% endif %}
<ul class="info">
<li class="location">{{ event.location }}</li>
<li class="comment"><a href="{{event.get_absolute_url}}#comments">{{ comment_count }} {% trans 'Comments' %}</a></li>
<li class="photo"><a href="{% url 'event-photo-list' event.pk %}">{{ event.photo_count }} {% trans 'Photos' %}</a></li>
<li class="hanchan"><a href="{% url 'event-hanchan-list' event.pk %}">{{ event.hanchan_set.count }} {% trans 'Hanchans' %}</a></li>
{% if perms.events.change_event %}<li><a href="{{ event.get_edit_url }}" class="button"><img src="{{ STATIC_URL }}icons/page_edit.png" alt="{%trans "Edit" %}"></a></li>{% endif %}
</ul>
</div>
{% endfor %}
{% block teaser %}
<h2>{% trans 'Event Archive' %} {% if month %}{{ month|date:'F Y' }}{% elif year %}{{year|date:'Y'}}{% endif %}</h2>
{% endblock %}
{% block sidebar %}
{% block redbox %}
<h2>Archive</h2>
<ul>
{% if year %}
{% for date in date_list %}
{% if year %}
{% for date in date_list %}
<li><a href="{% url 'event-archive' year|date:'Y' date|date:'m' %}">{{ date|date:'F' }}</a></li>
{% endfor %}
{% elif month %}
<li><a href="{% url 'event-archive' month|date:'Y' %}">{{ month|date:'Y' }}</a></li>
{% else %}
{% for date in date_list %}
{% endfor %}
{% elif month %}
<li><a href="{% url 'event-archive' month|date:'Y' %}">{{ month|date:'Y' }}</a></li>
{% else %}
{% for date in date_list %}
<li><a href="{% url 'event-archive' date|date:'Y' %}">{{ date|date:'Y' }}</a></li>
{% endfor %}
{% endif %}
{% endfor %}
{% endif %}
</ul>
{% endblock %}
{% block maincontent %}
{% regroup event_list by start|date:'F Y' as month_list %}
{% for month in month_list %}
<h3 class="grid_12">{{ month.grouper }}</h3>
{% for event in month.list %}
{% get_comment_count for event as comment_count %}
<a href="{{ event.get_absolute_url }}" class="grid_2"><img src="{{ event.get_thumbnail.url }}"
alt="{% trans 'Event Image' %}"
class="thumbnail"/></a>
<div class="grid_4">
<h4><a href="{{ event.get_absolute_url }}">{{ event.name }}</a></h4>
<p><img src="{{ STATIC_URL }}/icons/date.png" alt="{% trans 'Start' %}:" title="{% trans 'Start' %}">
{{ event.start|date }}
{% if event.end %}
{% trans "from" %} {{ event.start|time:'H:i' }} {% trans "to" %} {{ event.end|time:'H:i' }}
{% else %}
{{ event.start|time:'H:i' }}
{% endif %}
</p>
<p>{{event.description}}</p>
<ul class="info">
<li><img src="{{ STATIC_URL }}/icons/map.png" alt="{% trans 'Location' %}" title="{% trans 'Location' %}">
{{ event.location }}
</li>
<li><a href="{{event.get_absolute_url}}#comments"><img src="{{ STATIC_URL }}/icons/comments.png"
alt="{% trans 'Comments' %}"
title="{% trans 'Comments' %}"> {{ comment_count }}</a>
</li>
<li><a href="{% url 'event-photo-list' event.pk %}"><img src="{{ STATIC_URL }}/icons/camera.png"
alt="{% trans 'Photos' %}"
title="{% trans 'Photos' %}">
{{ event.photo_count }}</a></li>
<li><a href="{% url 'event-hanchan-list' event.pk %}"><img src="{{ STATIC_URL }}/icons/table.png"
alt="{% trans 'Hanchans' %}"
title="{% trans 'Hanchans' %}">
{{ event.hanchan_set.count }} {% trans 'Hanchans' %}</a></li>
</ul>
{% if perms.events.change_event %}
<p class="right"><a href="{{ event.get_edit_url }}" class="button"><img src="{{ STATIC_URL }}icons/page_edit.png"
alt="{%trans " Edit" %}"></a></p>
{% endif %}
</div>
{% if forloop.counter|divisibleby:2 %}<br class="clear"/>{% endif %}
{% endfor %}
{% endfor %}
{% endblock %}

View File

@@ -13,26 +13,25 @@
{% block extra_head %}
<script type="text/javascript" src="https://maps.google.com/maps/api/js?sensor=false"></script>
<style type="text/css" media="screen and (min-width: 701px)">#teaser{background-image:url('{{ event.get_callout.url }}')}</style>
<!--[if lt IE 9]><style type="text/css" media="screen">#teaser{background-image:url("{{event.get_callout.url}}")}</style><![endif]-->
{% endblock %}
{% block maincontent %}
<div class="grid_8" id="teaser">
{% if event.description %}
<div id="teaser_text">
<h2>{{event.name}}</h2>
{{event.description|markdown}}
</div>
{% else %}
<div id="teaser_text">
<h2>{{event.name}}</h2>
{{event.location.description|markdown}}
</div>
{% endif %}
</div>
<div class="grid_4 red_box" id="map_canvas" style="width:300px; height:300px;"></div>
{% block jumbotron_background %}{{ event.get_callout.url }}')}{% endblock %}
{% block teaser %}
<h2>{{event.name}}</h2>
<div id="teaser_text">
{% if event.description %}
{{event.description|markdown}}
{% else %}
{{event.location.description|markdown}}
{% endif %}
</div>
{% endblock %}
{% block maincontent %}
<div class="grid_4">
<h3>{% trans "Date" %}</h3>
<p></p>
@@ -65,7 +64,7 @@
'', 'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=600,width=600');return false;"><img src="{{STATIC_URL}}img/google_plus.png" alt="Google+" title="{% trans 'Share on Google+'%}" width="39" height="39"/></a>
<a href="https://twitter.com/share?url=http%3A%2F%2Fwww.kasu.at{{event.get_absolute_url|urlencode}}" target='_blank'><img src="{{STATIC_URL}}img/twitter.png" alt="Twitter" title=" {% trans 'Share on Twitter' %}" width="39" height="39"/></a>
<a href="http://facebook.com/sharer.php?u=http%3A%2F%2Fwww.kasu.at{{event.get_absolute_url|urlencode}}" target="_blank"><img src="{{STATIC_URL}}img/facebook.png" alt="Facebook" title="{% trans 'Share on Facebook'%}" width="39" height="39"/></a>
<a href="http://maps.google.com/maps?q={{event.location.address|urlencode}}&z=16" target="gmaps"><img src="{{ STATIC_URL }}img/google_maps.png" alt="Google Maps" title="{% trans 'Show on Google Maps' %}" width="39" height="39"/></a>
<a href="http://maps.google.com/maps?q={{event.location.address|urlencode}}&amp;z=16" target="gmaps"><img src="{{ STATIC_URL }}img/google_maps.png" alt="Google Maps" title="{% trans 'Show on Google Maps' %}" width="39" height="39"/></a>
</div>
<br class="clear" />
{% render_comment_list for event %}
@@ -104,7 +103,7 @@
center: latlng,
mapTypeId: google.maps.MapTypeId.ROADMAP
}
map = new google.maps.Map(document.getElementById("map_canvas"), mapOptions);
map = new google.maps.Map(document.getElementById("redbox"), mapOptions);
codeAddress();
}
initialize();

View File

@@ -1,45 +1,49 @@
{% extends "events/event_archive.html" %}
{% extends "events/page.html" %}
{% load i18n comments%}
{% block title %}{% trans "Upcoming Events" %}{% endblock %}
{% block teaser%}<h2>{% trans "Upcoming Events" %}</h2>{% endblock %}
{% block maincontent %}
<h2 class="grid_12">{% trans "Upcoming Events" %}</h2>
{% for event in event_list %}
{% ifchanged %}<h3 class="grid_12">{{ event.start|date:'F Y' }}</h3>{% endifchanged %}
{% get_comment_count for event as comment_count %}
<div class="grid_6">
<a href="{{ event.get_absolute_url }}"><img src="{{ event.get_thumbnail.url }}" alt=" {% trans 'Event Image' %}" class="thumbnail"/></a>
<h4><a href="{{ event.get_absolute_url }}">{{ event.name }}</a></h4>
{{event.description}}
<ul class="info">
<li>
<img src="{{ STATIC_URL }}/icons/date.png" alt="{% trans 'Start' %}:" title="{% trans 'Start' %}">
{{ event.start|date:'SHORT_DATE_FORMAT' }}
{% if event.end %}
{% trans "from" %} {{ event.start|time:'H:i' }} {% trans "to" %} {{ event.end|time:'H:i' }}
{% else %}
{{ event.start|time:'H:i' }}
{% endif %}
</li>
<li>
<img src="{{ STATIC_URL }}/icons/map.png" alt="{% trans 'Location' %}" title="{% trans 'Location' %}">
{{ event.location }}
</li>
<li>
<img src="{{ STATIC_URL }}/icons/comments.png" alt="{% trans 'Comments' %}" title="{% trans 'Comments' %}">
<a href="{{event.get_absolute_url}}#comments">{{ comment_count }}</a>
</li>
</ul>
<p style="text-align:right">
{% if perms.events.change_event %}
<a href="{{ event.get_edit_url }}" class="button"><img src="{{ STATIC_URL }}icons/page_edit.png" alt="{%trans "Edit" %}"></a>
{% endif %}
{% if perms.events.add_photo %}
<a href="{% url 'event-photo-list' event.pk %}" class="button"><img src="{{ STATIC_URL }}icons/image_add.png" alt="{%trans "Upload" %}"></a>
{% endif %}
</p>
</div>
{% ifchanged %}<h3 class="grid_12">{{ event.start|date:'F Y' }}</h3>{% endifchanged %}
{% get_comment_count for event as comment_count %}
<a href="{{ event.get_absolute_url }}" class="grid_2"><img src="{{ event.get_thumbnail.url }}" alt=" {% trans 'Event Image' %}"
class="thumbnail"/></a>
<div class="grid_4">
<h4><a href="{{ event.get_absolute_url }}">{{ event.name }}</a></h4>
<p class="strong"><img src="{{ STATIC_URL }}/icons/date.png" alt="{% trans 'Start' %}:" title="{% trans 'Start' %}">
{{ event.start|date:'SHORT_DATE_FORMAT' }}
{% if event.end %}
{% trans "from" %} {{ event.start|time:'H:i' }} {% trans "to" %} {{ event.end|time:'H:i' }}
{% else %}
{{ event.start|time:'H:i' }}
{% endif %}
</p>
<p>{{event.description}}</p>
<ul class="info">
<li>
<img src="{{ STATIC_URL }}/icons/map.png" alt="{% trans 'Location' %}" title="{% trans 'Location' %}">
{{ event.location }}
</li>
<li>
<img src="{{ STATIC_URL }}/icons/comments.png" alt="{% trans 'Comments' %}" title="{% trans 'Comments' %}">
<a href="{{event.get_absolute_url}}#comments">{{ comment_count }}</a>
</li>
</ul>
<p class="right">
{% if perms.events.change_event %}
<a href="{{ event.get_edit_url }}" class="button"><img src="{{ STATIC_URL }}icons/page_edit.png" alt="{%trans "
Edit" %}"></a>
{% endif %}
{% if perms.events.add_photo %}
<a href="{% url 'event-photo-list' event.pk %}" class="button"><img src="{{ STATIC_URL }}icons/image_add.png"
alt="{%trans " Upload" %}"></a>
{% endif %}
</p>
</div>
{% endfor %}
{% if page_obj.has_other_pages %}{% include 'paginator.html' %}{% endif %}
{% endblock %}

View File

@@ -11,27 +11,23 @@
{% if event.description %}<meta property="og:description" content="{{event.description}}" />{% endif %}
{% endblock %}
{% block extra_head %}
<style type="text/css" media="screen and (min-width: 701px)">#teaser{background-image:url('{{ event.get_callout.url }}')}</style>
<!--[if lt IE 9]><style type="text/css" media="screen">#teaser{background-image:url("{{event.get_callout.url}}")}</style><![endif]-->
{% block jumbotron_background %}{{ event.get_callout.url }}')}{% endblock %}
{% block teaser %}
<h2>{{event.name}}</h2>
<div id="teaser_text">
{% if event.description %}{{event.description|markdown}}{% else %}{{event.location.description|markdown}}{% endif %}
</div>
{% endblock %}
{% block maincontent %}
<div class="grid_8" id="teaser">
<div id="teaser_text">
<h2>{{event.name}}</h2>
{% if event.description %}{{event.description|markdown}}{% else %}{{event.location.description|markdown}}{% endif %}
</div>
</div>
<div class="red_box grid_4">
{% block red_box %}
{% block redbox %}
<h2>Info</h2>
<p>&nbsp;</p>
<ul>
<li class="date"><strong>{% trans "Start" %}:</strong> {{ event.start }}</li>
{% if event.end %}<li class="date"><strong>{% trans "End" %}:</strong> {{ event.end }}</li>{% endif %}
<li class="location">
{% if event.location.url %}<a href="{{ event.location.url }}">{% else %}<a href="http://maps.google.com/maps?q={{event.location.address|urlencode}}&z=16">{% endif %}
{% if event.location.url %}<a href="{{ event.location.url }}">{% else %}<a href="http://maps.google.com/maps?q={{event.location.address|urlencode}}&amp;z=16">{% endif %}
<strong>{% trans "Location" %}:</strong> {{event.location.name}}</a>
</li>
{% if event.url %}<li><a href="{{ event.url }}"><strong>{% trans "Homepage" %}:</strong> {{ event.url }}</a></li>{% endif %}
@@ -40,8 +36,4 @@
{% if event.is_tournament %}<li class="season"><a href="{% url 'event-ranking' event.pk %}"><strong>{% trans "tourney" %}:</strong> {% trans "other rules apply here" %}</a></li>{% endif%}
</ul>
{% endblock %}
</div>
{% block event_content %} {% endblock %}
{% endblock %}

View File

@@ -3,10 +3,6 @@
{% block title %}{{page.title}}{% endblock %}
{% block content %}
<h2>{{ page.title }}</h2>
{{ page.content }}
{% endblock %}
{% block sidebar %}
<a href="http://www.google.com/calendar/render?cid=http%3A%2F%2Fwww.kasu.at%2Fevents.ics" target="_blank"><img src="http://www.google.com/calendar/images/ext/gc_button6.gif" alt="0" border="0"></a>
@@ -18,6 +14,8 @@
{% endif %}
{% endblock %}
{% block content %}{{ page.content }}{% endblock %}

View File

@@ -1,4 +1,4 @@
{% extends "events/photo_gallery.html" %}
{% extends "events/photo_list.html" %}
{% load i18n comments %}
{% block title %} {{ photo.name }} - {{ photo.event.name }} {% endblock %}
@@ -45,7 +45,7 @@
</ul>
{% endif %}
<div class="grid_12 more_link">
<a href="https://m.google.com/app/plus/x/?v=compose&content={{photo.headline|urlencode}}+-+http%3A%2F%2Fwww.kasu.at/{{photo.get_absolute_url|urlencode}}" target="_blank"><img src="{{STATIC_URL}}img/google_plus.png" alt="Google+" title="{% trans 'Share on Google+'%}" /></a>
<a href="https://m.google.com/app/plus/x/?v=compose&amp;content={{photo.headline|urlencode}}+-+http%3A%2F%2Fwww.kasu.at/{{photo.get_absolute_url|urlencode}}" target="_blank"><img src="{{STATIC_URL}}img/google_plus.png" alt="Google+" title="{% trans 'Share on Google+'%}" /></a>
<a href="https://twitter.com/share?url=http%3A%2F%2Fwww.kasu.at/{{photo.get_absolute_url|urlencode}}" target='_blank'><img src="{{STATIC_URL}}img/twitter.png" alt="Twitter" title="{% trans 'Share on Twitter' %}" /></a>
<a href="http://facebook.com/sharer.php?u=http%3A%2F%2Fwww.kasu.at{{photo.get_absolute_url|urlencode}}" target="_blank"><img src="{{STATIC_URL}}img/facebook.png" alt="Facebook" title="{% trans 'Share on Facebook'%}" /></a>
</div>

View File

@@ -1,6 +1,8 @@
{% extends "base.html" %}
{% load i18n %}
{% block teaser %}<h2>{{page.title}}{% trans 'Photos' %}</h2>{% endblock %}
{% block navigation %}
<ul id="navigation">
{% if event %}
@@ -20,7 +22,6 @@
{% endblock %}
{% block maincontent %}
<h2 class="grid_12">{% trans 'Photos' %}</h2>
{% for event in event_list %}
<div class="gallery grid_4">
<h3><a href="{% url 'event-photo-list' event.id %}">{{event.name}}</a></h3>

View File

@@ -14,13 +14,13 @@
{% block navigation %}
<ul id="navigation">
{% if event %}
<li><a href="{{ current_top_page.get_absolute_url }}">{{current_top_page.menu_name}}</a></li>
<li><a class="active">{{event.name}}</a></li>
{% elif photo %}
{% if photo %}
<li><a href="{{ current_top_page.get_absolute_url }}">{{current_top_page.menu_name}}</a></li>
<li><a href="{% url 'event-photo-list' photo.event.id %}">{{photo.event.name}}</a></li>
<li><a class="active">{{photo.name}}</a></li>
{% elif event %}
<li><a href="{{ current_top_page.get_absolute_url }}">{{current_top_page.menu_name}}</a></li>
<li><a class="active">{{event.name}}</a></li>
{% else %}
<li><a href="{{ current_top_page.get_absolute_url }}" {% ifequal current_page current_top_page %}class="active"{% endifequal %}>{{current_top_page.menu_name}}</a></li>
{% if perms.event.add_photo %}
@@ -31,7 +31,7 @@
{% endblock %}
{% block event_content %}
{% block maincontent %}
{% if perms.events.delete_photo %}
{% for photo in photo_list %}
<div class="thumbnail">
@@ -59,8 +59,6 @@
</fieldset>
</form>
{% endif %}
{% if page_obj.has_other_pages %}{% include 'paginator.html' %}{% endif %}
{% endblock %}
{% block buttonbar %}{% endblock %}

View File

@@ -149,6 +149,12 @@ class EventPhoto(generic.UpdateView):
model = models.Photo
template_name = 'events/photo_detail.html'
def get_context_data(self, **kwargs):
context = super(EventPhoto, self).get_context_data()
event = models.Event.objects.get(id=self.kwargs['event'])
context['event'] = event
return context
def post(self, request, *args, **kwargs):
if request.POST.get('rotate') and request.user.has_perm('events.change_photo'):
photo = models.Photo.objects.get(pk=kwargs['pk'])