From: Radek Czajka Date: Wed, 10 Oct 2012 11:22:49 +0000 (+0200) Subject: Nicer menu. X-Git-Url: https://git.mdrn.pl/prawokultury.git/commitdiff_plain/99ff7cb43e460029b1769fc21f704b7614381cf1?ds=inline Nicer menu. --- diff --git a/contact/forms.py b/contact/forms.py index 81a83df..70a415b 100644 --- a/contact/forms.py +++ b/contact/forms.py @@ -39,11 +39,12 @@ class ContactForm(forms.Form): attachment.file.save(value.name, value) attachment.save() + site = Site.objects.get_current() dictionary = { 'form_tag': self.form_tag, - 'site': Site.objects.get_current(), + 'site_name': site.name, + 'site_domain': site.domain, 'contact': contact, - 'admin_url': '', } context = RequestContext(request) mail_managers_subject = render_to_string([ @@ -67,7 +68,7 @@ class ContactForm(forms.Form): 'contact/mail_body.txt', ], dictionary, context) send_mail(mail_subject, mail_body, - 'no-reply@%s' % dictionary['site'].domain, + 'no-reply@%s' % site.domain, [contact.contact], fail_silently=True) diff --git a/contact/locale/pl/LC_MESSAGES/django.mo b/contact/locale/pl/LC_MESSAGES/django.mo index fb22992..985b0c0 100644 Binary files a/contact/locale/pl/LC_MESSAGES/django.mo and b/contact/locale/pl/LC_MESSAGES/django.mo differ diff --git a/contact/locale/pl/LC_MESSAGES/django.po b/contact/locale/pl/LC_MESSAGES/django.po index c2e5844..7805958 100644 --- a/contact/locale/pl/LC_MESSAGES/django.po +++ b/contact/locale/pl/LC_MESSAGES/django.po @@ -7,8 +7,8 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2012-10-08 16:48+0200\n" -"PO-Revision-Date: 2012-10-08 16:51+0100\n" +"POT-Creation-Date: 2012-10-10 13:12+0200\n" +"PO-Revision-Date: 2012-10-10 13:12+0100\n" "Last-Translator: Radek Czajka \n" "Language-Team: LANGUAGE \n" "Language: \n" @@ -60,8 +60,8 @@ msgstr "Wyślij" #: templates/contact/mail_body.txt:2 #: templates/contact/mail_subject.txt:1 #, python-format -msgid "Thank you for contacting us at %(site.name)s." -msgstr "Dziękujemy za skontaktowanie się z nami na stronie %(site.name)s." +msgid "Thank you for contacting us at %(site_name)s." +msgstr "Dziękujemy za skontaktowanie się z nami na stronie %(site_name)s." #: templates/contact/mail_body.txt:3 msgid "Your submission has been referred to the project coordinator." diff --git a/contact/templates/contact/form.html b/contact/templates/contact/form.html index 85a971e..3374c58 100644 --- a/contact/templates/contact/form.html +++ b/contact/templates/contact/form.html @@ -7,7 +7,7 @@ {% block contact_form_description %} {% endblock %} -
+ {% csrf_token %} {{ form.as_table }} diff --git a/contact/templates/contact/mail_body.txt b/contact/templates/contact/mail_body.txt index b6037ad..5015757 100644 --- a/contact/templates/contact/mail_body.txt +++ b/contact/templates/contact/mail_body.txt @@ -1,5 +1,5 @@ {% load i18n %} -{% blocktrans %}Thank you for contacting us at {{ site.name }}.{% endblocktrans %} +{% blocktrans %}Thank you for contacting us at {{ site_name }}.{% endblocktrans %} {% trans "Your submission has been referred to the project coordinator." %} -- diff --git a/contact/templates/contact/mail_managers_body.txt b/contact/templates/contact/mail_managers_body.txt index 1090fb7..c54478a 100644 --- a/contact/templates/contact/mail_managers_body.txt +++ b/contact/templates/contact/mail_managers_body.txt @@ -1,5 +1,5 @@ -Wypełniono formularz {{ form_tag }} na stronie {{ site.name }}. +{% load url from future %}Wypełniono formularz {{ form_tag }} na stronie {{ site_name }}. -http://{{ site.domain }}{{ admin_url }} +http://{{ site_domain }}{% url 'admin:contact_contact_change' contact.pk %} {{ contact.body }} diff --git a/contact/templates/contact/mail_managers_subject.txt b/contact/templates/contact/mail_managers_subject.txt index 93088ee..12d2c8e 100644 --- a/contact/templates/contact/mail_managers_subject.txt +++ b/contact/templates/contact/mail_managers_subject.txt @@ -1 +1 @@ -Wypełniono formularz {{ form_tag }} na stronie {{ site.name }}. \ No newline at end of file +Wypełniono formularz {{ form_tag }} na stronie {{ site_name }}. \ No newline at end of file diff --git a/contact/templates/contact/mail_subject.txt b/contact/templates/contact/mail_subject.txt index 3edb82a..b8f586e 100644 --- a/contact/templates/contact/mail_subject.txt +++ b/contact/templates/contact/mail_subject.txt @@ -1 +1 @@ -{% load i18n %}{% blocktrans %}Thank you for contacting us at {{ site.name }}.{% endblocktrans %} \ No newline at end of file +{% load i18n %}{% blocktrans %}Thank you for contacting us at {{ site_name }}.{% endblocktrans %} \ No newline at end of file diff --git a/fnpdjango/templates/fnpdjango/lang_switcher.html b/fnpdjango/templates/fnpdjango/lang_switcher.html new file mode 100755 index 0000000..9b725ac --- /dev/null +++ b/fnpdjango/templates/fnpdjango/lang_switcher.html @@ -0,0 +1,6 @@ +{% load i18n fnp_lang %} +{% for lc, ln in languages %} + {% if lc != request.LANGUAGE_CODE %} + {{ lc }} + {% endif %} +{% endfor %} \ No newline at end of file diff --git a/fnpdjango/templatetags/fnp_lang.py b/fnpdjango/templatetags/fnp_lang.py new file mode 100755 index 0000000..8eb5194 --- /dev/null +++ b/fnpdjango/templatetags/fnp_lang.py @@ -0,0 +1,45 @@ +from django.conf import settings +from django.core.urlresolvers import resolve, reverse +from django import template +from django.utils import translation +from ..utils.views import get_current_object + +register = template.Library() + + +@register.inclusion_tag('fnpdjango/lang_switcher.html', takes_context=True) +def lang_switcher(context): + """Context-aware language switcher. + + Use ..utils.views.set_current_object to provide the context. + """ + request = context['request'] + obj = get_current_object(request) + languages = settings.LANGUAGES + if hasattr(obj, 'get_available_languages'): + available_languages = set(obj.get_available_languages()) + languages = [lang for lang in languages if lang[0] in available_languages] + return { + 'request': request, + 'languages': languages, + } + + +@register.filter +def get_here_url(request, lang): + obj = get_current_object(request, for_url=True) + if hasattr(obj, 'get_absolute_url'): + with translation.override(lang): + url = obj.get_absolute_url() + else: + match = resolve(request.get_full_path()) + view = match.url_name + if view is None: + view = match.func + if lang is None: + lang = translation.get_language() + with translation.override(lang): + url = reverse(view, args=match.args, kwargs=match.kwargs) + return url + + diff --git a/fnpdjango/utils/views.py b/fnpdjango/utils/views.py index caf8a43..f2270cc 100644 --- a/fnpdjango/utils/views.py +++ b/fnpdjango/utils/views.py @@ -15,3 +15,14 @@ def serve_file(url): return response else: return HttpResponseRedirect(url) + + +def set_current_object(request, obj, in_url=True): + request.CURRENT_OBJECT = obj + request.CURRENT_OBJECT_IN_URL = in_url + + +def get_current_object(request, for_url=False): + if for_url and not getattr(request, 'CURRENT_OBJECT_IN_URL', True): + return None + return getattr(request, 'CURRENT_OBJECT', None) diff --git a/menu/__init__.py b/menu/__init__.py new file mode 100644 index 0000000..d1daaa0 --- /dev/null +++ b/menu/__init__.py @@ -0,0 +1,8 @@ +from fnpdjango.utils.app import AppSettings + + +class Settings(AppSettings): + MODULE = 'menu_items' + + +app_settings = Settings('MENU') diff --git a/menu/helpers.py b/menu/helpers.py new file mode 100755 index 0000000..2a5df9d --- /dev/null +++ b/menu/helpers.py @@ -0,0 +1,74 @@ +class MenuItem(object): + html_id = None + + def __init__(self, url, title, html_id=None): + self.url = url + self.title = title + self.html_id = html_id + + def is_active(self, request, value): + return request.get_full_path() == str(self.url) + + def check_active(self, request, value): + self.active = self.is_active(request, value) + + def get_url(self): + return self.url + + def get_title(self): + return self.title + + +class ObjectMenuItem(MenuItem): + """Menu item corresponding to an object. + + If no url or title is provided, get_absolute_url and __unicode__ are used. + You can also provide a reverse lookup dictionary, as in {model: field_name}. + """ + def __init__(self, obj, url=None, rev_lookups=None, title=None, html_id=None): + super(ObjectMenuItem, self).__init__(url=url, title=title, html_id=html_id) + self.obj = obj + self.rev_lookups = rev_lookups + + def get_title(self): + return self.title or unicode(self.obj) + + @property + def get_url(self): + return self.url or self.get_obj().get_absolute_url() + + def is_active(self, request, value): + if value == self.obj: + return True + if self.rev_lookups: + for model, manager in self.rev_lookups.items(): + if (isinstance(value, model) and + self.obj in getattr(value, manager).all()): + return True + return False + + +class ModelMenuItem(MenuItem): + """Menu item corresponding to a model, optionally filtered by some fields.""" + + def __init__(self, model, url, field_lookups=None, title=None, html_id=None): + if title is None: + title = unicode(model) + super(ModelMenuItem, self).__init__(title=title, url=url, html_id=html_id) + self.model = model + self.field_lookups = field_lookups + + def is_active(self, request, value): + if value == self.model and not self.field_lookups: + return True + if isinstance(value, self.model) and self.field_lookups: + lookups_ok = True + for field, lookup in self.field_lookups.items(): + if getattr(value, field) != lookup: + lookups_ok = False + if lookups_ok: + return True + return False + + def get_title(self): + return self.title or unicode(self.model) diff --git a/menu/models.py b/menu/models.py new file mode 100644 index 0000000..bebdfaa --- /dev/null +++ b/menu/models.py @@ -0,0 +1,4 @@ +import importlib +from . import app_settings + +items = importlib.import_module(app_settings.MODULE).ITEMS diff --git a/menu/templates/menu/menu.html b/menu/templates/menu/menu.html new file mode 100755 index 0000000..56debe5 --- /dev/null +++ b/menu/templates/menu/menu.html @@ -0,0 +1,7 @@ +{% load i18n %} +{% for item in items %} + + {{ item.get_title }} +{% endfor %} diff --git a/menu/templatetags/__init__.py b/menu/templatetags/__init__.py new file mode 100755 index 0000000..e69de29 diff --git a/menu/templatetags/menu_tags.py b/menu/templatetags/menu_tags.py new file mode 100755 index 0000000..7446cb7 --- /dev/null +++ b/menu/templatetags/menu_tags.py @@ -0,0 +1,14 @@ +from django import template +from fnpdjango.utils.views import get_current_object +from ..models import items + +register = template.Library() + + +@register.inclusion_tag('menu/menu.html', takes_context=True) +def main_menu(context): + request = context['request'] + obj = get_current_object(request) + for item in items: + item.check_active(request, obj) + return {'items': items} diff --git a/migdal/__init__.py b/migdal/__init__.py index 4d3a144..fe90406 100644 --- a/migdal/__init__.py +++ b/migdal/__init__.py @@ -25,7 +25,7 @@ class Settings(AppSettings): ) LAST_COMMENTS = 5 - MENU = [] + MAIN_PAGE_ENTRY = None TYPES_DICT = None def _more_TYPES_DICT(self, value): diff --git a/migdal/templates/migdal/entry/entry_detail.html b/migdal/templates/migdal/entry/entry_detail.html index 92bf2dd..c19b49b 100755 --- a/migdal/templates/migdal/entry/entry_detail.html +++ b/migdal/templates/migdal/entry/entry_detail.html @@ -16,11 +16,6 @@ {% endspaceless %}{% endblock %} -{% block "main_menu" %} - {% main_menu 'object' entry %} -{% endblock "main_menu" %} - - {% block "body" %} {% if not entry.published %} diff --git a/migdal/templates/migdal/entry/entry_list.html b/migdal/templates/migdal/entry/entry_list.html index bd9bbf6..e144533 100755 --- a/migdal/templates/migdal/entry/entry_list.html +++ b/migdal/templates/migdal/entry/entry_list.html @@ -5,17 +5,6 @@ {% 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" %} {% if category %} diff --git a/migdal/templates/migdal/menu.html b/migdal/templates/migdal/menu.html deleted file mode 100755 index 3fcfef5..0000000 --- a/migdal/templates/migdal/menu.html +++ /dev/null @@ -1,7 +0,0 @@ -{% load i18n %} -{% for item in items %} - - {{ item.title }} -{% endfor %} diff --git a/migdal/templates/search/search.html b/migdal/templates/search/search.html index 84610ff..31be738 100644 --- a/migdal/templates/search/search.html +++ b/migdal/templates/search/search.html @@ -2,7 +2,7 @@ {% load url from future %} {% load i18n %} {% load migdal_tags %} -{% load events_tags %} +{#% load events_tags %#} {% block "body" %} @@ -11,8 +11,8 @@ {% for result in page.object_list %} {% if result.model_name == "entry" %} {% entry_short result.object %} - {% elif result.model_name == "event" %} - {% event_short result.object %} + {#% elif result.model_name == "event" %#} + {#% event_short result.object %#} {% endif %} {% empty %}

{% trans "No results found." %}

diff --git a/migdal/templatetags/migdal_tags.py b/migdal/templatetags/migdal_tags.py index d12920f..c1b824c 100644 --- a/migdal/templatetags/migdal_tags.py +++ b/migdal/templatetags/migdal_tags.py @@ -4,7 +4,6 @@ # from django_comments_xtd.models import XtdComment from django.contrib import comments -from django.core.urlresolvers import reverse from django import template from migdal import app_settings from migdal.models import Category, Entry @@ -76,62 +75,3 @@ def entry_comment_form(entry): 'form': comments.get_form()(entry), 'next': entry.get_absolute_url(), } - - -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, title=None, html_id=None): - self.obj = obj - self.title = title or 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 CategoryMenuItem(ModelMenuItem): - def check_active(self, chooser, value): - super(CategoryMenuItem, self).check_active(chooser, value) - self.active = (self.active or - (chooser == 'object' and isinstance(value, Entry) and - self.obj in value.categories.all())) - - -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')), - #MenuItem(_(u'Events'), reverse('events')), - ] - # TODO: context-aware language switcher - 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/migdal/urls.py b/migdal/urls.py index 310a648..49a4346 100644 --- a/migdal/urls.py +++ b/migdal/urls.py @@ -28,7 +28,7 @@ for t in app_settings.TYPES: urlpatterns = i18n_patterns('', # main page - url(r'^$', 'migdal.views.entry_list', name='migdal_main'), + url(r'^$', 'migdal.views.main', name='migdal_main'), url(r'^rss.xml$', feeds.EntriesFeed(), name='migdal_main_feed'), # submit new entry url(string_concat(r'^', _('submit'), r'/$'), 'migdal.views.submit', name='migdal_submit'), diff --git a/migdal/views.py b/migdal/views.py index 84cd6fe..d8652c7 100644 --- a/migdal/views.py +++ b/migdal/views.py @@ -4,6 +4,7 @@ # from django.shortcuts import get_object_or_404, render, redirect from django.utils.translation import get_language +from fnpdjango.utils.views import set_current_object from migdal import api from migdal.forms import get_submit_form from migdal.models import Category, Entry @@ -11,6 +12,14 @@ from migdal import app_settings from haystack.views import SearchView +def main(request): + if app_settings.MAIN_PAGE_ENTRY is not None: + main_entry = Entry.objects.get(**app_settings.MAIN_PAGE_ENTRY) + return entry(request, entry=main_entry) + else: + return entry_list(request) + + def entry_list(request, type_db=None, category_slug=None): lang = request.LANGUAGE_CODE templates = ["migdal/entry/entry_list.html"] @@ -30,6 +39,9 @@ def entry_list(request, type_db=None, category_slug=None): else: category = None + if category: + set_current_object(request, category) + promobox = 5 if entry_type is None and category is None else None object_list = api.entry_list(entry_type=entry_type, category=category, @@ -43,15 +55,17 @@ def entry_list(request, type_db=None, category_slug=None): }) -def entry(request, type_db, slug): - lang = request.LANGUAGE_CODE - args = {'type': type_db, 'slug_%s' % lang: slug} - if not request.user.has_perm('migdal.change_entry'): - args['published_%s' % lang] = True - entry = get_object_or_404(Entry, **args) +def entry(request, type_db=None, slug=None, entry=None): + if entry is None: + lang = request.LANGUAGE_CODE + args = {'type': type_db, 'slug_%s' % lang: slug} + entry = get_object_or_404(Entry, **args) + if request.user.has_perm('migdal.change_entry') or not entry.published: + raise Http404 + set_current_object(request, entry, in_url=slug is not None) templates = ["migdal/entry/entry_detail.html"] - if type_db is not None: + if entry.type is not None: templates = ["migdal/entry/%s/entry_detail.html" % type_db] + templates return render(request, templates, {'entry': entry}) diff --git a/prawokultury/contact_forms.py b/prawokultury/contact_forms.py old mode 100755 new mode 100644 index 4fbdd9c..90fc529 --- a/prawokultury/contact_forms.py +++ b/prawokultury/contact_forms.py @@ -6,6 +6,10 @@ from django.utils.translation import ugettext_lazy as _ class RegistrationForm(ContactForm): form_tag = 'register' name = forms.CharField(label=_('Name'), max_length=128) - organization = forms.CharField(label=_('Organization'), max_length=128) - summary = forms.CharField(label=_('Summary'), widget=forms.Textarea) - presentation = forms.FileField(label=_('Presentation')) + contact = forms.EmailField(label=_('E-mail'), max_length=128) + organization = forms.CharField(label=_('Organization'), + max_length=256, required=False) + presentation = forms.FileField(label=_('Presentation'), + required=False) + summary = forms.CharField(label=_('Summary'), + widget=forms.Textarea, required=False) diff --git a/prawokultury/locale/pl/LC_MESSAGES/django.mo b/prawokultury/locale/pl/LC_MESSAGES/django.mo index a24b21f..6a54584 100644 Binary files a/prawokultury/locale/pl/LC_MESSAGES/django.mo and b/prawokultury/locale/pl/LC_MESSAGES/django.mo differ diff --git a/prawokultury/locale/pl/LC_MESSAGES/django.po b/prawokultury/locale/pl/LC_MESSAGES/django.po index 31b4010..193eb47 100644 --- a/prawokultury/locale/pl/LC_MESSAGES/django.po +++ b/prawokultury/locale/pl/LC_MESSAGES/django.po @@ -7,8 +7,8 @@ msgid "" msgstr "" "Project-Id-Version: prawokultury\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2012-08-30 11:15+0200\n" -"PO-Revision-Date: 2012-08-30 11:15+0100\n" +"POT-Creation-Date: 2012-10-10 12:41+0200\n" +"PO-Revision-Date: 2012-10-10 12:42+0100\n" "Last-Translator: Radek Czajka \n" "Language-Team: FNP \n" "Language: \n" @@ -17,15 +17,28 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2)\n" -#: urls.py:23 -msgid "events" -msgstr "wydarzenia" +#: contact_forms.py:8 +msgid "Name" +msgstr "Imię i nazwisko" -#: templates/404.html:5 -msgid "Page not found." -msgstr "Strona nie znaleziona." +#: contact_forms.py:9 +msgid "Organization" +msgstr "Organizacja" + +#: contact_forms.py:10 +msgid "Summary" +msgstr "Podsumowanie prezentacji" + +#: contact_forms.py:11 +msgid "Presentation" +msgstr "Prezentacja" -#: templates/404.html:10 +#: menu_items.py:22 +msgid "Form" +msgstr "Formularz" + +#: templates/404.html:5 +#: templates/404.html.py:10 msgid "Page not found" msgstr "Strona nie znaleziona" @@ -33,73 +46,60 @@ msgstr "Strona nie znaleziona" msgid "The page you were looking for doesn't exist." msgstr "Strona, której szukasz, nie istnieje." -#: templates/base.html:8 -#: templates/base.html.py:13 -#: templates/base.html:14 -#: templates/base.html.py:25 -#: templates/base.html:73 -msgid "Culture's right" -msgstr "Prawo kultury" +#: templates/base.html:26 +msgid "CopyCamp" +msgstr "CopyCamp" -#: templates/base.html:30 -msgid "Organizer" -msgstr "Organizator" +#: templates/base.html:41 +msgid "Search" +msgstr "Szukaj" -#: templates/base.html:33 -msgid "Modern Poland Foundation" -msgstr "Fundacja Nowoczesna Polska" +#: templates/base.html:84 +msgid "If not explicitly stated otherwise, all texts are licensed under the Creative Commons Attribution-Share Alike free license." +msgstr "Jeśli nie oznaczono inaczej, wszystkie teksty są objęte wolną licencją Creative Commons Uznanie autorstwa – Na tych samych warunkach." -#: templates/base.html:35 -msgid "Sponsor" -msgstr "Wspierane przez" +#: templates/contact/register/form.html:4 +msgid "Registration form" +msgstr "Formularz rejestracyjny" -#: templates/base.html:38 -msgid "Trust for Civil Society in Central and Eastern Europe" -msgstr "" +#~ msgid "events" +#~ msgstr "wydarzenia" -#: templates/base.html:47 -msgid "Search" -msgstr "Szukaj" +#~ msgid "Page not found." +#~ msgstr "Strona nie znaleziona." -#: templates/base.html:62 -msgid "Upcoming events" -msgstr "Nadchodzące wydarzenia" +#~ msgid "Culture's right" +#~ msgstr "Prawo kultury" -#: templates/base.html:77 -msgid "Latest comments" -msgstr "Ostatnie komentarze" +#~ msgid "Modern Poland Foundation" +#~ msgstr "Fundacja Nowoczesna Polska" -#: templates/base.html:105 -msgid "If not explicitly stated otherwise, all texts are licensed under the Creative Commons Attribution-Share Alike free license." -msgstr "Jeśli nie oznaczono inaczej, wszystkie teksty są objęte wolną licencją Creative Commons Uznanie autorstwa – Na tych samych warunkach." +#~ msgid "Sponsor" +#~ msgstr "Wspierane przez" + +#~ msgid "Upcoming events" +#~ msgstr "Nadchodzące wydarzenia" + +#~ msgid "Latest comments" +#~ msgstr "Ostatnie komentarze" + +#~ msgid "Share on Facebook" +#~ msgstr "Podziel się na Facebooku" + +#~ msgid "Share on Google+" +#~ msgstr "Podziel się na Google+" + +#~ msgid "Share on Twitter" +#~ msgstr "Podziel się na Twitterze" + +#~ msgid "Share on NK.pl" +#~ msgstr "Podziel się na NK.pl" + +#~ msgid "next" +#~ msgstr "następne" -#: templates/share.html:5 -#: templates/share.html.py:7 -msgid "Share on Facebook" -msgstr "Podziel się na Facebooku" - -#: templates/share.html:10 -#: templates/share.html.py:12 -msgid "Share on Google+" -msgstr "Podziel się na Google+" - -#: templates/share.html:15 -#: templates/share.html.py:17 -msgid "Share on Twitter" -msgstr "Podziel się na Twitterze" - -#: templates/share.html:20 -#: templates/share.html.py:22 -msgid "Share on NK.pl" -msgstr "Podziel się na NK.pl" - -#: templates/prevnext/next.html:13 -msgid "next" -msgstr "następne" - -#: templates/prevnext/previous.html:13 -msgid "previous" -msgstr "poprzednie" +#~ msgid "previous" +#~ msgstr "poprzednie" #~ msgid "About us" #~ msgstr "O nas" diff --git a/prawokultury/menu_items.py b/prawokultury/menu_items.py new file mode 100644 index 0000000..59f3fc9 --- /dev/null +++ b/prawokultury/menu_items.py @@ -0,0 +1,24 @@ +from migdal.models import Entry +from menu.helpers import ObjectMenuItem, MenuItem +from django.core.urlresolvers import reverse_lazy +from django.utils.translation import ugettext_lazy as _ + + +ITEMS = [] + +def add_entry(**qs): + try: + entry = Entry.objects.get(**qs) + except Entry.DoesNotExist: + return + if not entry.published: + return + ITEMS.append(ObjectMenuItem(entry)) + +add_entry(slug_pl='co') +add_entry(slug_pl='gdzie') +add_entry(slug_pl='program') +add_entry(slug_pl='media') +ITEMS.append(MenuItem(reverse_lazy('contact_form', args=['register']), _('Form'))) +add_entry(slug_pl='materialy') +add_entry(slug_pl='kontakt') diff --git a/prawokultury/settings.d/30-apps.conf b/prawokultury/settings.d/30-apps.conf index f466de7..ec61087 100755 --- a/prawokultury/settings.d/30-apps.conf +++ b/prawokultury/settings.d/30-apps.conf @@ -3,9 +3,11 @@ INSTALLED_APPS = ( 'fnpdjango', #'events', + 'menu', 'migdal', 'contact', + 'sponsors', 'gravatar', 'south', 'django.contrib.comments', diff --git a/prawokultury/settings.d/60-custom.conf b/prawokultury/settings.d/60-custom.conf index 9fec2d5..4e8f264 100755 --- a/prawokultury/settings.d/60-custom.conf +++ b/prawokultury/settings.d/60-custom.conf @@ -6,9 +6,13 @@ MIGDAL_TYPES = ( ) MIGDAL_TAXONOMIES = () +MIGDAL_MAIN_PAGE_ENTRY = {'slug_pl': 'jakies-info'} CONTACT_FORMS_MODULE = 'prawokultury.contact_forms' +MENU_MODULE = 'prawokultury.menu_items' + # Use Nginx's X-accel when serving files with helpers.serve_file(). # See http://wiki.nginx.org/X-accel X_ACCEL_REDIRECT = False + diff --git a/prawokultury/static/css/forms.css b/prawokultury/static/css/forms.css index 9b3957d..4acb30f 100644 --- a/prawokultury/static/css/forms.css +++ b/prawokultury/static/css/forms.css @@ -34,3 +34,7 @@ font-size: 1.1em; } .submit-form .helptext a { color: #363A3B; } + .submit-form .required label { + font-weight: bold; } + .submit-form .required label:before { + content: '* '; } diff --git a/prawokultury/static/css/forms.scss b/prawokultury/static/css/forms.scss index 626702e..7e8d90a 100644 --- a/prawokultury/static/css/forms.scss +++ b/prawokultury/static/css/forms.scss @@ -51,4 +51,11 @@ color: #363A3B; } } + + .required label { + font-weight: bold; + } + .required label:before { + content: '* '; + } } diff --git a/prawokultury/templates/base.html b/prawokultury/templates/base.html index 6473962..5f200a5 100755 --- a/prawokultury/templates/base.html +++ b/prawokultury/templates/base.html @@ -1,7 +1,8 @@ {% load url from future %} {% load i18n static %} -{% load fnp_common migdal_tags fnp_share %} +{% load fnp_common migdal_tags fnp_share fnp_lang menu_tags %} +{% load sponsor_tags %} {% load compressed %} @@ -27,7 +28,6 @@
@@ -37,14 +37,15 @@ @@ -53,7 +54,7 @@ diff --git a/prawokultury/urls.py b/prawokultury/urls.py index 049edac..2dcdfb9 100644 --- a/prawokultury/urls.py +++ b/prawokultury/urls.py @@ -23,7 +23,7 @@ urlpatterns = patterns('', (r'^accounts/login/$', 'django_cas.views.login'), (r'^accounts/logout/$', 'django_cas.views.logout'), ) + i18n_patterns('', - url(string_concat(r'^', _('events'), r'/'), include('events.urls')), + #url(string_concat(r'^', _('events'), r'/'), include('events.urls')), url(r'^comments/', include('django_comments_xtd.urls')), url(r'^contact/', include('contact.urls')), ) + migdal_urlpatterns diff --git a/requirements.txt b/requirements.txt index 4fb7200..0aaad30 100644 --- a/requirements.txt +++ b/requirements.txt @@ -22,3 +22,5 @@ django-pipeline>=1.2,<1.3 -e git+https://github.com/toastdriven/django-haystack.git@master#egg=django-haystack pysolr piwik + +-e git+https://github.com/fnp/django-sponsors.git@master#egg=django-sponsors