You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by jo...@apache.org on 2013/04/25 00:30:43 UTC

[18/50] git commit: [#2835] ticket:290 Use get_first helper and fix title displaying

[#2835] ticket:290 Use get_first helper and fix title displaying


Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/0d092368
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/0d092368
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/0d092368

Branch: refs/heads/cj/5655
Commit: 0d09236816af17ed92a824a9201472c6f14b3e2e
Parents: 46db582
Author: Igor Bondarenko <je...@gmail.com>
Authored: Tue Mar 19 10:42:34 2013 +0000
Committer: Dave Brondsema <db...@slashdotmedia.com>
Committed: Wed Apr 24 16:34:40 2013 +0000

----------------------------------------------------------------------
 .../allura/templates/widgets/search_results.html   |    6 +++++-
 ForgeWiki/forgewiki/wiki_main.py                   |    6 +++---
 2 files changed, 8 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/0d092368/Allura/allura/templates/widgets/search_results.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/widgets/search_results.html b/Allura/allura/templates/widgets/search_results.html
index e33fded..7eb577d 100644
--- a/Allura/allura/templates/widgets/search_results.html
+++ b/Allura/allura/templates/widgets/search_results.html
@@ -59,7 +59,11 @@
   <div class="grid-19">
     <p>
     <a href="{{doc['url_paginated'] or doc['url_s']}}">
-       {{- doc.title_match|safe or h.get_first(doc, 'title') or h.get_first(doc, 'title_s') -}}  {#-  title_s is legacy -#}
+      {% if doc.title_match %}
+        {{ doc.title_match|safe }}
+      {% else %}
+        {{ h.get_first(doc, 'title') or h.get_first(doc, 'title_s') -}}  {#-  title_s is legacy -#}
+      {% endif %}
     </a>
     {% if doc['type_s'] %}<span class="gray"><sup>{{ '(%s)' % doc['type_s'] }}</sup></span>{% endif %}
     <br>

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/0d092368/ForgeWiki/forgewiki/wiki_main.py
----------------------------------------------------------------------
diff --git a/ForgeWiki/forgewiki/wiki_main.py b/ForgeWiki/forgewiki/wiki_main.py
index 3e8d815..4a47b3b 100644
--- a/ForgeWiki/forgewiki/wiki_main.py
+++ b/ForgeWiki/forgewiki/wiki_main.py
@@ -367,10 +367,10 @@ class RootController(BaseController, DispatchIndex):
                     return doc
                 def add_matches(doc):
                     m = matches.get(doc['id'], {})
-                    doc['title_match'] = m.get('title', [''])[0]
-                    doc['text_match'] = m.get('text', [''])[0]
+                    doc['title_match'] = h.get_first(m, 'title')
+                    doc['text_match'] = h.get_first(m, 'text')
                     if not doc['text_match']:
-                        doc['text_match'] = doc.get('text', [''])[0]
+                        doc['text_match'] = h.get_first(doc, 'text')
                     return doc
                 results = imap(historize_urls, results)
                 results = imap(add_matches, results)