Merge branch 'pretty' of github.com:fnp/wolnelektury into pretty
authorMarcin Koziej <marcin.koziej@nowoczesnapolska.org.pl>
Fri, 30 Dec 2011 12:21:50 +0000 (13:21 +0100)
committerMarcin Koziej <marcin.koziej@nowoczesnapolska.org.pl>
Fri, 30 Dec 2011 12:21:50 +0000 (13:21 +0100)
22 files changed:
apps/ajaxable/templates/ajaxable/form.html
apps/ajaxable/utils.py
apps/infopages/templates/infopages/infopage.html
apps/infopages/views.py
apps/search/index.py
apps/search/management/commands/reindex.py [new file with mode: 0755]
requirements.txt
wolnelektury/settings.py
wolnelektury/static/css/base.css
wolnelektury/static/css/catalogue.css
wolnelektury/static/css/dialogs.css
wolnelektury/static/js/base.js
wolnelektury/static/js/dialogs.js
wolnelektury/templates/404.html
wolnelektury/templates/base.html
wolnelektury/templates/catalogue/book_list.html
wolnelektury/templates/catalogue/book_text.html
wolnelektury/templates/catalogue/catalogue.html
wolnelektury/templates/lesmianator/lesmianator.html
wolnelektury/templates/main_page.html
wolnelektury/templates/publish_plan.html
wolnelektury/views.py

index d8f0036..ba79e4b 100755 (executable)
@@ -3,6 +3,7 @@
 
 <form action="{{ request.get_full_path }}" method="post" accept-charset="utf-8" class="cuteform">
 <ol>
+    <div id="id___all__"></div>
     {{ form.as_ul }}
     <li><input type="submit" value="{{ submit }}"/></li>
 </ol>
index 14b5dfc..a6faafa 100755 (executable)
@@ -35,9 +35,8 @@ class AjaxableFormView(object):
     form_class = None
     # override to customize form look
     template = "ajaxable/form.html"
-    # set to redirect after succesful ajax-less post
     submit = _('Send')
-    redirect = None
+    
     title = ''
     success_message = ''
     formname = "form"
@@ -51,10 +50,11 @@ class AjaxableFormView(object):
             if form.is_valid():
                 self.success(form, request)
                 redirect = request.GET.get('next')
-                if not ajax and redirect is not None:
+                if not ajax and redirect:
                     return HttpResponseRedirect(urlquote_plus(
-                                redirect, safe='/?='))
-                response_data = {'success': True, 'message': self.success_message}
+                            redirect, safe='/?='))
+                response_data = {'success': True, 
+                    'message': self.success_message, 'redirect': redirect}
             else:
                 response_data = {'success': False, 'errors': form.errors}
             if ajax:
index dc9efe1..db2d49b 100755 (executable)
     <h1>{{ page.title }}</h1>
 
     {% autoescape off %}
-    <div class="column-left">
-       {{ left_column }}
+    <div class="left-column">
+        <div class="normal-text">
+            {{ left_column }}
+        </div>
     </div>
-    <div class="column-right">
-       {{ right_column }}
+    <div class="right-column">
+        <div class="normal-text">
+            {{ right_column }}
+        </div>
     </div>
     {% endautoescape %}
 {% endblock %}
index d457653..e1e7451 100644 (file)
@@ -9,8 +9,6 @@ from infopages.models import InfoPage
 
 
 def infopage(request, slug):
-    page = InfoPage.objects.get(slug=slug)
-
     page = get_object_or_404(InfoPage, slug=slug)
     rc = RequestContext(request)
     left_column = Template(page.left_column).render(rc)
index 10069e4..6c76901 100644 (file)
@@ -280,7 +280,7 @@ class Index(IndexStore):
             return
 
         def fix_format(text):
-            return re.sub("/$", "", text, flags=re.M)
+            return re.sub("(?m)/$", "", text)
 
         def add_part(snippets, **fields):
             doc = self.create_book_doc(book)
diff --git a/apps/search/management/commands/reindex.py b/apps/search/management/commands/reindex.py
new file mode 100755 (executable)
index 0000000..9639a5a
--- /dev/null
@@ -0,0 +1,16 @@
+from django.core.management.base import BaseCommand
+
+class Command(BaseCommand):
+    help = 'Reindex everything.'
+    args = ''
+
+    def handle(self, *args, **opts):
+        from catalogue.models import Book
+        import search
+        idx = search.ReusableIndex()
+        idx.open()
+        for b in Book.objects.all():
+            print b.title
+            idx.index_book(b, None)
+        print 'Reindexing tags.'
+        idx.index_tags()
index ed684cc..2b69d7f 100644 (file)
@@ -17,7 +17,7 @@ Feedparser>=4.1
 # PIL 
 PIL>=1.1.6
 mutagen>=1.17
-sorl-thumbnail>=11.09<12
+sorl-thumbnail>=11.09,<12
 
 # home-brewed & dependencies
 lxml>=2.2.2
index 55c845e..ed48332 100644 (file)
@@ -232,16 +232,14 @@ COMPRESS_JS = {
         ],
         'output_filename': 'js/player.min?.js',
     },
-    #~ 'book': {
-        #~ 'source_filenames': ('js/jquery.eventdelegation.js', 'js/jquery.scrollto.js', 'js/jquery.highlightfade.js', 'js/book.js',),
-        #~ 'source_filenames': [],
-        #~ 'output_filename': 'js/book?.min.js',
-    #~ },
-    #~ 'book_ie': {
-        #~ 'source_filenames': ('js/ierange-m2.js',),
-        #~ 'source_filenames': [],
-        #~ 'output_filename': 'js/book_ie?.min.js',
-    #~ }
+    'book': {
+        'source_filenames': ('js/jquery.eventdelegation.js', 'js/jquery.scrollto.js', 'js/jquery.highlightfade.js', 'js/book.js',),
+        'output_filename': 'js/book?.min.js',
+    },
+    'book_ie': {
+        'source_filenames': ('js/ierange-m2.js',),
+        'output_filename': 'js/book_ie?.min.js',
+    }
 
 }
 
index 7c3b682..fde0115 100755 (executable)
@@ -43,6 +43,10 @@ h1 {
     float:right;
     width: 48em;
 }
+.normal-text {
+    font-size: 1.3em;
+    line-height: 1.3em;
+}
 
 h2 {
     margin: 0;
@@ -60,7 +64,7 @@ h2 {
     clear: both;
 }
 
-#header-content, div#main-content, div#half-header-content {
+#header-content, div#main-content, div#half-header-content, #footer-content {
     width: 97.5em;
     margin: auto;
 }
@@ -147,6 +151,8 @@ a.cite {
 
 #footer {
     color: #777;
-    border-top: 1px solid #ddd;
-    margin-top: 2.5em;
+    eborder-top: 1px solid #ddd;
+    margin-top: 5em;
+    padding-top:3em;
+    background: #fff;
 }
index c971ca8..b754299 100755 (executable)
@@ -9,3 +9,49 @@
     margin: 0;
     padding: 0;
 }
+
+
+/* listing of all books */
+#book-list {
+   padding-left: 50px;
+}
+#book-list-nav {
+    position: absolute;
+    right: 50px;
+    width: 200px;
+    border-left: 1px #cfcfcf solid;
+    padding: 10px;
+    font-size: 1.2em;
+}
+
+#book-list-nav ul {
+    list-style-type: none;
+    margin: 5px;
+    padding: 0;
+}
+
+.book-list-show-index {
+    display: none;
+    margin: 0;
+    padding: 0;
+}
+
+
+#book-a-list #book-list ol {
+    padding-left: 1em;
+    margin: 0.3em 0 1.2em 0;
+    list-style: none;
+}
+
+#book-a-list #book-list h2 a {
+    color: black;
+}
+
+#book-list-up {
+    position: fixed;
+    bottom: 50px;
+    right: 50px;
+    border-left: 1px #cfcfcf solid;
+    padding: 10px;
+    background-color: white;    
+}
\ No newline at end of file
index b3876c3..35136e0 100755 (executable)
@@ -1,7 +1,11 @@
+.cuteform {
+    font-size: 1.1em;
+}
 .cuteform ol, .cuteform ul {
     padding: 0;
     margin: 0;
     list-style: none;
+    font-style: 1.1em;
 }
 
 .cuteform ol li, .cuteform ul li {
@@ -22,6 +26,9 @@
     color: #BF3024;
     display: block;
 }
+.cuteform .errorlist {
+    color: #BF3024;
+}
 
 
 .jqmOverlay { background-color: #000; }
@@ -36,6 +43,7 @@
 }
 
 .dialog-window div.header {
+    font-size: 1.1em;
     width: 4em;
     background-color: #FFF;
     border-right: 0.3em solid #DDD;
     font-size: 1.2em;
 }
 
+.dialog-window textarea, .dialog-window input {
+    width: 100%;
+}
 
 #login-window {
-    width: 24em;
+    width: 26em;
 }
 #register-window {
-    width: 24em;
+    width: 26em;
 }
 
 #suggest-window {
-    width: 24em;
+    width: 26em;
 }
 
 #suggest-window textarea {
-    width: 19em;
     height: 6em;
 }
 
 #suggest-publishing-window {
-    width: 26em;
+    width: 29em;
 }
 
 #suggest-publishing-window textarea {
-       width: 21em;
     height: 3em;
 }
 
 
 #custom-pdf-window label {
     display: inline;
-}
\ No newline at end of file
+}
index 028ab33..51107fe 100755 (executable)
@@ -17,6 +17,15 @@ $('.open-player').click(function(event) {
 });
 
 
+        $('.book-list-index').click(function(){
+            $('.book-list-show-index').hide('slow');
+            if($(this).parent().next('ul:not(:hidden)').length == 0){
+               $(this).parent().next('ul').toggle('slow');
+           }
+            return false;
+        });
+
+
     });
 })(jQuery)
 
index 0793a7f..bf9d94b 100755 (executable)
                     hash.w.show();
                 },
                 onLoad: function(hash) {
-                    $('form', hash.w).each(function() {this.action += '?ajax=1';});
+                    $('form', hash.w).each(function() {
+                        if (this.action.search('[\\?&]ajax=1') != -1)
+                            return;
+                        if (this.action.search('\\?') != -1)
+                            this.action += '&ajax=1';
+                        else this.action += '?ajax=1';
+                    });
                     $('form', hash.w).ajaxForm({
                         dataType: 'json',
                         target: $('.target', $window),
                         success: function(response) {
                             if (response.success) {
                                 $('.target', $window).text(response.message);
-                                setTimeout(function() { $window.jqmHide() }, 1000)
+                                setTimeout(function() { $window.jqmHide() }, 1000);
+                                if (response.redirect)
+                                    window.location = response.redirect;
                             }
                             else {
                                 $('.error', $window).remove();
index 50a56ea..8083d28 100644 (file)
@@ -1,27 +1,19 @@
+{% extends "base.html" %}
 {% load i18n %}
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
-        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" lang="pl" xml:lang="pl">
-<head>
-<title>404 - {% trans "Page does not exist" %} - WolneLektury.pl</title>
-<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
-<link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/2.5.2/build/reset/reset-min.css">
-<link rel="stylesheet" href="{{ STATIC_URL }}css/error.css" type="text/css" />
-</head>
-
-<body>
-
-<a href="/"><img src="{{ STATIC_URL }}img/logo.png" /></a>
-<p class="haj" style="font-weight: bold">{% trans "Page does not exist" %}</p>
+
+
+{% block titleextra %}404 - {% trans "Page does not exist" %}{% endblock %}
+
+
+{% block body %}
+
+<h1>{% trans "Page not found" %}</h1>
+
+
 <p>
 {% trans "We are sorry, but this page does not exist. Please check if you entered correct address or go to "%} <a href="/">{% trans "main page" %}</a>.
 </p>
 
-<script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
-</script>
-<script type="text/javascript">
-    _uacct = "UA-2576694-1";
-    urchinTracker();
-</script>
-</body>
-</html>
\ No newline at end of file
+
+
+{% endblock body %}
index 48f13ad..04330f2 100644 (file)
 
         <div class="clearboth"></div>
 
+        </div>{# end main-content #}
 
 
         <div id="footer">
+        <div id="footer-content">
             <p>
                {% blocktrans %}
                                Wolne Lektury is a project lead by <a href="http://nowoczesnapolska.org.pl/">Modern Poland Foundation</a>.
 
                        {% sponsor_page "footer" %}
         </div>
+        </div>
 
-        </div>{# end main-content #}
 
 
         {# template #}
index b4336d3..318f1b4 100644 (file)
@@ -9,9 +9,15 @@
 {% block body %}
     <h1>{% block book_list_header %}{% trans "Listing of all works" %}{% endblock %}</h1>
 
-    <div class="column-left">{% block book_list_info %}{% endblock %}</div><div style='clear:both;'></div>
+    <div class="left-column"><div class="normal-text">
+        {% block book_list_info %}{% endblock %}
+    </div></div>
+
+    <div style='clear:both;'></div>
+
     <a name="top">
-    <div id="book-list-nav">
+
+    <div id="book-list-nav" class="normal-text">
         {% trans "Table of Content" %}
         {% for index, authors in books_nav.items %}
                 <ul>
@@ -24,7 +30,7 @@
                 </ul>
         {% endfor %}    
     </div>
-    <div id="book-list">
+    <div id="book-list" class="normal-text">
       {% block book_list %}
         {% book_tree orphans books_by_parent %}
         {% for author, group in books_by_author.items %}
index 935cdf3..c133165 100644 (file)
@@ -8,7 +8,7 @@
         <title>{% block title %}WolneLektury.pl{% endblock %}</title>
         <link rel="icon" href="{{ STATIC_URL }}img/favicon.png" type="image/x-icon" />
         {% compressed_css "book" %}
-        {% compressed_js "jquery" %}
+        <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
         {% compressed_js "book" %}
         <!--[if IE]>
             {% compressed_js "book_ie" %}
index 1423577..3840362 100644 (file)
@@ -10,6 +10,7 @@
 {% block body %}
     <h1>{% trans "Catalogue" %}</h1>
 
+    <div class="normal-text">
     <h2></a>{% trans "Authors" %}<a name="autorzy"></a></h2>
     {% tag_list categories.author %}
 
@@ -24,4 +25,5 @@
 
     <h2>{% trans "Themes and topics" %}<a name="motywy"></a></h2>
     {% tag_list fragment_tags %}
+    </div>
 {% endblock %}
index 90e96f6..2f6a6e5 100644 (file)
@@ -11,7 +11,8 @@
 {% block body %}
     <h1>Leśmianator</h1>
 
-    <div id="books-list">
+    <div class="left-column">
+    <div class="normal-text">
         <p>Leśmianator tworzy wierszmiksy – dzięki niemu
             <a href="{% url new_poem %}">napiszesz wiersz jednym kliknięciem</a>.
             W nowej odsłonie nowe możliwości zabawy – teraz możesz zdecydować, co wrzucasz do miksera,
             {% endfor %}
     
     </div>
+    </div>
 
-    <div id="tags-list">
+    <div class="right-column">
+    <div class="normal-text">
         <h3>Miksuj utwory</h3>
         <p>Możesz <a href="{% url new_poem %}">zmiksować całą lirykę</a> w naszej bibliotece
         albo tylko jeden konkretny utwór. Jak? Wejdź na
@@ -53,4 +56,5 @@
         <p>Miłej zabawy!</p>
 
     </div>
+    </div>
 {% endblock %}
\ No newline at end of file
index 002d45b..2f9648f 100755 (executable)
@@ -56,9 +56,8 @@
             <li><a href="{% url suggest %}" id="suggest" class="ajaxable">{% trans "Report a bug or suggestion" %}</a></li>
             <li><a href="http://turniej.wolnelektury.pl">Turniej Elektrybałtów</a></li>
             <li><a href="{% url lesmianator %}">Leśmianator</a></li>
-            <li><a href="">{% trans "Mobile app" %}</a></li>
+            <li><a href="{% url infopage "mobilna" %}">{% trans "Mobile app" %}</a></li>
             <li><a href="{% url infopage "widget" %}">{% trans "Widget" %}</a></li>
-            <li><a href="">{% trans "Public domain counter" %}</a></li>
             <li><a href="{% url suggest_publishing %}" id="suggest-publishing" class="ajaxable">{% trans "Missing a book?" %}</a></li>
             <li><a href="{% url publish_plan %}">{% trans "Publishing plan" %}</a></li>
         </ul>
index 2a6d90a..c4c3d6e 100755 (executable)
@@ -7,7 +7,7 @@
 {% block body %}
 <h1>{% trans "Publishing plan" %}</h1>
 
-<ul>
+<ul class="normal-text">
 {% for elem in plan %}
     <li><a href="{{ elem.link }}">{{ elem.title }}</a></li>
 {% endfor %}
index f2d9abd..c594732 100755 (executable)
@@ -25,9 +25,9 @@ def main_page(request):
 
 class LoginFormView(AjaxableFormView):
     form_class = AuthenticationForm
-    #template = "auth/login.html"
     title = _('Sign in')
     submit = _('Sign in')
+    ajax_redirect = True
 
     def __call__(self, request):
         if request.user.is_authenticated():
@@ -40,9 +40,9 @@ class LoginFormView(AjaxableFormView):
 
 class RegisterFormView(AjaxableFormView):
     form_class = UserCreationForm
-    #template = "auth/register.html"
     title = _('Register')
     submit = _('Register')
+    ajax_redirect = True
 
     def __call__(self, request):
         if request.user.is_authenticated():