stub graphics
authorRadek Czajka <radoslaw.czajka@nowoczesnapolska.org.pl>
Thu, 23 Aug 2012 15:12:11 +0000 (17:12 +0200)
committerRadek Czajka <radoslaw.czajka@nowoczesnapolska.org.pl>
Thu, 23 Aug 2012 15:12:11 +0000 (17:12 +0200)
12 files changed:
events/templates/events/snippets/events_box.html
migdal/feeds.py
migdal/migrations/0003_auto__add_field_category_taxonomy.py [new file with mode: 0644]
migdal/models.py
migdal/settings.py
migdal/templates/migdal/categories.html
migdal/templates/migdal/entry/entry_detail.html
migdal/templates/migdal/entry/entry_list.html
migdal/templates/migdal/menu.html [new file with mode: 0755]
migdal/templatetags/migdal_tags.py
prawokultury/static/css/base.css
prawokultury/templates/base.html

index b10c33d..09e0c85 100755 (executable)
@@ -5,11 +5,16 @@
 {% for event in objects %}
     <li class="event-list-item">
         <a target="_blank" href="{{ event.link }}">
-            {{ event.place }}, {{ event.date }}
+            <div class="date">
+                <div class="day">{{ event.date|date:"j" }}</div>
+                <div class="mon">{{ event.date|date:"b" }}</div>
+            </div>
+            {{ event.place }}
             {{ event.title }}
             {{ event.organizer }}
+            <div style="clear: both"></div>
         </a>
     </li>
 {% endfor %}
 </ul>
-<a href="{% url 'events' %}">{% trans "more events" %}</a>
+<!--p class="more"><a href="{% url 'events' %}">{% trans "more events" %}</a></p-->
index 93b39ce..9e01f19 100755 (executable)
@@ -20,6 +20,8 @@ class EntriesFeed(Feed):
             category = None
         if type_db:
             entry_type = TYPES_DICT[type_db]
+        else:
+            entry_type = None
         return {'entry_type': entry_type, 'category': category}
 
     def title(self, obj):
diff --git a/migdal/migrations/0003_auto__add_field_category_taxonomy.py b/migdal/migrations/0003_auto__add_field_category_taxonomy.py
new file mode 100644 (file)
index 0000000..7368441
--- /dev/null
@@ -0,0 +1,70 @@
+# -*- coding: utf-8 -*-
+import datetime
+from south.db import db
+from south.v2 import SchemaMigration
+from django.db import models
+
+
+class Migration(SchemaMigration):
+
+    def forwards(self, orm):
+        # Adding field 'Category.taxonomy'
+        db.add_column('migdal_category', 'taxonomy',
+                      self.gf('django.db.models.fields.CharField')(default='topics', max_length=32),
+                      keep_default=False)
+
+
+    def backwards(self, orm):
+        # Deleting field 'Category.taxonomy'
+        db.delete_column('migdal_category', 'taxonomy')
+
+
+    models = {
+        'migdal.attachment': {
+            'Meta': {'object_name': 'Attachment'},
+            'entry': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['migdal.Entry']"}),
+            'file': ('django.db.models.fields.files.FileField', [], {'max_length': '100'}),
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'})
+        },
+        'migdal.category': {
+            'Meta': {'object_name': 'Category'},
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'slug_en': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '50'}),
+            'slug_pl': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '50'}),
+            'taxonomy': ('django.db.models.fields.CharField', [], {'max_length': '32'}),
+            'title_en': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '64', 'db_index': 'True'}),
+            'title_pl': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '64', 'db_index': 'True'})
+        },
+        'migdal.entry': {
+            'Meta': {'ordering': "['-date']", 'object_name': 'Entry'},
+            '_body_en_rendered': ('django.db.models.fields.TextField', [], {}),
+            '_body_pl_rendered': ('django.db.models.fields.TextField', [], {}),
+            '_lead_en_rendered': ('django.db.models.fields.TextField', [], {}),
+            '_lead_pl_rendered': ('django.db.models.fields.TextField', [], {}),
+            'author': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
+            'author_email': ('django.db.models.fields.EmailField', [], {'max_length': '128', 'null': 'True', 'blank': 'True'}),
+            'body_en': ('markupfield.fields.MarkupField', [], {'null': 'True', 'rendered_field': 'True', 'blank': 'True'}),
+            'body_en_markup_type': ('django.db.models.fields.CharField', [], {'default': "'textile_pl'", 'max_length': '30', 'blank': 'True'}),
+            'body_pl': ('markupfield.fields.MarkupField', [], {'null': 'True', 'rendered_field': 'True', 'blank': 'True'}),
+            'body_pl_markup_type': ('django.db.models.fields.CharField', [], {'default': "'textile_pl'", 'max_length': '30', 'blank': 'True'}),
+            'categories': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'to': "orm['migdal.Category']", 'null': 'True', 'blank': 'True'}),
+            'date': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'db_index': 'True', 'blank': 'True'}),
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'image': ('django.db.models.fields.files.ImageField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}),
+            'lead_en': ('markupfield.fields.MarkupField', [], {'null': 'True', 'rendered_field': 'True', 'blank': 'True'}),
+            'lead_en_markup_type': ('django.db.models.fields.CharField', [], {'default': "'textile_pl'", 'max_length': '30', 'blank': 'True'}),
+            'lead_pl': ('markupfield.fields.MarkupField', [], {'null': 'True', 'rendered_field': 'True', 'blank': 'True'}),
+            'lead_pl_markup_type': ('django.db.models.fields.CharField', [], {'default': "'textile_pl'", 'max_length': '30', 'blank': 'True'}),
+            'needed_en': ('django.db.models.fields.CharField', [], {'default': "'n'", 'max_length': '1', 'db_index': 'True'}),
+            'promo': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+            'published_en': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+            'published_pl': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+            'slug_en': ('django.db.models.fields.SlugField', [], {'max_length': '50', 'unique': 'True', 'null': 'True', 'blank': 'True'}),
+            'slug_pl': ('django.db.models.fields.SlugField', [], {'max_length': '50', 'unique': 'True', 'null': 'True', 'blank': 'True'}),
+            'title_en': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
+            'title_pl': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
+            'type': ('django.db.models.fields.CharField', [], {'max_length': '16', 'db_index': 'True'})
+        }
+    }
+
+    complete_apps = ['migdal']
\ No newline at end of file
index 90a2d3c..83a1865 100644 (file)
@@ -10,6 +10,8 @@ from migdal import settings
 
 
 class Category(models.Model):
+    taxonomy = models.CharField(_('taxonomy'), max_length=32,
+                    choices=settings.TAXONOMIES)
 
     class Meta:
         verbose_name = _('category')
index 3d5bd01..a2e5b52 100644 (file)
@@ -30,3 +30,9 @@ LANGUAGE_CODE = app_setting('MIGDAL_LANGUAGE_CODE', settings.LANGUAGE_CODE)
 OBLIGATORY_LANGUAGES = app_setting('MIGDAL_OBLIGATORY', tuple(
     lang for lang in LANGUAGES if lang[0]==LANGUAGE_CODE))
 OPTIONAL_LANGUAGES = tuple(lang for lang in LANGUAGES if lang not in OBLIGATORY_LANGUAGES)
+
+
+TAXONOMIES = (
+    ('topics', _('topics')),
+    ('types', _('types')),
+)
index 8a490c5..75c0805 100755 (executable)
@@ -1,7 +1,7 @@
 <ul class="categories">
     {% for cat in object_list %}
-        <li class="category">
-            <a href="{{ cat.get_absolute_url }}">{{ cat }} ({{cat.entry_set.count}})</a>
+        <li class="category category-taxonomy-{{ cat.taxonomy }}">
+            <a href="{{ cat.get_absolute_url }}">{{ cat }}</a>
         </li>
     {% endfor %}
 </ul>
\ No newline at end of file
index 9812a59..c101e51 100755 (executable)
@@ -3,9 +3,18 @@
 {% load migdal_tags %}
 
 
+{% block "main_menu" %}
+    {% if entry.categories %}
+        {% main_menu 'objects' entry.categories.all %}
+    {% else %}
+        {% main_menu 'entry_type' entry.type %}
+    {% endif %}
+{% endblock "main_menu" %}
+
+
 {% block "body" %}
 
-<div class="entry entry-short entry-{{ object.type }}">
+<div class="entry entry-short entry-{{ entry.type }}">
 
 {% entry_begin entry %}
 {{ entry.body }}
index 9f3ec41..0675363 100755 (executable)
@@ -3,6 +3,18 @@
 {% load i18n %}
 {% load migdal_tags %}
 
+
+{% block "main_menu" %}
+    {% if category %}
+        {% main_menu 'object' category %}
+    {% elif entry_type %}
+        {% main_menu 'entry_type' entry_type.db %}
+    {% else %}
+        {{ block.super }}
+    {% endif %}
+{% endblock "main_menu" %}
+
+
 {% block "body" %}
 
 <h1>
diff --git a/migdal/templates/migdal/menu.html b/migdal/templates/migdal/menu.html
new file mode 100755 (executable)
index 0000000..3fcfef5
--- /dev/null
@@ -0,0 +1,7 @@
+{% load i18n %}
+{% for item in items %}
+    <li{% if item.active %} 
+        class="active"{%endif %} {% if item.html_id %}
+        id="{{ item.html_id}}"{% endif %}>
+        <a href="{{ item.url }}">{{ item.title }}</a></li>
+{% endfor %}
index 5578c5d..f56322e 100644 (file)
@@ -4,8 +4,11 @@
 #
 from django_comments_xtd.models import XtdComment
 from django.contrib import comments
+from django.core.urlresolvers import reverse
 from django import template
-from migdal.models import Category
+from migdal.models import Category, Entry
+from migdal import settings
+from django.utils.translation import ugettext_lazy as _
 
 register = template.Library()
 
@@ -16,7 +19,10 @@ def entry_begin(context, entry):
         'migdal/entry/%s/entry_begin.html' % entry.type,
         'migdal/entry/entry_begin.html',
     ))
-    context.update({'object': entry})
+    context = {
+        'request': context['request'],
+        'object': entry,
+    }
     return t.render(template.Context(context))
 
 
@@ -26,13 +32,19 @@ def entry_short(context, entry):
         'migdal/entry/%s/entry_short.html' % entry.type,
         'migdal/entry/entry_short.html',
     ))
-    context.update({'object': entry})
+    context = {
+        'request': context['request'],
+        'object': entry,
+    }
     return t.render(template.Context(context))
 
 
 @register.inclusion_tag('migdal/categories.html', takes_context=True)
-def categories(context):
-    context.update({'object_list': Category.objects.all()})
+def categories(context, taxonomy):
+    context = {
+        'request': context['request'],
+        'object_list': Category.objects.filter(taxonomy=taxonomy)
+    }
     return context
 
 
@@ -47,4 +59,58 @@ def entry_comment_form(entry):
     return {
             'form': comments.get_form()(entry),
             'next': entry.get_absolute_url(),
-        }
\ No newline at end of file
+        }
+
+
+class MenuItem(object):
+    html_id = None
+
+    def __init__(self, title, url, html_id=None):
+        self.title = title
+        self.url = url
+        self.html_id = html_id
+
+    def check_active(self, chooser, value):
+        self.active = chooser == 'url' and value == self.url
+
+
+class ModelMenuItem(object):
+    def __init__(self, obj, html_id=None):
+        self.obj = obj
+        self.title = unicode(obj)
+        self.url = obj.get_absolute_url()
+        self.html_id = html_id
+
+    def check_active(self, chooser, value):
+        self.active = (chooser == 'object' and value == self.obj or
+                        chooser == 'objects' and self.obj in value)
+
+
+class EntryTypeMenuItem(object):
+    def __init__(self, title, type_, html_id=None):
+        self.type = type_
+        self.title = title
+        self.url = reverse('migdal_entry_list_%s' % type_)
+        self.html_id = html_id
+
+    def check_active(self, chooser, value):
+        self.active = (chooser == 'object' and isinstance(value, Entry)
+                        and value.type == self.type or
+                        chooser == 'entry_type' and value == self.type)
+
+@register.inclusion_tag('migdal/menu.html', takes_context=True)
+def main_menu(context, chooser=None, value=None):
+    items = [
+        ModelMenuItem(Entry.objects.get(slug_pl='o-nas')),
+        EntryTypeMenuItem(_(u'Publications'), u'publications'),
+        MenuItem(_(u'Events'), reverse('events')),
+        ModelMenuItem(Category.objects.get(slug_pl='stanowisko')),
+        ModelMenuItem(Category.objects.get(slug_pl='pierwsza-pomoc')),
+    ]
+    if context['request'].LANGUAGE_CODE == 'pl':
+        items.append(MenuItem(u'en', '/en/', html_id='item-lang'))
+    else:
+        items.append(MenuItem(u'pl', '/', html_id='item-lang'))
+    for item in items:
+        item.check_active(chooser, value)
+    return {'items': items}
index e3227ee..82be08d 100755 (executable)
@@ -1,17 +1,54 @@
 body {
-    font-family: Purisa, sans-serif;
+    font-family: sans-serif;
+    font-size: .625em;
+    background: #edece7;
+}
+
+a {
+    text-decoration: none;
+}
+a:hover {
+    text-decoration: underline;
 }
 
 #menu {
     list-style: none;
     padding-left: 0;
     margin-left: 0;
+    text-transform: uppercase;
+    margin: 0;
+}
+#menu #item-lang a {
+    color: #0050a2;
 }
 #menu li {
     display: inline-block;
+    position: relative;
     list-style: none;
     padding-left: 0;
-    margin-left: 0;
+    margin-right: 5em;
+}
+#menu li a {
+    color: black;
+}
+#menu li.active {
+    font-weight: bold;
+}
+#menu li.active:before {
+    color: #004e98;
+    content: "(";
+    position: absolute;
+    left: -.7em;
+    font-size: 2em;
+    top: -.25em;
+}
+#menu li.active:after {
+    color: #004e98;
+    content: ")";
+    position: absolute;
+    right: -.7em;
+    font-size: 2em;
+    top: -.25em;
 }
 
 .avatar {
@@ -26,4 +63,109 @@ body {
 }
 .entry-data {
     font-size: .8em;
+}
+
+
+
+.bar-right {
+    width: 25em;
+    float: right;
+}
+.bar-left {
+    width: 70em;
+    float: left;
+}
+#body {
+    width: 96em;
+    margin: auto;
+    padding: 1em;
+}
+#footer-bar {
+    color: #4b4c47;
+    border-top: 1px solid #acacaa;
+    padding-top: 1.5em;
+    margin-top: 4em;
+}
+.footer-item {
+    width: 24em;
+    float: left;
+}
+#search-form input {
+    font-size: 1.1em;
+    width: 18em;
+    border: none;
+    border-radius: 1.5em 0 0 1.5em;
+    background: white;
+    color: black;
+    height: 2em;
+}
+#search-form button {
+    font-size: 1.1em;
+    width: 3em;
+    height: 2em;
+    border: none;
+    background: #3bb0a8;
+    color: white;
+    border-radius: 0 1em 1em 0;
+}
+
+.sidebar-box {
+    border-top: 1px solid #8a8b85;
+    padding-top: 1.5em;
+    padding-bottom: 1.5em;
+    clear: both;
+}
+
+.sidebar-box .event-list {
+    list-style: none;
+    padding-left: 0;
+}
+.sidebar-box .more {
+    text-align: right;
+}
+.sidebar-box .event-list li {
+    margin-top: .8em;
+}
+
+.sidebar-box .event-list .date {
+    clear: both;
+    float: left;
+    background: #494949;
+    color: #69efe6;
+    width: 4em;
+    height: 3.8em;
+    border-radius: .5em;
+    padding: .5em;
+    text-align: center;
+    margin-right: 1em;
+}
+.sidebar-box .event-list a {
+    display: block;
+}
+.sidebar-box .event-list .date .day {
+    font-size: 1.8em;
+    font-style: italic;
+}
+.sidebar-box .event-list .date .mon {
+    text-transform: uppercase;
+}
+
+#sidebar-box-categories ul {
+    width: 50%;
+    display: table-cell;
+    list-style: none;
+    padding-left: 0;
+    padding-right: 4em;
+}
+#sidebar-box-categories .category-taxonomy-topics a {
+    color: #31ada3;
+}
+
+#sidebar-box-categories .category-taxonomy-types a {
+    color: #ff6100;
+}
+
+
+sdiv {
+    border: #ddd 1px solid;
 }
\ No newline at end of file
index bc23d2e..a5d0325 100755 (executable)
@@ -9,49 +9,74 @@
         {% compressed_css 'base' %}
     </head>
     <body>
-        <a href="{% url "migdal_main" %}">{% trans "Culture's right" %}</a>
-        <ul id="menu">
-            {% if request.LANGUAGE_CODE == 'pl' %}
-                <li><a href="{% url 'migdal_entry_info' 'o-nas' %}">{% trans "About us" %}</a></li>
-            {% else %}
-                <li><a href="{% url 'migdal_entry_info' 'about-us' %}">{% trans "About us" %}</a></li>
-            {% endif %}
-            <li><a href="{% url 'migdal_entry_list_publications' %}">{% trans "Publications" %}</a></li>
-            <li><a href="{% url 'events' %}">{% trans "Events" %}</a></li>
-            {% if request.LANGUAGE_CODE == 'pl' %}
-                <li><a href="{% url 'migdal_category' 'stanowiska' %}">{% trans "Positions" %}</a></li>
-                <li><a href="{% url 'migdal_category' 'pierwsza-pomoc' %}">{% trans "First aid" %}</a></li>
-                <li><a href="/en">English</a></li>
-            {% else %}
-                <li><a href="{% url 'migdal_category' 'positions' %}">{% trans "Positions" %}</a></li>
-                <li><a href="{% url 'migdal_category' 'first-aid' %}">{% trans "First aid" %}</a></li>
-                <li><a href="/">polski</a></li>
-            {% endif %}
+    <div id="body">
+
+        <div id="header-bar">
+        <div class="bar-left">
+            <a id="logo" href="{% url "migdal_main" %}">{% trans "Culture's right" %}</a>
+        </div>
+        <div class="bar-right">
+            <a id="logo-fnp" href="http://nowoczesnapolska.org.pl">[Logo FNP]</a>
+            <a id="logo-osi" href="http://osi">[Logo OSI]</a>
+        </div>
+        <div style="clear: both;"></div>
+        </div>
+
+        <div id="menu-bar">
+        <div class="bar-right">
+            <form id="search-form"><input /><button>?</button></form>
+        </div>
+        <ul id="menu" class="bar-left">
+            {% block "main_menu" %}
+                {% main_menu 'url' request.get_full_path %}
+            {% endblock %}
         </ul>
+        <div style="clear: both;"></div>
+        </div>
 
-        <div id="sidebar" style="float:right; width: 20%;">
+        <div id="main-bar">
+        <div id="sidebar" class="bar-right">
             {% block "sidebar" %}
                 <div class="sidebar-box">
                     <h3>{% trans "Upcoming events" %}</h3>
                     {% events_box %}
                 </div>
+                <div id="sidebar-box-categories" class="sidebar-box">
+                    {% categories 'topics' %}
+                    {% categories 'types' %}
+                </div>
                 <div class="sidebar-box">
-                    <h3>{% trans "Categories" %}</h3>
-                    {% categories %}
+                    <a href="{% url 'migdal_main_feed' %}">RSS</a>
                 </div>
                 <div class="sidebar-box">
                     <h3>{% trans "Latest comments" %}</h3>
                     {% last_comments %}
                 </div>
-                <div class="sidebar-box">
-                    <h3>{% trans "Follow us" %}</h3>
-                    <a href="{% url 'migdal_main_feed' %}">RSS</a>
-                </div>
             {% endblock %}
         </div>
-
-        <div id="body" style="width: 75%">
+        <div id="content" class="bar-left">
             {% block "body" %}{% endblock %}
         </div>
+        <div style="clear: both;"></div>
+        </div>
+
+        <div id="footer-bar">
+            <p class="footer-item">
+                <strong>Fundacja Nowoczesna Polska</strong><br/>
+                <br/>
+                ul.MarszaƂkowska 84/92 lok. 125<br/>
+                00-514 Warszawa<br/>
+                tel/fax: +48 22 621 30 17<br/>
+                e-mail: fundacja@nowoczesnapolska.org.pl
+            </p>
+            <p class="footer-item">
+                <br/><br/>
+                KRS: 0000070056<br/>
+                REGON: 017423865<br/>
+                Nr konta: 46 10201097 0000 7502 0001 6766
+            </p>
+        </div>
+
+    </div>
     </body>
 </html>
\ No newline at end of file