Merge branch 'master' of git@github.com:fnp/wolnelektury
authorLukasz Anwajler <lukasz@anwajler.com>
Wed, 21 Jul 2010 10:58:47 +0000 (05:58 -0500)
committerLukasz Anwajler <lukasz@anwajler.com>
Wed, 21 Jul 2010 10:58:47 +0000 (05:58 -0500)
.gitignore
apps/catalogue/templatetags/catalogue_tags.py
apps/catalogue/views.py
apps/compress/management/commands/synccompress.py
wolnelektury/static/css/master.book.css
wolnelektury/static/css/master.css
wolnelektury/templates/catalogue/search_multiple_hits.html

index ffdcd24..a3f95c0 100644 (file)
@@ -7,6 +7,8 @@ dev.sqlite
 # Compress output
 /wolnelektury/static/css/all.min*.css
 /wolnelektury/static/js/all*.min.js
+/wolnelektury/static/css/book.min*.css
+/wolnelektury/static/js/book*.min.js
 /wolnelektury/static/js/jquery.min.js
 
 # Python garbage
index 25376f8..9475348 100644 (file)
@@ -61,9 +61,16 @@ def simple_title(tags):
     return capfirst(', '.join(title))
 
 
+def book_stub_title(book):
+    return ', '.join((book.author, book.title))
+
+
 @register.simple_tag
 def book_title(book, html_links=False):
-    names = list(book.tags.filter(category='author'))
+    try:
+        names = list(book.tags.filter(category='author'))
+    except AttributeError:
+        return book_stub_title(book)
 
     books = []
     while book:
index cd74ac0..7322210 100644 (file)
@@ -320,7 +320,7 @@ def _get_result_type(match):
         type = 'book'
     else:
         type = match.category
-    return dict(models.TAG_CATEGORIES)[type]
+    return type
 
 
 
index f5624f5..8217979 100644 (file)
@@ -6,22 +6,20 @@ from django.conf import settings
 class Command(NoArgsCommand):
     option_list = NoArgsCommand.option_list + (
         make_option('--force', action='store_true', default=False, help='Force update of all files, even if the source files are older than the current compressed file.'),
-        make_option('--verbosity', action='store', dest='verbosity', default='1',
-            type='choice', choices=['0', '1', '2'],
-            help='Verbosity level; 0=minimal output, 1=normal output, 2=all output'),
     )
     help = 'Updates and compresses CSS and JavsScript on-demand, without restarting Django'
     args = ''
 
     def handle_noargs(self, **options):
-
+        
         force = options.get('force', False)
         verbosity = int(options.get('verbosity', 1))
 
         from compress.utils import needs_update, filter_css, filter_js
 
         for name, css in settings.COMPRESS_CSS.items():
-            u, version = needs_update(css['output_filename'], css['source_filenames'])
+            u, version = needs_update(css['output_filename'], 
+                css['source_filenames'])
 
             if (force or u) or verbosity >= 2:
                 msg = 'CSS Group \'%s\'' % name
@@ -36,7 +34,8 @@ class Command(NoArgsCommand):
                 print
 
         for name, js in settings.COMPRESS_JS.items():
-            u, version = needs_update(js['output_filename'], js['source_filenames'])
+            u, version = needs_update(js['output_filename'], 
+                js['source_filenames'])
 
             if (force or u) or verbosity >= 2:
                 msg = 'JavaScript Group \'%s\'' % name
@@ -48,4 +47,12 @@ class Command(NoArgsCommand):
                 filter_js(js, verbosity)
 
             if (force or u) or verbosity >= 2:
-                print
\ No newline at end of file
+                print
+
+# Backwards compatibility for Django r9110
+if not [opt for opt in Command.option_list if opt.dest=='verbosity']:
+    Command.option_list += (
+    make_option('--verbosity', '-v', action="store", dest="verbosity",
+        default='1', type='choice', choices=['0', '1', '2'],
+        help="Verbosity level; 0=minimal output, 1=normal output, 2=all output"),
+    )
index 2a8ea8b..5470dbf 100644 (file)
@@ -155,8 +155,14 @@ p {
     color: #777;
     padding: 0 0.5em;
     width: 7.5em;
+
     font-style: normal;
     font-weight: normal;
+    font-variant: normal;
+    letter-spacing: 0;
+    text-transform: none;
+    text-decoration: none;
+
     font-size: 16px;
     float: right;
     margin-right: -9.5em;
index 645466c..7440827 100644 (file)
@@ -203,6 +203,14 @@ p .ac_input {
 }
 
 
+/* ================== */
+/* = Search matches = */
+/* ================== */
+
+.matches li:first-letter {
+    text-transform: uppercase;
+}
+
 /* ============= */
 /* = Tags list = */
 /* ============= */
index 8e99cdc..b569e7d 100644 (file)
 
     <div id="books-list">
         <p>{% trans "More than one result matching the criteria found." %}</p>
-               <ul class='matches'>
+        <ul class='matches'>
         {% for match, link, type in results %}
-            <li><a href='{{ link }}'>{{ match.name }}</a> ({{ type }})</li>
+          <li>{% trans type %}: <a href='{{ link }}'>
+            {% ifequal type "book" %}
+                {% book_title match %}
+            {% else %}
+                {{ match.name }}
+            {% endifequal %}
+          </a></li>
         {% endfor %}
-               </ul>
+        </ul>
     </div>
 
     <div id="set-window">