search ui draft
authorMarcin Koziej <marcin.koziej@nowoczesnapolska.org.pl>
Tue, 27 Dec 2011 12:36:18 +0000 (13:36 +0100)
committerMarcin Koziej <marcin.koziej@nowoczesnapolska.org.pl>
Tue, 27 Dec 2011 12:36:18 +0000 (13:36 +0100)
apps/catalogue/models.py
apps/search/views.py
wolnelektury/templates/base.html
wolnelektury/templates/catalogue/search_multiple_hits.html

index e69d231..a180c65 100644 (file)
@@ -1035,7 +1035,7 @@ class Fragment(models.Model):
         verbose_name_plural = _('fragments')
 
     def get_absolute_url(self):
-        return '%s#m%s' % (self.book.get_html_url(), self.anchor)
+        return '%s#m%s' % (reverse('book_text', args=[self.book.slug]), self.anchor)
 
     def reset_short_html(self):
         if self.id is None:
index 75cc16a..bfa3c9b 100644 (file)
@@ -67,7 +67,6 @@ def hint(request):
     # jezeli tagi dot tylko ksiazki, to wazne zeby te nowe byly w tej samej ksiazce
     # jesli zas dotycza themes, to wazne, zeby byly w tym samym fragmencie.
 
-    # import pdb; pdb.set_trace()
     
     tags = s.hint_tags(prefix)
     books = s.hint_books(prefix)
@@ -127,7 +126,8 @@ def main(request):
                                       context_instance=RequestContext(request))
 
         hint.tags(tag_list)
-        hint.books(book)
+        if book:
+            hint.books(book)
 
         toks = StringReader(query)
         fuzzy = 'fuzzy' in request.GET
index 8440959..d1bf19e 100644 (file)
@@ -62,7 +62,7 @@
 
 
 
-            <form id="search">
+            <form id="search" action="/fullsearch/">
                 
                 <span id="search-field" class="grid-line">
                     <input title="np. Leśmian" name="q" autocomplete="off" data-source="/fullsearch/hint/">
index 15c5d71..414dcfd 100644 (file)
@@ -18,6 +18,7 @@
          {% for hit in result.process_hits %}
          <li>
            {% if hit.fragment %}
+           <a href="{{hit.fragment.get_absolute_url}}">Idź do fragmentu</a>
            <div style="">Tagi/Motywy: {% for tag in hit.themes %}{{tag.name}} {% endfor %}</div>
            {% endif %}
            {% for snip in hit.snippets %}