You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by br...@apache.org on 2013/03/26 22:13:51 UTC

[4/7] 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/3a8d150e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/3a8d150e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/3a8d150e

Branch: refs/heads/db/42cc_2835_content_preview
Commit: 3a8d150edb73cb2e61e6a856236b8388d19573d5
Parents: ec1db8d
Author: Igor Bondarenko <je...@gmail.com>
Authored: Tue Mar 19 10:42:34 2013 +0000
Committer: Dave Brondsema <db...@geek.net>
Committed: Tue Mar 26 21:13:20 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/3a8d150e/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 ba7bf9d..f649b14 100644
--- a/Allura/allura/templates/widgets/search_results.html
+++ b/Allura/allura/templates/widgets/search_results.html
@@ -41,7 +41,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/3a8d150e/ForgeWiki/forgewiki/wiki_main.py
----------------------------------------------------------------------
diff --git a/ForgeWiki/forgewiki/wiki_main.py b/ForgeWiki/forgewiki/wiki_main.py
index d292c91..2ac42f6 100644
--- a/ForgeWiki/forgewiki/wiki_main.py
+++ b/ForgeWiki/forgewiki/wiki_main.py
@@ -350,10 +350,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)