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
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']
return render_to_response('catalogue/book_sets.html', locals(),
context_instance=RequestContext(request))
+
@login_required
@require_POST
def new_set(request):
class ChunkAdmin(admin.ModelAdmin):
- list_display = ('key',)
- search_fields = ('key', 'content')
+ list_display = ('key', 'description',)
+ search_fields = ('key', 'content',)
admin.site.register(Chunk, ChunkAdmin)
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:
except Chunk.DoesNotExist:
n = Chunk(key=self.key)
n.save()
- return 'SOME TEXT PLEASE'
+ return ''
return content
register.tag('chunk', do_get_chunk)
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 {
h1 {
font: normal normal bold 1.75em Arial, sans-serif;
color: #2F4110;
- margin: 1em 0 0 0;
+ margin: 0.55em 0 0 0;
}
h2 {
}
.blur {
- color: #999;
+ color: #777;
}
/* ================================== */
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 = */
}
.cuteform ol li, .cuteform ul li {
- margin-top: 0.5em;
+ margin-top: 0.7em;
+}
+
+.cuteform label {
+ display: block;
}
+
/* ================ */
/* = Modal Window = */
/* ================ */
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 = */
/* ======================== */
margin: 0.3em 0 1.2em 0;
list-style: none;
}
+
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',
}
}
{% extends "base.html" %}
+{% block title %}Zaloguj / Zarejestruj się w WolneLektury.pl{% endblock %}
+
{% 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 %}
</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 %}
- <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>
<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>
{% 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});
});
{% 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">
{% 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});
});
{% 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>
{% block extrahead %}
<script type="text/javascript">
$(function() {
- $('#id_q').labelify({labelledClass: 'blur'});
-
// $('#tags-list ul').addClass('dontsplit');
// $('#tags-list').columnize({width: 180});
from django.conf.urls.defaults import *
from django.contrib import admin
-
admin.autodiscover()
urlpatterns = patterns('',
- (r'^katalog/', include('catalogue.urls')),
+ url(r'^katalog/', include('catalogue.urls')),
# 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
- (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}),
- (r'^$', 'django.views.generic.simple.redirect_to', {'url': 'katalog/'}),
+ url(r'^$', 'django.views.generic.simple.redirect_to', {'url': 'katalog/'}),
)