From: Radek Czajka <radoslaw.czajka@nowoczesnapolska.org.pl> Date: Mon, 27 Aug 2012 15:23:15 +0000 (+0200) Subject: more graphics X-Git-Url: https://git.mdrn.pl/prawokultury.git/commitdiff_plain/6f1d6a6fe9607eb612d2dc95340d414dda043e92 more graphics --- diff --git a/events/static/events/events.css b/events/static/events/events.css new file mode 100644 index 0000000..2dcefc2 --- /dev/null +++ b/events/static/events/events.css @@ -0,0 +1,14 @@ +.event { + margin-top: 2em; + padding-bottom: 2em; + border-bottom: 1px solid #8b8b87; } + .event h2 { + color: #01519a; + font-weight: normal; + font-size: 1.3em; + margin-bottom: 1.1em; } + .event a { + display: block; + color: #363a3b; } + .event .description { + margin-top: 1.4em; } diff --git a/events/static/events/events.scss b/events/static/events/events.scss new file mode 100755 index 0000000..ba8b9ce --- /dev/null +++ b/events/static/events/events.scss @@ -0,0 +1,23 @@ +.event { + margin-top: 2em; + padding-bottom: 2em; + border-bottom: 1px solid #8b8b87; + + h2 { + color: #01519a; + font-weight: normal; + font-size: 1.3em; + margin-bottom: 1.1em; + } + + a { + display: block; + color: #363a3b; + } + + .description { + margin-top: 1.4em; + } + + +} diff --git a/events/templates/events/event_list.html b/events/templates/events/event_list.html index 62b1259..80dcffb 100755 --- a/events/templates/events/event_list.html +++ b/events/templates/events/event_list.html @@ -1,12 +1,36 @@ {% extends "base.html" %} -{% load i18n %} +{% load url from future %} +{% load i18n pagination_tags prevnext %} {% block "body" %} <h1>{% trans "Events" %}</h1> + +{% autopaginate object_list 10 %} {% for event in object_list %} - {{ event.title }} - {{ event.place }} - {{ event.organizer }} - {{ event.date }} + <div class="event"> + <a href="{{ event.link }}"> + <h2>{{ event.date }}</h2>{# just date #} + <strong class="title">{{ event.title }}</strong> + + <div class="description"> + {{ event.date }}, {{ event.place }}<br/> + {% trans "Organizer" %}: {{ event.organizer }}<br/> + </div> + </a> + </div> {% endfor %} + +<p class="prevnext"> +{% next_page %} +{% if past %} + {% url "events" as prev_url %} + {% trans "see upcoming events" as prev_label %} + {% previous_page prev_url prev_label %} +{% else %} + {% url "events_past" as prev_url %} + {% trans "see past events" as prev_label %} + {% previous_page prev_url prev_label %} +{% endif %} +</p> + {% endblock %} \ No newline at end of file diff --git a/events/urls.py b/events/urls.py index 5dbae6d..ebec896 100644 --- a/events/urls.py +++ b/events/urls.py @@ -3,11 +3,10 @@ # Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information. # from django.conf.urls import patterns, include, url -from django.views.generic import ListView, DetailView -from events.models import Event +from django.utils.translation import string_concat, ugettext_lazy as _ -urlpatterns = patterns('', - url(r'^$', ListView.as_view(model=Event), name='events'), - #url(r'^(?P<slug>[^/]+)/$', DetailView.as_view(model=Event), name='news'), +urlpatterns = patterns('events.views', + url(r'^$', 'events', name='events'), + url(string_concat('^', _('past'), '/$'), 'events_past', name='events_past'), ) diff --git a/events/views.py b/events/views.py index 60f00ef..c3c6197 100644 --- a/events/views.py +++ b/events/views.py @@ -1 +1,17 @@ -# Create your views here. +from datetime import datetime +from django.shortcuts import render +from events.models import Event + + +def events(request): + return render(request, 'events/event_list.html', { + 'object_list': Event.objects.filter(date__gte=datetime.now()) + }) + + +def events_past(request): + return render(request, 'events/event_list.html', { + 'object_list': Event.objects.filter(date__lte=datetime.now() + ).order_by('-date'), + 'past': True, + }) diff --git a/migdal/__init__.py b/migdal/__init__.py index 97496e5..05322b4 100644 --- a/migdal/__init__.py +++ b/migdal/__init__.py @@ -23,7 +23,7 @@ class Settings(AppSettings): ('topics', _('topics')), ('types', _('types')), ) - LAST_COMMENTS = 10 + LAST_COMMENTS = 5 TYPES_DICT = None def _more_TYPES_DICT(self, value): diff --git a/migdal/templates/migdal/entry/entry_begin.html b/migdal/templates/migdal/entry/entry_begin.html index b694564..c355ccf 100755 --- a/migdal/templates/migdal/entry/entry_begin.html +++ b/migdal/templates/migdal/entry/entry_begin.html @@ -1,7 +1,7 @@ {% load i18n %} {% load gravatar thumbnail %} -<img class="avatar" src="{% gravatar_for_email object.author_email 64 %}"/> +<img class="avatar" src="{% gravatar_for_email object.author_email 64 %}" alt="Avatar"/> {% if detail %} <h1>{{ object.title }}</h1> {% else %} diff --git a/migdal/templates/migdal/entry/entry_list.html b/migdal/templates/migdal/entry/entry_list.html index 3b9e763..6fa3f01 100755 --- a/migdal/templates/migdal/entry/entry_list.html +++ b/migdal/templates/migdal/entry/entry_list.html @@ -1,7 +1,7 @@ {% extends "base.html" %} {% load url from future %} {% load i18n %} -{% load pagination_tags %} +{% load pagination_tags prevnext %} {% load migdal_tags %} @@ -61,6 +61,6 @@ {% for object in object_list %} {% entry_short object %} {% endfor %} -{% paginate %} +{% prevnext %} {% endblock %} \ No newline at end of file diff --git a/migdal/templates/migdal/entry/entry_promobox.html b/migdal/templates/migdal/entry/entry_promobox.html index 0eb9fac..9b81f59 100755 --- a/migdal/templates/migdal/entry/entry_promobox.html +++ b/migdal/templates/migdal/entry/entry_promobox.html @@ -1,7 +1,7 @@ {% load i18n %} -<li class="promobox-item"{% if counter == 1 %}class="active"{% endif %} +<li class="promobox-item"{% if counter == 1 %} class="active"{% endif %} style=" {% if counter != 1 %}display: none;{% endif %} {% if object.image %} diff --git a/migdal/templates/migdal/entry/info/entry_begin.html b/migdal/templates/migdal/entry/info/entry_begin.html index dd8de2b..e2843c9 100755 --- a/migdal/templates/migdal/entry/info/entry_begin.html +++ b/migdal/templates/migdal/entry/info/entry_begin.html @@ -1,4 +1,5 @@ {% load i18n %} +{% load thumbnail %} {% if detail %} <h1>{{ object.title }}</h1> @@ -24,7 +25,11 @@ {% if object.image %} - <img class="entry-picture" src="{{ object.image.url }}" /> + <img class="entry-picture" src="{% thumbnail object.image "250x300" as thumb %} + {{ thumb.url }} + {% empty %} + {{ object.image.url }} + {% endthumbnail %}" /> {% endif %} <div class="lead"> {{ object.lead }} diff --git a/migdal/templates/migdal/entry/publications/entry_begin.html b/migdal/templates/migdal/entry/publications/entry_begin.html new file mode 100755 index 0000000..e2843c9 --- /dev/null +++ b/migdal/templates/migdal/entry/publications/entry_begin.html @@ -0,0 +1,36 @@ +{% load i18n %} +{% load thumbnail %} + +{% if detail %} + <h1>{{ object.title }}</h1> +{% else %} + <h2><a href="{{ object.get_absolute_url }}">{{ object.title }}</a></h2> +{% endif %} + + +<div class="entry-data"> +{% if request.LANGUAGE_CODE == 'pl' %} + {% if object.published_en %} + {% language 'en' %} + <a href="{{ object.get_absolute_url }}">English version</a> + {% endlanguage %} + {% endif %} +{% elif object.published_pl %} + {{ request.LANGUAGE_CODE }} + {% language 'pl' %} + <a href="{{ object.get_absolute_url }}">polska wersja</a> + {% endlanguage %} +{% endif %} +</div> + + +{% if object.image %} + <img class="entry-picture" src="{% thumbnail object.image "250x300" as thumb %} + {{ thumb.url }} + {% empty %} + {{ object.image.url }} + {% endthumbnail %}" /> +{% endif %} +<div class="lead"> +{{ object.lead }} +</div> diff --git a/migdal/templatetags/migdal_tags.py b/migdal/templatetags/migdal_tags.py index 2ec8081..43371b1 100644 --- a/migdal/templatetags/migdal_tags.py +++ b/migdal/templatetags/migdal_tags.py @@ -126,8 +126,10 @@ def main_menu(context, chooser=None, value=None): ModelMenuItem(Entry.objects.get(slug_pl='o-nas')), EntryTypeMenuItem(_(u'Publications'), u'publications'), MenuItem(_(u'Events'), reverse('events')), - CategoryMenuItem(Category.objects.get(slug_pl='stanowisko'), title=_('Positions')), - CategoryMenuItem(Category.objects.get(slug_pl='pierwsza-pomoc')), + CategoryMenuItem(Category.objects.get(slug_pl='stanowisko'), + title=_('Positions')), + CategoryMenuItem(Category.objects.get(slug_pl='pierwsza-pomoc'), + title=_('First aid in copyright')), ] if context['request'].LANGUAGE_CODE == 'pl': items.append(MenuItem(u'en', '/en/', html_id='item-lang')) diff --git a/prawokultury/settings.d/50-static.conf b/prawokultury/settings.d/50-static.conf index 2c42405..1a90443 100755 --- a/prawokultury/settings.d/50-static.conf +++ b/prawokultury/settings.d/50-static.conf @@ -24,6 +24,8 @@ PIPELINE_CSS = { 'css/promobox.scss', 'css/entry.scss', 'css/footer.scss', + 'css/prevnext.scss', + 'events/events.scss', ), 'output_filename': 'compressed/base.css', }, diff --git a/prawokultury/static/css/base.css b/prawokultury/static/css/base.css index db64390..8e64719 100644 --- a/prawokultury/static/css/base.css +++ b/prawokultury/static/css/base.css @@ -16,6 +16,6 @@ a:hover { text-decoration: underline; } h1 { - margin: 0; + margin: 0 0 .5em 0; color: #01519a; font-size: 2em; } diff --git a/prawokultury/static/css/base.scss b/prawokultury/static/css/base.scss index 54a73fa..5890910 100755 --- a/prawokultury/static/css/base.scss +++ b/prawokultury/static/css/base.scss @@ -20,7 +20,7 @@ a:hover { h1 { - margin: 0; + margin: 0 0 .5em 0; color: #01519a; font-size: 2em; } diff --git a/prawokultury/static/css/entry.css b/prawokultury/static/css/entry.css index bb7d7a0..ed7e8a8 100644 --- a/prawokultury/static/css/entry.css +++ b/prawokultury/static/css/entry.css @@ -4,7 +4,7 @@ margin-top: 0em; } .entry-short { - border-top: 1px solid #8b8b87; } + border-bottom: 1px solid #8b8b87; } .entry-short .entry-wrapped { padding-top: .7em; } @@ -49,9 +49,11 @@ content: url("/static/img/read-more.png"); margin-left: .7em; } -.entry-info .entry-wrapped { +.entry-info .entry-wrapped, +.entry-publications .entry-wrapped { margin-left: 0; } - .entry-info .entry-wrapped h1 { + .entry-info .entry-wrapped h1, + .entry-publications .entry-wrapped h1 { font-size: 2em; } .entry-picture { @@ -60,8 +62,9 @@ .submit-link { margin-top: 1em; - margin-bottom: 1em; - height: 1.7em; } + padding-bottom: 1em; + height: 1.7em; + border-bottom: 1px solid #8b8b87; } .submit-link a { color: black; font-size: 1.1em; } diff --git a/prawokultury/static/css/entry.scss b/prawokultury/static/css/entry.scss index dcfbe93..6e67528 100755 --- a/prawokultury/static/css/entry.scss +++ b/prawokultury/static/css/entry.scss @@ -5,7 +5,7 @@ } .entry-short { - border-top: 1px solid #8b8b87; + border-bottom: 1px solid #8b8b87; .entry-wrapped { padding-top: .7em; @@ -75,7 +75,8 @@ } } -.entry-info .entry-wrapped { +.entry-info .entry-wrapped, +.entry-publications .entry-wrapped { margin-left: 0; h1 { font-size: 2em; @@ -89,8 +90,9 @@ .submit-link { margin-top: 1em; - margin-bottom: 1em; + padding-bottom: 1em; height: 1.7em; + border-bottom: 1px solid #8b8b87; a { color: black; diff --git a/prawokultury/static/css/prevnext.css b/prawokultury/static/css/prevnext.css new file mode 100644 index 0000000..34ad8d0 --- /dev/null +++ b/prawokultury/static/css/prevnext.css @@ -0,0 +1,16 @@ +.prevnext { + font-size: 1.1em; + font-style: italic; + margin-top: 1.4em; } + .prevnext a { + color: #acacac; } + .prevnext .next_page { + float: right; } + .prevnext .next_page:after { + content: url("/static/img/read-more.png"); + vertical-align: middle; + margin-left: .7em; } + .prevnext .previous_page:before { + content: url("/static/img/previous.png"); + vertical-align: middle; + margin-right: .7em; } diff --git a/prawokultury/static/css/prevnext.scss b/prawokultury/static/css/prevnext.scss new file mode 100755 index 0000000..7190f20 --- /dev/null +++ b/prawokultury/static/css/prevnext.scss @@ -0,0 +1,25 @@ +.prevnext { + font-size: 1.1em; + font-style: italic; + margin-top: 1.4em; + + a { + color: #acacac; + } + + .next_page { + float: right; + } + .next_page:after { + content: url('/static/img/read-more.png'); + vertical-align: middle; + margin-left: .7em; + } + .previous_page { + } + .previous_page:before { + content: url('/static/img/previous.png'); + vertical-align: middle; + margin-right: .7em; + } +} \ No newline at end of file diff --git a/prawokultury/static/css/sidebar.css b/prawokultury/static/css/sidebar.css index 71c43ea..f5baa3d 100644 --- a/prawokultury/static/css/sidebar.css +++ b/prawokultury/static/css/sidebar.css @@ -16,7 +16,8 @@ .sidebar-box .event-list li { margin-top: 1em; } .sidebar-box .event-list a { - display: block; } + display: block; + color: #363a3b; } .sidebar-box .event-list .date { clear: both; float: left; @@ -36,10 +37,7 @@ font-size: 1.1em; text-transform: uppercase; margin-top: -0.3em; } - .sidebar-box .event-list .date:hover { - text-decoration: none; } .sidebar-box .event-list .description { - color: black; font-size: 1.1em; } #sidebar-box-categories ul { diff --git a/prawokultury/static/css/sidebar.scss b/prawokultury/static/css/sidebar.scss index 187db6b..ecc6416 100755 --- a/prawokultury/static/css/sidebar.scss +++ b/prawokultury/static/css/sidebar.scss @@ -25,8 +25,9 @@ a { display: block; + color: #363a3b;; } - + .date { clear: both; float: left; @@ -51,12 +52,7 @@ } } - .date:hover { - text-decoration: none; - } - .description { - color: black; font-size: 1.1em; } } diff --git a/prawokultury/static/img/previous.png b/prawokultury/static/img/previous.png new file mode 100644 index 0000000..c6f8d48 Binary files /dev/null and b/prawokultury/static/img/previous.png differ diff --git a/prawokultury/templates/base.html b/prawokultury/templates/base.html index 452e3f0..5355e5a 100755 --- a/prawokultury/templates/base.html +++ b/prawokultury/templates/base.html @@ -1,3 +1,4 @@ +<!DOCTYPE html> {% load url from future %} {% load i18n static %} {% load migdal_tags events_tags %} @@ -58,9 +59,9 @@ {% categories 'topics' %} {% categories 'types' %} </div> - <div class="sidebar-box"> + <!--div class="sidebar-box"> <a href="{% url 'migdal_main_feed' %}">RSS</a> - </div> + </div--> <div class="sidebar-box"> <h3>{% trans "Latest comments" %}</h3> {% last_comments %} diff --git a/prawokultury/templates/prevnext/next.html b/prawokultury/templates/prevnext/next.html new file mode 100755 index 0000000..928011f --- /dev/null +++ b/prawokultury/templates/prevnext/next.html @@ -0,0 +1,16 @@ +{% if number or url %} + {% load i18n %} + <a class="next_page" + {% if number %} + href="?page={{ number }}" + {% else %} + href="{{ url }}" + {% endif %} + > + {% if title %} + {{ title }} + {% else %} + {% trans "next" %} + {% endif %} + </a> +{% endif %} \ No newline at end of file diff --git a/prawokultury/templates/prevnext/previous.html b/prawokultury/templates/prevnext/previous.html new file mode 100755 index 0000000..88a656b --- /dev/null +++ b/prawokultury/templates/prevnext/previous.html @@ -0,0 +1,16 @@ +{% if number or url %} + {% load i18n %} + <a class="previous_page" + {% if number %} + href="?page={{ number }}" + {% else %} + href="{{ url }}" + {% endif %} + > + {% if title %} + {{ title }} + {% else %} + {% trans "previous" %} + {% endif %} + </a> +{% endif %} \ No newline at end of file diff --git a/prawokultury/templates/prevnext/prevnext.html b/prawokultury/templates/prevnext/prevnext.html new file mode 100755 index 0000000..8a5cd04 --- /dev/null +++ b/prawokultury/templates/prevnext/prevnext.html @@ -0,0 +1,5 @@ +{% load prevnext %} +<p class="prevnext"> +{% next_page %} +{% previous_page %} +</p> \ No newline at end of file diff --git a/prawokultury/templatetags/prevnext.py b/prawokultury/templatetags/prevnext.py new file mode 100755 index 0000000..ec067e7 --- /dev/null +++ b/prawokultury/templatetags/prevnext.py @@ -0,0 +1,27 @@ +from django.template import Library + +register = Library() + + +@register.inclusion_tag('prevnext/previous.html', takes_context=True) +def previous_page(context, fallback=None, fallback_title=None): + current = context['page_obj'].number + if current > 1: + return {'number': current - 1, 'title': None, 'url': None} + else: + return {'number': None, 'title': fallback_title, 'url': fallback} + + +@register.inclusion_tag('prevnext/next.html', takes_context=True) +def next_page(context, fallback=None, fallback_title=None): + current = context['page_obj'].number + page_range = context['paginator'].page_range + if current < page_range[-1]: + return {'number': current + 1, 'title': None, 'url': None} + else: + return {'number': None, 'title': fallback_title, 'url': fallback} + + +@register.inclusion_tag('prevnext/prevnext.html', takes_context=True) +def prevnext(context): + return context