Changed login method.
authorMarek Stępniowski <marek@stepniowski.com>
Sat, 16 Aug 2008 11:08:25 +0000 (13:08 +0200)
committerMarek Stępniowski <marek@stepniowski.com>
Sat, 16 Aug 2008 11:08:25 +0000 (13:08 +0200)
12 files changed:
catalogue/views.py
chunks/admin.py
chunks/models.py
chunks/templatetags/chunks.py
media/css/master.css
settings.py
templates/auth/login.html
templates/base.html
templates/catalogue/book_list.html
templates/catalogue/main_page.html
templates/catalogue/tagged_book_list.html
urls.py

index a0315a4..dc2e7b1 100644 (file)
@@ -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.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
 
 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'))
 
     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']
 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))
 
     return render_to_response('catalogue/book_sets.html', locals(),
         context_instance=RequestContext(request))
 
+
 @login_required
 @require_POST
 def new_set(request):
 @login_required
 @require_POST
 def new_set(request):
index 29c1fc2..c44d5a0 100644 (file)
@@ -4,8 +4,8 @@ from chunks.models import Chunk
 
 
 class ChunkAdmin(admin.ModelAdmin):
 
 
 class ChunkAdmin(admin.ModelAdmin):
-  list_display = ('key',)
-  search_fields = ('key', 'content')
+    list_display = ('key', 'description',)
+    search_fields = ('key', 'content',)
 
 admin.site.register(Chunk, ChunkAdmin)
 
 
 admin.site.register(Chunk, ChunkAdmin)
 
index ac16452..396d221 100644 (file)
@@ -4,12 +4,11 @@ from django.utils.translation import ugettext_lazy as _
 
 class Chunk(models.Model):
     """
 
 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)
     """
     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:
     content = models.TextField(_('content'), blank=True)
 
     class Meta:
index fe8efde..f79d495 100644 (file)
@@ -39,7 +39,7 @@ class ChunkNode(template.Node):
         except Chunk.DoesNotExist:
             n = Chunk(key=self.key)
             n.save()
         except Chunk.DoesNotExist:
             n = Chunk(key=self.key)
             n.save()
-            return 'SOME TEXT PLEASE'
+            return ''
         return content
         
 register.tag('chunk', do_get_chunk)
         return content
         
 register.tag('chunk', do_get_chunk)
index 3fa1655..942111c 100644 (file)
@@ -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;
     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 {
 }
 
 img {
@@ -26,7 +26,7 @@ input {
 h1 {
     font: normal normal bold 1.75em Arial, sans-serif;
     color: #2F4110;
 h1 {
     font: normal normal bold 1.75em Arial, sans-serif;
     color: #2F4110;
-    margin: 1em 0 0 0;
+    margin: 0.55em 0 0 0;
 }
 
 h2 {
 }
 
 h2 {
@@ -53,7 +53,7 @@ em {
 }
 
 .blur {
 }
 
 .blur {
-    color: #999;
+    color: #777;
 }
 
 /* ================================== */
 }
 
 /* ================================== */
@@ -73,6 +73,15 @@ em {
     text-align: right;
 }
 
     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 = */
 
 /* ======================== */
 /* = Footer with sponsors = */
@@ -296,9 +305,14 @@ em {
 }
 
 .cuteform ol li, .cuteform ul li {
 }
 
 .cuteform ol li, .cuteform ul li {
-    margin-top: 0.5em;
+    margin-top: 0.7em;
+}
+
+.cuteform label {
+    display: block;
 }
 
 }
 
+
 /* ================ */
 /* = Modal Window = */
 /* ================ */
 /* ================ */
 /* = Modal Window = */
 /* ================ */
@@ -307,28 +321,55 @@ em {
     display: none;
     width: 32em;
     background-color: transparent;
     display: none;
     width: 32em;
     background-color: transparent;
-    color: #333;
     margin-top: -0.5em;
     margin-left: -1em;
 }
 
 #set-window div.header {
     background-color: #FFF;
     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;
     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; }
 
 
     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 = */
 /* ======================== */
 /* ======================== */
 /* = Alphabetic book list = */
 /* ======================== */
@@ -337,3 +378,4 @@ em {
     margin: 0.3em 0 1.2em 0;
     list-style: none;
 }
     margin: 0.3em 0 1.2em 0;
     list-style: none;
 }
+
index 829eaf8..788e33e 100644 (file)
@@ -97,7 +97,7 @@ COMPRESS_CSS = {
 COMPRESS_JS = {
     'all': {
         'source_filenames': ('js/jquery.js', 'js/jquery.autocolumn.js', 'js/jquery.autocomplete.js', 
 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',
     }
 }
         'output_filename': 'js/all.min.js',
     }
 }
index dcacd81..6db94aa 100644 (file)
@@ -1,13 +1,24 @@
 {% extends "base.html" %}
 
 {% extends "base.html" %}
 
+{% block title %}Zaloguj / Zarejestruj się w WolneLektury.pl{% endblock %}
+
 {% block body %}
 {% block body %}
-    <h1>Zaloguj / Zarejestruj</h1>
+    <h1>Zaloguj się / Załóż konto</h1>
+    <form action="." method="get" accept-charset="utf-8" id="search-form">
+        <p><li>{{ search_form.q }} <input type="submit" value="Szukaj" /></li> <strong>lub</strong> <a href="{% url main_page %}">wróć do strony głównej</a></p>
+    </form>
+    <form method="post" action="." id="login-form" class="cuteform">
+        <h2>Zaloguj się</h2>
+        <ol>
+            {{ form.as_ul }}
+            <li><input type="submit" value="Zaloguj się" /></li>
+        </ol>
+        <p><input type="hidden" name="next" value="{{ next }}" /></p>
+    </form>
     
     
-    <form method="POST" action="." class="cuteform">
-    <ol>
-        {{ form.as_ul }}
-        <li><input type="submit" value="Zaloguj" /></li>
-    </ol>
-    <p><input type="hidden" name="next" value="{{ next }}" /></p>
+    <form action="." method="post" accept-charset="utf-8" id="registration-form">
+        <h2>Załóż konto</h2>
+
+        <p><input type="submit" value="Załóż konto"/></p>
     </form>
 {% endblock %}
     </form>
 {% endblock %}
index a98dcdf..78bb6b5 100644 (file)
             </div>
             <div id="user-info">
                 {% if user.is_authenticated %}
             </div>
             <div id="user-info">
                 {% if user.is_authenticated %}
-                    <p>Zalogowany jako {{ user.username }} | <a href="{% url logout %}">Wyloguj</a></p>
+                    <p>
+                        Zalogowany jako <strong>{{ user.username }}</strong>
+                        {% if user.is_staff %}
+                        | <a href="/admin/">Administracja</a>
+                        {% endif %}
+                        | <a href="{% url logout %}">Wyloguj</a>
+                    </p>
                 {% else %}
                 {% else %}
-                    <p><a href="{% url login %}">Zaloguj / Zarejestruj</a></p>
+                    <p><a href="{% url login %}" id="login-register-link">Zaloguj się / Załóż konto</a></p>
                 {% endif %}
             </div>
             <div class="clearboth"></div>
                 {% endif %}
             </div>
             <div class="clearboth"></div>
                 <area alt="Fundacja Nowoczesna Polska" coords="15,39,98,75" href="http://nowoczesnapolska.org.pl/" shape="rect" />
             </map>
         </div>
                 <area alt="Fundacja Nowoczesna Polska" coords="15,39,98,75" href="http://nowoczesnapolska.org.pl/" shape="rect" />
             </map>
         </div>
+        <div id="login-register-window">
+            <div class="header"><a href="#" class="jqmClose">Zamknij</a></div>
+            <div class="target">
+                <form method="post" action="{% url login %}" id="login-form" class="cuteform" style="width: 18em;">
+                    <h2>Zaloguj się / <a href="#" id="show-registration-form" style="font-size: 0.85em; font-weight: normal">Załóż konto</a></h2>
+                    <ol>
+                        <li><label for="id_username" title="np. Anna Kowalska">Nazwa użytkownika:</label> <input id="id_username" type="text" name="username" maxlength="30" /></li>
+            <li><label for="id_password">Hasło:</label> <input type="password" name="password" id="id_password" /></li>
+                        <li><input type="submit" value="Zaloguj się" /></li>
+                    </ol>
+                    <p style="display:none;"><input type="hidden" name="next" value="{{ request.get_full_path }}" /></p>
+                </form>
+                <form method="post" action="{% url login %}" id="registration-form" class="cuteform" style="display: none; width: 18em;">
+                    <h2><a href="#" id="show-login-form" style="font-size: 0.85em; font-weight: normal">Zaloguj się</a> / Załóż konto</h2>
+                    <ol>
+                        <li><label for="id_username" title="np. Anna Kowalska">Nazwa użytkownika:</label> <input id="id_username" type="text" name="username" maxlength="30" /></li>
+                        <li><label for="id_email">Adres e-mail:</label> <input id="id_email" type="text" name="email" maxlength="80" /></li>
+            <li><label for="id_password">Hasło:</label> <input type="password" name="password" id="id_password" /></li>
+            <li><label for="id_password2">Powtórz hasło:</label> <input type="password" name="password2" id="id_password2" /></li>
+            
+                        <li><input type="submit" value="Załóż konto" /></li>
+                    </ol>
+                    <p style="display:none;"><input type="hidden" name="next" value="{{ request.get_full_path }}" /></p>
+                </form>
+            </div>
+        </div>
     </body>
 </html>
     </body>
 </html>
index 19bddcc..dc2ebf9 100644 (file)
@@ -8,7 +8,6 @@
 {% block extrahead %}
     <script type="text/javascript" charset="utf-8">
         $(function() {
 {% block extrahead %}
     <script type="text/javascript" charset="utf-8">
         $(function() {
-            $('#id_q').labelify({labelledClass: 'blur'});
             $('#book-list .group').addClass('dontsplit');
             $('#book-list').columnize({columns: 3});
         });
             $('#book-list .group').addClass('dontsplit');
             $('#book-list').columnize({columns: 3});
         });
 {% block body %}
     <h1>Alfabetyczny spis utworów</h1>
     <form action="." method="GET" accept-charset="utf-8" id="search-form">
 {% block body %}
     <h1>Alfabetyczny spis utworów</h1>
     <form action="." method="GET" accept-charset="utf-8" id="search-form">
-        <ol>
-            <li class="book-title">Alfabetyczny spis utworów | <a href="{% url main_page %}">x</a></li>
-            <li>{{ form.q }} <input type="submit" value="Szukaj" /></li>
-        </ol>
+        <p>{{ form.q }} <input type="submit" value="Szukaj" /> <strong>lub</strong> <a href="{% url main_page %}">wróć do strony głównej</a></p>
     </form>
     
     <div id="book-list">
     </form>
     
     <div id="book-list">
index 44fe7d4..b715f47 100644 (file)
@@ -6,8 +6,6 @@
 {% block extrahead %}
     <script type="text/javascript" charset="utf-8">
         $(function() {
 {% block extrahead %}
     <script type="text/javascript" charset="utf-8">
         $(function() {
-            $('#id_q').labelify({labelledClass: 'blur'});
-            
             $('#categories-list ul').columnize({width: 180});
             $('#themes-list ul').columnize({width: 180});
         });
             $('#categories-list ul').columnize({width: 180});
             $('#themes-list ul').columnize({width: 180});
         });
 {% endblock %}
 
 {% block body %}
 {% endblock %}
 
 {% block body %}
+    <div id="site-description">
+        {% chunk "site-description" %}
+    </div>
+    <div class="clearboth"></div>
     <form action="." method="get" accept-charset="utf-8" id="search-form">
         <p>{{ form.q }} <input type="submit" value="Szukaj" /> <strong>lub</strong> <a href="{% url catalogue.views.book_list %}">zobacz spis utworów</a> w naszym zbiorze</p>
     </form>
     <form action="." method="get" accept-charset="utf-8" id="search-form">
         <p>{{ form.q }} <input type="submit" value="Szukaj" /> <strong>lub</strong> <a href="{% url catalogue.views.book_list %}">zobacz spis utworów</a> w naszym zbiorze</p>
     </form>
index e043101..35dcf13 100644 (file)
@@ -8,8 +8,6 @@
 {% block extrahead %}
     <script type="text/javascript">
         $(function() {            
 {% block extrahead %}
     <script type="text/javascript">
         $(function() {            
-            $('#id_q').labelify({labelledClass: 'blur'});
-            
             // $('#tags-list ul').addClass('dontsplit');
             // $('#tags-list').columnize({width: 180});
             
             // $('#tags-list ul').addClass('dontsplit');
             // $('#tags-list').columnize({width: 180});
             
diff --git a/urls.py b/urls.py
index dfa68fc..c4185d6 100644 (file)
--- a/urls.py
+++ b/urls.py
@@ -4,23 +4,22 @@ import os
 from django.conf.urls.defaults import *
 from django.contrib import admin
 
 from django.conf.urls.defaults import *
 from django.contrib import admin
 
-
 admin.autodiscover()
 
 
 urlpatterns = patterns('',
 admin.autodiscover()
 
 
 urlpatterns = patterns('',
-    (r'^katalog/', include('catalogue.urls')),
+    url(r'^katalog/', include('catalogue.urls')),
     
     # Panel administracyjny
     
     # Panel administracyjny
-    (r'^admin/doc/', include('django.contrib.admindocs.urls')),
-    (r'^admin/(.*)$', admin.site.root),
+    url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
+    url(r'^admin/(.*)$', admin.site.root),
     
     # Użytkownicy
     url(r'^uzytkownicy/zaloguj/$', 'django.contrib.auth.views.login', {'template_name': 'auth/login.html'}, name='login'),
     url(r'^uzytkownicy/wyloguj/$', 'django.contrib.auth.views.logout_then_login', name='logout'),
     
     # Pliki statyczne
     
     # Użytkownicy
     url(r'^uzytkownicy/zaloguj/$', 'django.contrib.auth.views.login', {'template_name': 'auth/login.html'}, name='login'),
     url(r'^uzytkownicy/wyloguj/$', 'django.contrib.auth.views.logout_then_login', name='logout'),
     
     # Pliki statyczne
-    (r'^media/(?P<path>.*)$', 'django.views.static.serve', 
+    url(r'^media/(?P<path>.*)$', 'django.views.static.serve', 
         {'document_root': os.path.join(os.path.dirname(__file__), 'media'), 'show_indexes': True}),
         {'document_root': os.path.join(os.path.dirname(__file__), 'media'), 'show_indexes': True}),
-    (r'^$', 'django.views.generic.simple.redirect_to', {'url': 'katalog/'}),
+    url(r'^$', 'django.views.generic.simple.redirect_to', {'url': 'katalog/'}),
 )
 )