From: Radek Czajka Date: Thu, 23 Aug 2012 15:12:11 +0000 (+0200) Subject: stub graphics X-Git-Url: https://git.mdrn.pl/prawokultury.git/commitdiff_plain/a50ddc685551384615e95785eb01d4505412df5e?ds=sidebyside stub graphics --- diff --git a/events/templates/events/snippets/events_box.html b/events/templates/events/snippets/events_box.html index b10c33d..09e0c85 100755 --- a/events/templates/events/snippets/events_box.html +++ b/events/templates/events/snippets/events_box.html @@ -5,11 +5,16 @@ {% for event in objects %}
  • - {{ event.place }}, {{ event.date }} +
    +
    {{ event.date|date:"j" }}
    +
    {{ event.date|date:"b" }}
    +
    + {{ event.place }} {{ event.title }} {{ event.organizer }} +
  • {% endfor %} -{% trans "more events" %} + diff --git a/migdal/feeds.py b/migdal/feeds.py index 93b39ce..9e01f19 100755 --- a/migdal/feeds.py +++ b/migdal/feeds.py @@ -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 index 0000000..7368441 --- /dev/null +++ b/migdal/migrations/0003_auto__add_field_category_taxonomy.py @@ -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 diff --git a/migdal/models.py b/migdal/models.py index 90a2d3c..83a1865 100644 --- a/migdal/models.py +++ b/migdal/models.py @@ -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') diff --git a/migdal/settings.py b/migdal/settings.py index 3d5bd01..a2e5b52 100644 --- a/migdal/settings.py +++ b/migdal/settings.py @@ -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')), +) diff --git a/migdal/templates/migdal/categories.html b/migdal/templates/migdal/categories.html index 8a490c5..75c0805 100755 --- a/migdal/templates/migdal/categories.html +++ b/migdal/templates/migdal/categories.html @@ -1,7 +1,7 @@ \ No newline at end of file diff --git a/migdal/templates/migdal/entry/entry_detail.html b/migdal/templates/migdal/entry/entry_detail.html index 9812a59..c101e51 100755 --- a/migdal/templates/migdal/entry/entry_detail.html +++ b/migdal/templates/migdal/entry/entry_detail.html @@ -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" %} -
    +
    {% entry_begin entry %} {{ entry.body }} diff --git a/migdal/templates/migdal/entry/entry_list.html b/migdal/templates/migdal/entry/entry_list.html index 9f3ec41..0675363 100755 --- a/migdal/templates/migdal/entry/entry_list.html +++ b/migdal/templates/migdal/entry/entry_list.html @@ -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" %}

    diff --git a/migdal/templates/migdal/menu.html b/migdal/templates/migdal/menu.html new file mode 100755 index 0000000..3fcfef5 --- /dev/null +++ b/migdal/templates/migdal/menu.html @@ -0,0 +1,7 @@ +{% load i18n %} +{% for item in items %} + + {{ item.title }} +{% endfor %} diff --git a/migdal/templatetags/migdal_tags.py b/migdal/templatetags/migdal_tags.py index 5578c5d..f56322e 100644 --- a/migdal/templatetags/migdal_tags.py +++ b/migdal/templatetags/migdal_tags.py @@ -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} diff --git a/prawokultury/static/css/base.css b/prawokultury/static/css/base.css index e3227ee..82be08d 100755 --- a/prawokultury/static/css/base.css +++ b/prawokultury/static/css/base.css @@ -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 diff --git a/prawokultury/templates/base.html b/prawokultury/templates/base.html index bc23d2e..a5d0325 100755 --- a/prawokultury/templates/base.html +++ b/prawokultury/templates/base.html @@ -9,49 +9,74 @@ {% compressed_css 'base' %} - {% trans "Culture's right" %} -