more graphics
authorRadek Czajka <radoslaw.czajka@nowoczesnapolska.org.pl>
Mon, 27 Aug 2012 15:23:15 +0000 (17:23 +0200)
committerRadek Czajka <radoslaw.czajka@nowoczesnapolska.org.pl>
Mon, 27 Aug 2012 15:23:15 +0000 (17:23 +0200)
27 files changed:
events/static/events/events.css [new file with mode: 0644]
events/static/events/events.scss [new file with mode: 0755]
events/templates/events/event_list.html
events/urls.py
events/views.py
migdal/__init__.py
migdal/templates/migdal/entry/entry_begin.html
migdal/templates/migdal/entry/entry_list.html
migdal/templates/migdal/entry/entry_promobox.html
migdal/templates/migdal/entry/info/entry_begin.html
migdal/templates/migdal/entry/publications/entry_begin.html [new file with mode: 0755]
migdal/templatetags/migdal_tags.py
prawokultury/settings.d/50-static.conf
prawokultury/static/css/base.css
prawokultury/static/css/base.scss
prawokultury/static/css/entry.css
prawokultury/static/css/entry.scss
prawokultury/static/css/prevnext.css [new file with mode: 0644]
prawokultury/static/css/prevnext.scss [new file with mode: 0755]
prawokultury/static/css/sidebar.css
prawokultury/static/css/sidebar.scss
prawokultury/static/img/previous.png [new file with mode: 0644]
prawokultury/templates/base.html
prawokultury/templates/prevnext/next.html [new file with mode: 0755]
prawokultury/templates/prevnext/previous.html [new file with mode: 0755]
prawokultury/templates/prevnext/prevnext.html [new file with mode: 0755]
prawokultury/templatetags/prevnext.py [new file with mode: 0755]

diff --git a/events/static/events/events.css b/events/static/events/events.css
new file mode 100644 (file)
index 0000000..2dcefc2
--- /dev/null
@@ -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 (executable)
index 0000000..ba8b9ce
--- /dev/null
@@ -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;
+    }
+
+
+}
index 62b1259..80dcffb 100755 (executable)
@@ -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
index 5dbae6d..ebec896 100644 (file)
@@ -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'),
 )
index 60f00ef..c3c6197 100644 (file)
@@ -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,
+    })
index 97496e5..05322b4 100644 (file)
@@ -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):
index b694564..c355ccf 100755 (executable)
@@ -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 %}
index 3b9e763..6fa3f01 100755 (executable)
@@ -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
index 0eb9fac..9b81f59 100755 (executable)
@@ -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 %}
index dd8de2b..e2843c9 100755 (executable)
@@ -1,4 +1,5 @@
 {% load i18n %}
+{% load thumbnail %}
 
 {% if detail %}
     <h1>{{ object.title }}</h1>
 
 
 {% 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 (executable)
index 0000000..e2843c9
--- /dev/null
@@ -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>
index 2ec8081..43371b1 100644 (file)
@@ -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'))
index 2c42405..1a90443 100755 (executable)
@@ -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',
     },
index db64390..8e64719 100644 (file)
@@ -16,6 +16,6 @@ a:hover {
   text-decoration: underline; }
 
 h1 {
-  margin: 0;
+  margin: 0 0 .5em 0;
   color: #01519a;
   font-size: 2em; }
index 54a73fa..5890910 100755 (executable)
@@ -20,7 +20,7 @@ a:hover {
 
 
 h1 {
-    margin: 0;
+    margin: 0 0 .5em 0;
     color: #01519a;
     font-size: 2em;
 }
index bb7d7a0..ed7e8a8 100644 (file)
@@ -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; }
 
       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; }
index dcfbe93..6e67528 100755 (executable)
@@ -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 (file)
index 0000000..34ad8d0
--- /dev/null
@@ -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 (executable)
index 0000000..7190f20
--- /dev/null
@@ -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
index 71c43ea..f5baa3d 100644 (file)
@@ -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;
         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 {
index 187db6b..ecc6416 100755 (executable)
@@ -25,8 +25,9 @@
 
         a {
             display: block;
+            color: #363a3b;;
         }
-        
+
         .date {
             clear: both;
             float: left;
             }
         }
 
-        .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 (file)
index 0000000..c6f8d48
Binary files /dev/null and b/prawokultury/static/img/previous.png differ
index 452e3f0..5355e5a 100755 (executable)
@@ -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 (executable)
index 0000000..928011f
--- /dev/null
@@ -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 (executable)
index 0000000..88a656b
--- /dev/null
@@ -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 (executable)
index 0000000..8a5cd04
--- /dev/null
@@ -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 (executable)
index 0000000..ec067e7
--- /dev/null
@@ -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