From e390e737951ea78e783070b9729a877945daaa42 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Marek=20St=C4=99pniowski?= Date: Sat, 16 Aug 2008 13:08:25 +0200 Subject: [PATCH 1/1] Changed login method. --- catalogue/views.py | 14 +++++- chunks/admin.py | 4 +- chunks/models.py | 7 ++- chunks/templatetags/chunks.py | 2 +- media/css/master.css | 58 +++++++++++++++++++---- settings.py | 2 +- templates/auth/login.html | 25 +++++++--- templates/base.html | 36 +++++++++++++- templates/catalogue/book_list.html | 6 +-- templates/catalogue/main_page.html | 6 ++- templates/catalogue/tagged_book_list.html | 2 - urls.py | 11 ++--- 12 files changed, 131 insertions(+), 42 deletions(-) diff --git a/catalogue/views.py b/catalogue/views.py index a0315a4c6..dc2e7b107 100644 --- a/catalogue/views.py +++ b/catalogue/views.py @@ -6,7 +6,7 @@ from django.core.urlresolvers import reverse from django.db.models import Q from django.contrib.auth.decorators import login_required from django.utils.datastructures import SortedDict -from django.views.decorators.http import require_POST +from django.views.decorators.http import require_GET, require_POST from catalogue import models from catalogue import forms @@ -28,7 +28,16 @@ def catalogue_redirect(request, tags=''): else: return HttpResponseRedirect(reverse('catalogue.views.main_page')) - +# +# @require_GET +# def tag_search(request): +# search_form = forms.SearchForm(request.GET) +# if search_form.is_valid(): +# query = search_form.cleaned_data['q'] +# tags = search_form.cleaned_data['tags'] +# + + def tags_starting_with(request): try: prefix = request.GET['q'] @@ -144,6 +153,7 @@ def book_sets(request, slug): return render_to_response('catalogue/book_sets.html', locals(), context_instance=RequestContext(request)) + @login_required @require_POST def new_set(request): diff --git a/chunks/admin.py b/chunks/admin.py index 29c1fc24f..c44d5a037 100644 --- a/chunks/admin.py +++ b/chunks/admin.py @@ -4,8 +4,8 @@ from chunks.models import Chunk class ChunkAdmin(admin.ModelAdmin): - list_display = ('key',) - search_fields = ('key', 'content') + list_display = ('key', 'description',) + search_fields = ('key', 'content',) admin.site.register(Chunk, ChunkAdmin) diff --git a/chunks/models.py b/chunks/models.py index ac164524b..396d221ed 100644 --- a/chunks/models.py +++ b/chunks/models.py @@ -4,12 +4,11 @@ from django.utils.translation import ugettext_lazy as _ class Chunk(models.Model): """ - A Chunk is a piece of content associated - with a unique key that can be inserted into - any template with the use of a special template - tag + A Chunk is a piece of content associated with a unique key that can be inserted into + any template with the use of a special template tag. """ key = models.CharField(_('key'), help_text=_('A unique name for this chunk of content'), primary_key=True, max_length=255) + description = models.CharField(_('description'), blank=True, max_length=255) content = models.TextField(_('content'), blank=True) class Meta: diff --git a/chunks/templatetags/chunks.py b/chunks/templatetags/chunks.py index fe8efdefe..f79d495ec 100644 --- a/chunks/templatetags/chunks.py +++ b/chunks/templatetags/chunks.py @@ -39,7 +39,7 @@ class ChunkNode(template.Node): except Chunk.DoesNotExist: n = Chunk(key=self.key) n.save() - return 'SOME TEXT PLEASE' + return '' return content register.tag('chunk', do_get_chunk) diff --git a/media/css/master.css b/media/css/master.css index 3fa1655ea..942111ce9 100644 --- a/media/css/master.css +++ b/media/css/master.css @@ -3,7 +3,7 @@ body { font: 70% Verdana, Arial, Helvetica, sans-serif; line-height: 1.5em; background: #FFF url(/media/img/bg.png) repeat-x; - color: #000; + color: #2F4110; } img { @@ -26,7 +26,7 @@ input { h1 { font: normal normal bold 1.75em Arial, sans-serif; color: #2F4110; - margin: 1em 0 0 0; + margin: 0.55em 0 0 0; } h2 { @@ -53,7 +53,7 @@ em { } .blur { - color: #999; + color: #777; } /* ================================== */ @@ -73,6 +73,15 @@ em { text-align: right; } +#site-description { + margin-top: -1.5em; + height:4.5em; + overflow: hidden; + float: right; + width: 42em; + text-align: right; + color: #777; +} /* ======================== */ /* = Footer with sponsors = */ @@ -296,9 +305,14 @@ em { } .cuteform ol li, .cuteform ul li { - margin-top: 0.5em; + margin-top: 0.7em; +} + +.cuteform label { + display: block; } + /* ================ */ /* = Modal Window = */ /* ================ */ @@ -307,28 +321,55 @@ em { display: none; width: 32em; background-color: transparent; - color: #333; margin-top: -0.5em; margin-left: -1em; } #set-window div.header { background-color: #FFF; - border-right: 0.5em solid #DDD; + border-right: 0.25em solid #DDD; width: 4em; padding: 0.5em 1em 0.5em 1em; } #set-window div.target { background-color: #FFF; - border-right: 0.5em solid #DDD; - border-bottom: 0.5em solid #DDD; + border-right: 0.3em solid #DDD; + border-bottom: 0.3em solid #DDD; padding: 1em; } .jqmOverlay { background-color: #000; } +#login-register-window { + position: absolute; + display: none; + width: 24em; + background-color: transparent; + margin-top: -0.5em; + margin-left: 1em; +} + +#login-register-window div.header { + background-color: #FFF; + border-right: 0.3em solid #DDD; + width: 4em; + right: 0; + left: auto; + padding: 0.5em 1em 0.5em 1em; + float: right; + text-align: center; +} + +#login-register-window div.target { + clear: both; + background-color: #FFF; + border-right: 0.3em solid #DDD; + border-bottom: 0.3em solid #DDD; + padding: 1em; +} + /* ======================== */ /* = Alphabetic book list = */ /* ======================== */ @@ -337,3 +378,4 @@ em { margin: 0.3em 0 1.2em 0; list-style: none; } + diff --git a/settings.py b/settings.py index 829eaf8bf..788e33e96 100644 --- a/settings.py +++ b/settings.py @@ -97,7 +97,7 @@ COMPRESS_CSS = { COMPRESS_JS = { 'all': { 'source_filenames': ('js/jquery.js', 'js/jquery.autocolumn.js', 'js/jquery.autocomplete.js', - 'js/jquery.form.js', 'js/jquery.jqmodal.js', 'js/jquery.labelify.js', 'js/jquery.cuteform.js',), + 'js/jquery.form.js', 'js/jquery.jqmodal.js', 'js/jquery.labelify.js', 'js/catalogue.js',), 'output_filename': 'js/all.min.js', } } diff --git a/templates/auth/login.html b/templates/auth/login.html index dcacd8155..6db94aa22 100644 --- a/templates/auth/login.html +++ b/templates/auth/login.html @@ -1,13 +1,24 @@ {% extends "base.html" %} +{% block title %}Zaloguj / Zarejestruj się w WolneLektury.pl{% endblock %} + {% block body %} -

Zaloguj / Zarejestruj

+

Zaloguj się / Załóż konto

+
+

  • {{ search_form.q }}
  • lub wróć do strony głównej

    +
    +
    +

    Zaloguj się

    +
      + {{ form.as_ul }} +
    1. +
    +

    +
    -
    -
      - {{ form.as_ul }} -
    1. -
    -

    + +

    Załóż konto

    + +

    {% endblock %} diff --git a/templates/base.html b/templates/base.html index a98dcdf64..78bb6b5a2 100644 --- a/templates/base.html +++ b/templates/base.html @@ -18,9 +18,15 @@
    {% if user.is_authenticated %} -

    Zalogowany jako {{ user.username }} | Wyloguj

    +

    + Zalogowany jako {{ user.username }} + {% if user.is_staff %} + | Administracja + {% endif %} + | Wyloguj +

    {% else %} -

    Zaloguj / Zarejestruj

    +

    Zaloguj się / Załóż konto

    {% endif %}
    @@ -58,5 +64,31 @@ Fundacja Nowoczesna Polska +
    + +
    +
    +

    Zaloguj się / Załóż konto

    +
      +
    1. +
    2. +
    3. +
    +

    +
    + +
    +
    diff --git a/templates/catalogue/book_list.html b/templates/catalogue/book_list.html index 19bddcc7b..dc2ebf960 100644 --- a/templates/catalogue/book_list.html +++ b/templates/catalogue/book_list.html @@ -8,7 +8,6 @@ {% block extrahead %}