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:02:35 UTC

[01/22] git commit: [#2835] ticket:287 Make search field bigger, add help button

Updated Branches:
  refs/heads/master db0dd9ce1 -> aced859b5


[#2835] ticket:287 Make search field bigger, add help button


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

Branch: refs/heads/master
Commit: 4ab5bda6e99eb178b53cc187b51a136c75945456
Parents: db0dd9c
Author: Igor Bondarenko <je...@gmail.com>
Authored: Tue Mar 5 11:42:00 2013 +0000
Committer: Dave Brondsema <db...@geek.net>
Committed: Tue Mar 26 20:57:33 2013 +0000

----------------------------------------------------------------------
 Allura/allura/lib/widgets/resources/css/search.css |    3 ++
 Allura/allura/lib/widgets/search.py                |    1 +
 .../allura/templates/widgets/search_results.html   |   16 +++++++++++++-
 3 files changed, 18 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/4ab5bda6/Allura/allura/lib/widgets/resources/css/search.css
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/widgets/resources/css/search.css b/Allura/allura/lib/widgets/resources/css/search.css
new file mode 100644
index 0000000..16b792a
--- /dev/null
+++ b/Allura/allura/lib/widgets/resources/css/search.css
@@ -0,0 +1,3 @@
+input.search-query {
+  width: 95%;
+}

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/4ab5bda6/Allura/allura/lib/widgets/search.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/widgets/search.py b/Allura/allura/lib/widgets/search.py
index ec6ed51..fc17b3e 100644
--- a/Allura/allura/lib/widgets/search.py
+++ b/Allura/allura/lib/widgets/search.py
@@ -21,3 +21,4 @@ class SearchResults(ew_core.Widget):
         for f in self.fields:
             for r in f.resources():
                 yield r
+        yield ew.CSSLink('css/search.css')

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/4ab5bda6/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 3e51c43..d6811a6 100644
--- a/Allura/allura/templates/widgets/search_results.html
+++ b/Allura/allura/templates/widgets/search_results.html
@@ -1,7 +1,19 @@
 <form method="GET" action=".">
-  <div class="grid-19">
-    <input type="text" name="q" value="{{q}}" class="defaultText" title="Search App"/>
+  <div class="grid-10">
+    <input type="text" name="q" value="{{q}}" class="search-query" title="Search App"/>
+  </div>
+  <div class="grid-3">
+    <input type="submit" value="Search">
+  </div>
+  <div class="grid-6">
+    <a href="#" class="btn search_help_modal">
+      <b data-icon="{{g.icons['help'].char}}" class="ico {{g.icons['help'].css}}"></b>
+      Help
+    </a>
   </div>
+
+
+
   <div class="grid-19">
     <input type="submit" value="Search App">
     <input type="submit" name="project" value="Search Entire Project">


[19/22] git commit: [#2835] ticket:303 Add option to use standard parser

Posted by br...@apache.org.
[#2835] ticket:303 Add option to use standard parser


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

Branch: refs/heads/master
Commit: e3b30ad7427e6a91c17c9a1fbc7fbe785cf85f2f
Parents: 975b209
Author: Igor Bondarenko <je...@gmail.com>
Authored: Fri Mar 15 09:23:56 2013 +0000
Committer: Dave Brondsema <db...@geek.net>
Committed: Tue Mar 26 20:57:38 2013 +0000

----------------------------------------------------------------------
 .../templates/blog_widgets/preview_post.html       |    2 +-
 .../templates/blog_widgets/view_post.html          |    2 +-
 ForgeWiki/forgewiki/templates/wiki/page_view.html  |    4 ++--
 ForgeWiki/forgewiki/wiki_main.py                   |    7 ++++++-
 4 files changed, 10 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/e3b30ad7/ForgeBlog/forgeblog/templates/blog_widgets/preview_post.html
----------------------------------------------------------------------
diff --git a/ForgeBlog/forgeblog/templates/blog_widgets/preview_post.html b/ForgeBlog/forgeblog/templates/blog_widgets/preview_post.html
index 549aa03..36f9ebc 100644
--- a/ForgeBlog/forgeblog/templates/blog_widgets/preview_post.html
+++ b/ForgeBlog/forgeblog/templates/blog_widgets/preview_post.html
@@ -17,7 +17,7 @@
   <em class="grid-19">
     <strong>Labels:</strong>
     {% for l in value.labels %}
-      <span><a href="{{c.app.url}}search?q=labels_t:{{l}}">{{l}}</a> </span>
+      <span><a href="{{c.app.url}}search?q=labels_t:{{l}}&parser=standard">{{l}}</a> </span>
     {% endfor %}
   </em>
   {% endif %}

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/e3b30ad7/ForgeBlog/forgeblog/templates/blog_widgets/view_post.html
----------------------------------------------------------------------
diff --git a/ForgeBlog/forgeblog/templates/blog_widgets/view_post.html b/ForgeBlog/forgeblog/templates/blog_widgets/view_post.html
index 40f367f..8c1e747 100644
--- a/ForgeBlog/forgeblog/templates/blog_widgets/view_post.html
+++ b/ForgeBlog/forgeblog/templates/blog_widgets/view_post.html
@@ -15,7 +15,7 @@
 <em class="grid-19">
   <strong>Labels:</strong>
   {% for l in value.labels %}
-    <span><a href="{{c.app.url}}search?q=labels_t:{{l}}">{{l}}</a> </span>
+    <span><a href="{{c.app.url}}search?q=labels_t:{{l}}&parser=standard">{{l}}</a> </span>
   {% endfor %}
 </em>
 {% endif %}

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/e3b30ad7/ForgeWiki/forgewiki/templates/wiki/page_view.html
----------------------------------------------------------------------
diff --git a/ForgeWiki/forgewiki/templates/wiki/page_view.html b/ForgeWiki/forgewiki/templates/wiki/page_view.html
index 1a32fa1..8c18bda 100644
--- a/ForgeWiki/forgewiki/templates/wiki/page_view.html
+++ b/ForgeWiki/forgewiki/templates/wiki/page_view.html
@@ -47,7 +47,7 @@
     <label class="simple">Labels: </label>
     {% for label in page.labels %}
       {% if label != '' %}
-        <span><a href="{{c.app.url}}search/?q=labels_t:{{label}}">{{label}} ({{page.artifacts_labeled_with(label, page.app_config).count()}})</a></span>
+        <span><a href="{{c.app.url}}search/?q=labels_t:{{label}}&parser=standard">{{label}} ({{page.artifacts_labeled_with(label, page.app_config).count()}})</a></span>
       {% endif %}
     {% endfor %}
   </div>
@@ -57,7 +57,7 @@
     {% for author in page.authors() %}
       <a href="{{author.url()}}">
         {{lib.gravatar(author, size=16)}}
-      </a>  
+      </a>
     {% endfor %}
   </div>
   {% if page.attachments %}

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/e3b30ad7/ForgeWiki/forgewiki/wiki_main.py
----------------------------------------------------------------------
diff --git a/ForgeWiki/forgewiki/wiki_main.py b/ForgeWiki/forgewiki/wiki_main.py
index 15f86ec..be11731 100644
--- a/ForgeWiki/forgewiki/wiki_main.py
+++ b/ForgeWiki/forgewiki/wiki_main.py
@@ -301,7 +301,8 @@ class RootController(BaseController, DispatchIndex):
             redirect(c.project.url() + 'search?' + urlencode(dict(q=q, history=history)))
         search_error = None
         results = []
-        count=0
+        count = 0
+        parser = kw.pop('parser', None)
         limit, page, start = g.handle_paging(limit, page, default=25)
         if not q:
             q = ''
@@ -325,6 +326,10 @@ class RootController(BaseController, DispatchIndex):
             }
             if not history:
                search_params['fq'].append('is_history_b:False')
+            if parser == 'standard':
+                search_params.pop('qt', None)
+                search_params.pop('qf', None)
+                search_params.pop('pf', None)
             try:
                 results = search(
                     q, short_timeout=True, ignore_errors=False,


[07/22] git commit: [#2835] ticket:287 Display time using ago_string helper

Posted by br...@apache.org.
[#2835] ticket:287 Display time using ago_string helper


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

Branch: refs/heads/master
Commit: c3db26862c3205b8374f0bce7c119657c1c0f720
Parents: 556cfdb
Author: Igor Bondarenko <je...@gmail.com>
Authored: Tue Mar 5 15:47:02 2013 +0000
Committer: Dave Brondsema <db...@geek.net>
Committed: Tue Mar 26 20:57:35 2013 +0000

----------------------------------------------------------------------
 .../allura/templates/widgets/search_results.html   |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/c3db2686/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 5e66ccd..92b7cb6 100644
--- a/Allura/allura/templates/widgets/search_results.html
+++ b/Allura/allura/templates/widgets/search_results.html
@@ -42,7 +42,7 @@
     {{ doc.snippet }}
     TODO: change me to something useful! Mark <strong>matches</strong>.<br/>
     an open source implementation of a software "forge", <strong>a web site</strong> that manages source code repositories, bug reports, discussions, mailing lists, wiki pages, blogs and more for any number of individual proje<br>
-    <span class="date">Last updated: {{ doc['mod_date_dt'] }}</span>
+    <span class="date">Last updated: {{ h.ago_string(doc['mod_date_dt']) }}</span>
     </p>
   </div>
 {% endfor %}


[04/22] git commit: [#2835] ticket:287 Add search comments checkbox

Posted by br...@apache.org.
[#2835] ticket:287 Add search comments checkbox


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

Branch: refs/heads/master
Commit: b7f967dbca7095ba78df3110f44fc1f74ea1a4af
Parents: aaa1e45
Author: Igor Bondarenko <je...@gmail.com>
Authored: Tue Mar 5 12:06:30 2013 +0000
Committer: Dave Brondsema <db...@geek.net>
Committed: Tue Mar 26 20:57:34 2013 +0000

----------------------------------------------------------------------
 .../allura/templates/widgets/search_results.html   |   11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/b7f967db/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 bc1cfdc..6700c48 100644
--- a/Allura/allura/templates/widgets/search_results.html
+++ b/Allura/allura/templates/widgets/search_results.html
@@ -11,15 +11,20 @@
       Help
     </a>
   </div>
-  <div class="grid-19">
+  <div class="grid-10">
     {% set search_project = request.GET['project'] == '1' %}
     <input type="radio" name="project" value="0" id="search-app" {% if not search_project %}checked{% endif %}>
     <label for="search-app">Search {{c.app.config.options.mount_point or 'app'}}</label>
     <input type="radio" name="project" value="1" id="search-project" {% if search_project %}checked{% endif %}>
     <label for="search-project">Search entire project</label>
   </div>
-  <div class="grid-19">
-    Search history? <input type="checkbox" name="history"{% if history %} checked="checked"{% endif %}/>
+  <div class="grid-9">
+    {% if not search_comments_disable %}
+      <label for="search-comments">Search comments?</label>
+      <input id="search-comments" type="checkbox" name="search_comments"{% if search_comments %} checked{% endif %}>
+    {% endif %}
+    <label for="search-history">Search history?</label>
+    <input id="search-history" type="checkbox" name="history"{% if history %} checked{% endif %}>
   </div>
 </form>
 <div style="clear:both">&nbsp;</div>


[22/22] git commit: [#2835] support old title_s in results, so reindexing is not required

Posted by br...@apache.org.
[#2835] support old title_s in results, so reindexing is not required


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

Branch: refs/heads/master
Commit: aced859b5141eaab9560998b1b2d6c581011df58
Parents: f211493
Author: Dave Brondsema <db...@geek.net>
Authored: Tue Mar 26 20:57:21 2013 +0000
Committer: Dave Brondsema <db...@geek.net>
Committed: Tue Mar 26 21:02:17 2013 +0000

----------------------------------------------------------------------
 Allura/allura/templates/search_index.html          |    4 +++-
 .../allura/templates/widgets/search_results.html   |    4 +++-
 2 files changed, 6 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/aced859b/Allura/allura/templates/search_index.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/search_index.html b/Allura/allura/templates/search_index.html
index 6fd2107..8452ce8 100644
--- a/Allura/allura/templates/search_index.html
+++ b/Allura/allura/templates/search_index.html
@@ -27,7 +27,9 @@
   <ol>
   {% for doc in results %}
   <li>
-    <a href="{{doc['url_s']}}">{{h.get_first(doc, 'title')}}</a>
+    <a href="{{doc['url_s']}}">
+       {{- h.get_first(doc, 'title') or h.get_first(doc, 'title_s') -}}  {#-  title_s is legacy -#}
+    </a>
     {% if doc.get('snippet') %}
       <p>{{doc['snippet']|safe}}</p>
     {% endif %}

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/aced859b/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 d1067cc..b586dec 100644
--- a/Allura/allura/templates/widgets/search_results.html
+++ b/Allura/allura/templates/widgets/search_results.html
@@ -41,7 +41,9 @@
   <div class="grid-19">
     {# TODO: mark matches in title and snippet #}
     <p>
-    <a href="{{doc['url_paginated'] or doc['url_s']}}">{{ h.get_first(doc, 'title') }}</a>
+    <a href="{{doc['url_paginated'] or doc['url_s']}}">
+       {{- h.get_first(doc, 'title') or h.get_first(doc, 'title_s') -}}  {#-  title_s is legacy -#}
+    </a>
     {% if doc['type_s'] %}<span class="gray"><sup>{{ '(%s)' % doc['type_s'] }}</sup></span>{% endif %}
     <br>
     {{ doc.snippet }}


[11/22] git commit: [#2835] ticket:288 Change indexing

Posted by br...@apache.org.
[#2835] ticket:288 Change indexing

* Don't append 'WikiPage' in title_s
* Don't append all fields into `text`


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

Branch: refs/heads/master
Commit: b5f42ced3f07f5a929be1305e5e66b3c9c62eafb
Parents: c8cbb93
Author: Igor Bondarenko <je...@gmail.com>
Authored: Thu Mar 7 09:25:54 2013 +0000
Committer: Dave Brondsema <db...@geek.net>
Committed: Tue Mar 26 20:57:36 2013 +0000

----------------------------------------------------------------------
 Allura/allura/lib/search.py       |    9 ++-------
 ForgeWiki/forgewiki/model/wiki.py |    2 +-
 2 files changed, 3 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/b5f42ced/Allura/allura/lib/search.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/search.py b/Allura/allura/lib/search.py
index 4d73c83..44fce05 100644
--- a/Allura/allura/lib/search.py
+++ b/Allura/allura/lib/search.py
@@ -18,13 +18,8 @@ def solarize(obj):
     if obj is None: return None
     doc = obj.index()
     if doc is None: return None
-    text = doc.pop('text', '')
-    try:
-        text = text + pformat(doc.values())
-    except TypeError:
-        # log.exception('Indexing empty text: %s', doc)
-        text = pformat(doc.values())
-    doc['text'] = text
+    # if index() returned doc without text, assume empty text
+    doc['text'] = doc.pop('text', '')
     return doc
 
 class SearchError(SolrError):

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/b5f42ced/ForgeWiki/forgewiki/model/wiki.py
----------------------------------------------------------------------
diff --git a/ForgeWiki/forgewiki/model/wiki.py b/ForgeWiki/forgewiki/model/wiki.py
index af88c04..dac92c7 100644
--- a/ForgeWiki/forgewiki/model/wiki.py
+++ b/ForgeWiki/forgewiki/model/wiki.py
@@ -129,7 +129,7 @@ class Page(VersionedArtifact, ActivityObject):
     def index(self):
         result = VersionedArtifact.index(self)
         result.update(
-            title_s='WikiPage %s' % self.title,
+            title_s=self.title,
             version_i=self.version,
             type_s='WikiPage',
             text=self.text)


[02/22] git commit: [#2835] ticket:287 Sorting controls stub

Posted by br...@apache.org.
[#2835] ticket:287 Sorting controls stub


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

Branch: refs/heads/master
Commit: 5b1eba0ec14f7e17b5db432aae54b82f6bef3f97
Parents: 86bd80f
Author: Igor Bondarenko <je...@gmail.com>
Authored: Tue Mar 5 15:21:07 2013 +0000
Committer: Dave Brondsema <db...@geek.net>
Committed: Tue Mar 26 20:57:34 2013 +0000

----------------------------------------------------------------------
 .../allura/templates/widgets/search_results.html   |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/5b1eba0e/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 0b1fcdf..5e66ccd 100644
--- a/Allura/allura/templates/widgets/search_results.html
+++ b/Allura/allura/templates/widgets/search_results.html
@@ -46,7 +46,11 @@
     </p>
   </div>
 {% endfor %}
-<div class="grid-19" style="clear:both">
+<div class="grid-19">
   {{widget.fields['page_list'].display(limit=limit, page=page, count=count)}}
   {{widget.fields['page_size'].display(limit=limit, count=count)}}
 </div>
+<div class="grid-19" style="clear:both">
+  {# TODO: highlight active sorting order #}
+  <p>Sort by <a href="#"><strong>relevance</strong></a> or <a href="#">date</a></p>
+</div>


[17/22] git commit: [#2835] ticket:288 Preserve old indexation logic for tickets

Posted by br...@apache.org.
[#2835] ticket:288 Preserve old indexation logic for tickets


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

Branch: refs/heads/master
Commit: fa1d3affa3a0126028330b6c4fc27b2107de58c7
Parents: 88d7b82
Author: Igor Bondarenko <je...@gmail.com>
Authored: Fri Mar 8 13:00:39 2013 +0000
Committer: Dave Brondsema <db...@geek.net>
Committed: Tue Mar 26 20:57:38 2013 +0000

----------------------------------------------------------------------
 Allura/allura/lib/search.py |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/fa1d3aff/Allura/allura/lib/search.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/search.py b/Allura/allura/lib/search.py
index 17fbf57..a6587f1 100644
--- a/Allura/allura/lib/search.py
+++ b/Allura/allura/lib/search.py
@@ -1,15 +1,12 @@
 import re
 import socket
-import cPickle as pickle
 from logging import getLogger
 from pprint import pformat
-from itertools import islice, chain
 
 import markdown
 from pylons import tmpl_context as c, app_globals as g
 from pysolr import SolrError
 
-from . import helpers as h
 from .markdown_extensions import ForgeExtension
 
 log = getLogger(__name__)
@@ -21,6 +18,10 @@ def solarize(obj):
     # if index() returned doc without text, assume empty text
     if not doc.get('text'):
         doc['text'] = ''
+    # Tracker uses search with default solr parser. It would match only on
+    # `text`, so we append all other field values into `text`, to match on it too.
+    if getattr(obj, 'type_s', '').lower() == 'ticket':
+        doc['text'] += pformat(doc.values())
     return doc
 
 class SearchError(SolrError):


[12/22] git commit: [#2835] ticket:288 Show artifact type next to title

Posted by br...@apache.org.
[#2835] ticket:288 Show artifact type next to title


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

Branch: refs/heads/master
Commit: a9f0bdb9b4af317da01f36928e43508486a78123
Parents: b5f42ce
Author: Igor Bondarenko <je...@gmail.com>
Authored: Thu Mar 7 09:26:55 2013 +0000
Committer: Dave Brondsema <db...@geek.net>
Committed: Tue Mar 26 20:57:36 2013 +0000

----------------------------------------------------------------------
 Allura/allura/lib/widgets/resources/css/search.css |    2 +-
 .../allura/templates/widgets/search_results.html   |    6 ++++--
 2 files changed, 5 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/a9f0bdb9/Allura/allura/lib/widgets/resources/css/search.css
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/widgets/resources/css/search.css b/Allura/allura/lib/widgets/resources/css/search.css
index 614bc01..f687399 100644
--- a/Allura/allura/lib/widgets/resources/css/search.css
+++ b/Allura/allura/lib/widgets/resources/css/search.css
@@ -2,7 +2,7 @@ input.search-query {
   width: 95%;
 }
 
-.date {
+.gray {
   color: #aaa;
 }
 

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/a9f0bdb9/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 92b7cb6..74eb466 100644
--- a/Allura/allura/templates/widgets/search_results.html
+++ b/Allura/allura/templates/widgets/search_results.html
@@ -38,11 +38,13 @@
   <div class="grid-19">
     {# TODO: mark matches in title and snippet #}
     <p>
-    <a href="{{doc['url_paginated'] or doc['url_s']}}">{{ doc.title_s }}</a><br>
+    <a href="{{doc['url_paginated'] or doc['url_s']}}">{{ doc.title_s }}</a>
+    {% if doc['type_s'] %}<span class="gray"><sup>{{ '(%s)' % doc['type_s'] }}</sup></span>{% endif %}
+    <br>
     {{ doc.snippet }}
     TODO: change me to something useful! Mark <strong>matches</strong>.<br/>
     an open source implementation of a software "forge", <strong>a web site</strong> that manages source code repositories, bug reports, discussions, mailing lists, wiki pages, blogs and more for any number of individual proje<br>
-    <span class="date">Last updated: {{ h.ago_string(doc['mod_date_dt']) }}</span>
+    <span class="gray">Last updated: {{ h.ago_string(doc['mod_date_dt']) }}</span>
     </p>
   </div>
 {% endfor %}


[20/22] git commit: [#2835] ticket:303 Append all fields into inside the ticket's index()

Posted by br...@apache.org.
[#2835] ticket:303 Append all fields into  inside the ticket's index()


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

Branch: refs/heads/master
Commit: 186cf48763ededb55c6594879476d6e1a2e5dcba
Parents: e3b30ad
Author: Igor Bondarenko <je...@gmail.com>
Authored: Fri Mar 15 09:46:21 2013 +0000
Committer: Dave Brondsema <db...@geek.net>
Committed: Tue Mar 26 20:57:39 2013 +0000

----------------------------------------------------------------------
 Allura/allura/lib/search.py               |    5 -----
 ForgeTracker/forgetracker/model/ticket.py |    7 +++++++
 2 files changed, 7 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/186cf487/Allura/allura/lib/search.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/search.py b/Allura/allura/lib/search.py
index a6587f1..a428c53 100644
--- a/Allura/allura/lib/search.py
+++ b/Allura/allura/lib/search.py
@@ -1,7 +1,6 @@
 import re
 import socket
 from logging import getLogger
-from pprint import pformat
 
 import markdown
 from pylons import tmpl_context as c, app_globals as g
@@ -18,10 +17,6 @@ def solarize(obj):
     # if index() returned doc without text, assume empty text
     if not doc.get('text'):
         doc['text'] = ''
-    # Tracker uses search with default solr parser. It would match only on
-    # `text`, so we append all other field values into `text`, to match on it too.
-    if getattr(obj, 'type_s', '').lower() == 'ticket':
-        doc['text'] += pformat(doc.values())
     return doc
 
 class SearchError(SolrError):

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/186cf487/ForgeTracker/forgetracker/model/ticket.py
----------------------------------------------------------------------
diff --git a/ForgeTracker/forgetracker/model/ticket.py b/ForgeTracker/forgetracker/model/ticket.py
index dbfda81..db7113a 100644
--- a/ForgeTracker/forgetracker/model/ticket.py
+++ b/ForgeTracker/forgetracker/model/ticket.py
@@ -7,6 +7,7 @@ from datetime import datetime, timedelta
 import pymongo
 from pymongo.errors import OperationFailure
 from pylons import tmpl_context as c, app_globals as g
+from pprint import pformat
 
 from ming import schema
 from ming.utils import LazyProperty
@@ -209,6 +210,9 @@ class TicketHistory(Snapshot):
                 self.version, orig.summary),
             type_s='Ticket Snapshot',
             text=self.data.summary)
+        # Tracker uses search with default solr parser. It would match only on
+        # `text`, so we're appending all other field values into `text`, to match on it too.
+        result['text'] += pformat(result.values())
         return result
 
 class Bin(Artifact, ActivityObject):
@@ -319,6 +323,9 @@ class Ticket(VersionedArtifact, ActivityObject, VotableArtifact):
             result['reported_by_s'] = self.reported_by.username
         if self.assigned_to:
             result['assigned_to_s'] = self.assigned_to.username
+        # Tracker uses search with default solr parser. It would match only on
+        # `text`, so we're appending all other field values into `text`, to match on it too.
+        result['text'] += pformat(result.values())
         return result
 
     @classmethod


[10/22] git commit: [#2835] ticket:288 Use 'dismax' parser for wiki search, better match on title

Posted by br...@apache.org.
[#2835] ticket:288 Use 'dismax' parser for wiki search, better match on title


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

Branch: refs/heads/master
Commit: 879729401792f6378f766fdb30c8179bc23dfa95
Parents: a9f0bdb
Author: Igor Bondarenko <je...@gmail.com>
Authored: Thu Mar 7 11:52:11 2013 +0000
Committer: Dave Brondsema <db...@geek.net>
Committed: Tue Mar 26 20:57:36 2013 +0000

----------------------------------------------------------------------
 Allura/allura/model/artifact.py   |    6 +++---
 ForgeWiki/forgewiki/model/wiki.py |    6 ++++--
 ForgeWiki/forgewiki/wiki_main.py  |   22 ++++++++++++++++------
 3 files changed, 23 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/87972940/Allura/allura/model/artifact.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/artifact.py b/Allura/allura/model/artifact.py
index 4c24a1c..95da7dd 100644
--- a/Allura/allura/model/artifact.py
+++ b/Allura/allura/model/artifact.py
@@ -208,12 +208,11 @@ class Artifact(MappedClass):
         """
         Subclasses should override this, providing a dictionary of solr_field => value.
         These fields & values will be stored by solr.  Subclasses should call the
-        super() index() and then extend it with more fields.  All these fields will be
-        included in the 'text' field (done by search.solarize())
+        super() index() and then extend it with more fields.
 
         The _s and _t suffixes, for example, follow solr dynamic field naming
         pattern.
-        You probably want to override at least title_s and text to have
+        You probably want to override at least title, title_s and text to have
         meaningful search results and email senders.
         """
 
@@ -222,6 +221,7 @@ class Artifact(MappedClass):
             id=self.index_id(),
             mod_date_dt=self.mod_date,
             title_s='Artifact %s' % self._id,
+            title='Artifact %s' % self._id,
             project_id_s=str(project._id),
             project_name_t=project.name,
             project_shortname_t=project.shortname,

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/87972940/ForgeWiki/forgewiki/model/wiki.py
----------------------------------------------------------------------
diff --git a/ForgeWiki/forgewiki/model/wiki.py b/ForgeWiki/forgewiki/model/wiki.py
index dac92c7..c477b91 100644
--- a/ForgeWiki/forgewiki/model/wiki.py
+++ b/ForgeWiki/forgewiki/model/wiki.py
@@ -46,9 +46,10 @@ class PageHistory(Snapshot):
 
     def index(self):
         result = Snapshot.index(self)
+        title = '%s (version %d)' % (self.original().title, self.version)
         result.update(
-            title_s='Version %d of %s' % (
-                self.version,self.original().title),
+            title_s=title,
+            title=title,
             type_s='WikiPage Snapshot',
             text=self.data.text)
         return result
@@ -130,6 +131,7 @@ class Page(VersionedArtifact, ActivityObject):
         result = VersionedArtifact.index(self)
         result.update(
             title_s=self.title,
+            title=self.title,
             version_i=self.version,
             type_s='WikiPage',
             text=self.text)

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/87972940/ForgeWiki/forgewiki/wiki_main.py
----------------------------------------------------------------------
diff --git a/ForgeWiki/forgewiki/wiki_main.py b/ForgeWiki/forgewiki/wiki_main.py
index f15c634..e5482ea 100644
--- a/ForgeWiki/forgewiki/wiki_main.py
+++ b/ForgeWiki/forgewiki/wiki_main.py
@@ -304,15 +304,25 @@ class RootController(BaseController, DispatchIndex):
         if not q:
             q = ''
         else:
+            # Match on both `title` and `text` by default, using 'dismax' parser.
+            # Score on `title` matches is boosted, so title match is better than body match.
+            # It's 'fuzzier' than standard parser, which matches only on `text`.
+            search_params = {
+                'qt': 'dismax',
+                'qf': 'title^2 text',
+                'pf': 'title^2 text',
+                'fq': [
+                    'project_id_s:%s' % c.project._id,
+                    'mount_point_s:%s'% c.app.config.options.mount_point,
+                    '-deleted_b:true'
+                ]
+            }
+            if not history:
+               search_params['fq'].append('is_history_b:False')
             try:
                 results = search(
                     q, short_timeout=True, ignore_errors=False,
-                    rows=limit, start=start,
-                    fq=[
-                        'is_history_b:%s' % history,
-                        'project_id_s:%s' % c.project._id,
-                        'mount_point_s:%s'% c.app.config.options.mount_point,
-                        '-deleted_b:true'])
+                    rows=limit, start=start, **search_params)
             except SolrError as e:
                 search_error = e
             if results: count=results.hits


[13/22] git commit: [#2835] ticket:288 Add `version=N` to the urls

Posted by br...@apache.org.
[#2835] ticket:288 Add `version=N` to the urls


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

Branch: refs/heads/master
Commit: cd839bb65bea2d7c5c1109ef85a48d75bf705af5
Parents: cf33bec
Author: Igor Bondarenko <je...@gmail.com>
Authored: Thu Mar 7 13:13:03 2013 +0000
Committer: Dave Brondsema <db...@geek.net>
Committed: Tue Mar 26 20:57:37 2013 +0000

----------------------------------------------------------------------
 ForgeWiki/forgewiki/wiki_main.py |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/cd839bb6/ForgeWiki/forgewiki/wiki_main.py
----------------------------------------------------------------------
diff --git a/ForgeWiki/forgewiki/wiki_main.py b/ForgeWiki/forgewiki/wiki_main.py
index 0b0f143..15f86ec 100644
--- a/ForgeWiki/forgewiki/wiki_main.py
+++ b/ForgeWiki/forgewiki/wiki_main.py
@@ -3,6 +3,7 @@ import logging
 from pprint import pformat
 from urllib import urlencode, unquote
 from datetime import datetime
+from itertools import imap
 
 # Non-stdlib imports
 from tg import expose, validate, redirect, response, flash
@@ -310,7 +311,7 @@ class RootController(BaseController, DispatchIndex):
             # It's 'fuzzier' than standard parser, which matches only on `text`.
             allowed_types = ['WikiPage', 'WikiPage Snapshot']
             if search_comments:
-                allowed_types += ['Post', 'Post Snapshot']
+                allowed_types += ['Post']
             search_params = {
                 'qt': 'dismax',
                 'qf': 'title^2 text',
@@ -330,7 +331,14 @@ class RootController(BaseController, DispatchIndex):
                     rows=limit, start=start, **search_params)
             except SolrError as e:
                 search_error = e
-            if results: count=results.hits
+            if results:
+                count=results.hits
+                def historize_urls(doc):
+                    if doc.get('type_s', '').endswith(' Snapshot'):
+                        if doc.get('url_s'):
+                            doc['url_s'] = doc['url_s'] + '?version=%s' % doc.get('version_i')
+                    return doc
+                results = imap(historize_urls, results)
         c.search_results = W.search_results
         return dict(q=q, history=history, results=results or [],
                     count=count, limit=limit, page=page, search_error=search_error)


[15/22] git commit: [#2835] ticket:288 Always use an empty string instead of None in `text` field

Posted by br...@apache.org.
[#2835] ticket:288 Always use an empty string instead of None in `text` field


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

Branch: refs/heads/master
Commit: 01c9d1caf169d237b7da99c1210ca892dbdbb789
Parents: 978b241
Author: Igor Bondarenko <je...@gmail.com>
Authored: Fri Mar 8 11:55:54 2013 +0000
Committer: Dave Brondsema <db...@geek.net>
Committed: Tue Mar 26 20:57:37 2013 +0000

----------------------------------------------------------------------
 Allura/allura/lib/search.py |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/01c9d1ca/Allura/allura/lib/search.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/search.py b/Allura/allura/lib/search.py
index 44fce05..17fbf57 100644
--- a/Allura/allura/lib/search.py
+++ b/Allura/allura/lib/search.py
@@ -19,7 +19,8 @@ def solarize(obj):
     doc = obj.index()
     if doc is None: return None
     # if index() returned doc without text, assume empty text
-    doc['text'] = doc.pop('text', '')
+    if not doc.get('text'):
+        doc['text'] = ''
     return doc
 
 class SearchError(SolrError):


[09/22] git commit: [#2835] ticket:288 Search comments option

Posted by br...@apache.org.
[#2835] ticket:288 Search comments option


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

Branch: refs/heads/master
Commit: cf33bec6cb977bb4eba09292149a410bee6ecc16
Parents: 8797294
Author: Igor Bondarenko <je...@gmail.com>
Authored: Thu Mar 7 12:50:26 2013 +0000
Committer: Dave Brondsema <db...@geek.net>
Committed: Tue Mar 26 20:57:36 2013 +0000

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


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/cf33bec6/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 74eb466..4cfc891 100644
--- a/Allura/allura/templates/widgets/search_results.html
+++ b/Allura/allura/templates/widgets/search_results.html
@@ -20,8 +20,9 @@
   </div>
   <div class="grid-9">
     {% if not search_comments_disable %}
+      {% set comments = request.GET['search_comments'] %}
       <label for="search-comments">Search comments?</label>
-      <input id="search-comments" type="checkbox" name="search_comments"{% if search_comments %} checked{% endif %}>
+      <input id="search-comments" type="checkbox" name="search_comments"{% if comments %} checked{% endif %}>
     {% endif %}
     <label for="search-history">Search history?</label>
     <input id="search-history" type="checkbox" name="history"{% if history %} checked{% endif %}>

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/cf33bec6/ForgeWiki/forgewiki/wiki_main.py
----------------------------------------------------------------------
diff --git a/ForgeWiki/forgewiki/wiki_main.py b/ForgeWiki/forgewiki/wiki_main.py
index e5482ea..0b0f143 100644
--- a/ForgeWiki/forgewiki/wiki_main.py
+++ b/ForgeWiki/forgewiki/wiki_main.py
@@ -292,8 +292,9 @@ class RootController(BaseController, DispatchIndex):
     @expose('jinja:forgewiki:templates/wiki/search.html')
     @validate(dict(q=validators.UnicodeString(if_empty=None),
                    history=validators.StringBool(if_empty=False),
+                   search_comments=validators.StringBool(if_empty=False),
                    project=validators.StringBool(if_empty=False)))
-    def search(self, q=None, history=None, project=None, limit=None, page=0, **kw):
+    def search(self, q=None, history=None, search_comments=None, project=None, limit=None, page=0, **kw):
         'local wiki search'
         if project:
             redirect(c.project.url() + 'search?' + urlencode(dict(q=q, history=history)))
@@ -307,15 +308,19 @@ class RootController(BaseController, DispatchIndex):
             # Match on both `title` and `text` by default, using 'dismax' parser.
             # Score on `title` matches is boosted, so title match is better than body match.
             # It's 'fuzzier' than standard parser, which matches only on `text`.
+            allowed_types = ['WikiPage', 'WikiPage Snapshot']
+            if search_comments:
+                allowed_types += ['Post', 'Post Snapshot']
             search_params = {
                 'qt': 'dismax',
                 'qf': 'title^2 text',
                 'pf': 'title^2 text',
                 'fq': [
-                    'project_id_s:%s' % c.project._id,
-                    'mount_point_s:%s'% c.app.config.options.mount_point,
-                    '-deleted_b:true'
-                ]
+                    'project_id_s:%s'  % c.project._id,
+                    'mount_point_s:%s' % c.app.config.options.mount_point,
+                    '-deleted_b:true',
+                    'type_s:(%s)' % ' OR '.join(['"%s"' % t for t in allowed_types])
+                ],
             }
             if not history:
                search_params['fq'].append('is_history_b:False')


[06/22] git commit: [#2835] ticket:287 Center radiobuttons and checkboxes

Posted by br...@apache.org.
[#2835] ticket:287 Center radiobuttons and checkboxes


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

Branch: refs/heads/master
Commit: c8cbb93ff3df63130e1291c0cabe20c2e4dddb01
Parents: c3db268
Author: Igor Bondarenko <je...@gmail.com>
Authored: Wed Mar 6 09:08:35 2013 +0000
Committer: Dave Brondsema <db...@geek.net>
Committed: Tue Mar 26 20:57:35 2013 +0000

----------------------------------------------------------------------
 Allura/allura/lib/widgets/resources/css/search.css |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/c8cbb93f/Allura/allura/lib/widgets/resources/css/search.css
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/widgets/resources/css/search.css b/Allura/allura/lib/widgets/resources/css/search.css
index 8d4f308..614bc01 100644
--- a/Allura/allura/lib/widgets/resources/css/search.css
+++ b/Allura/allura/lib/widgets/resources/css/search.css
@@ -5,3 +5,8 @@ input.search-query {
 .date {
   color: #aaa;
 }
+
+input[type="radio"],
+input[type="checkbox"] {
+  vertical-align: middle;
+}


[08/22] git commit: [#2835] ticket:287 Add ago_string helper

Posted by br...@apache.org.
[#2835] ticket:287 Add ago_string helper


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

Branch: refs/heads/master
Commit: 556cfdbde2a4b382a7003889432d634aca21b56b
Parents: 5b1eba0
Author: Igor Bondarenko <je...@gmail.com>
Authored: Tue Mar 5 15:39:17 2013 +0000
Committer: Dave Brondsema <db...@geek.net>
Committed: Tue Mar 26 20:57:35 2013 +0000

----------------------------------------------------------------------
 Allura/allura/lib/helpers.py        |    6 ++++++
 Allura/allura/tests/test_helpers.py |    4 ++++
 2 files changed, 10 insertions(+), 0 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/556cfdbd/Allura/allura/lib/helpers.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/helpers.py b/Allura/allura/lib/helpers.py
index d078072..5e32882 100644
--- a/Allura/allura/lib/helpers.py
+++ b/Allura/allura/lib/helpers.py
@@ -269,6 +269,12 @@ def ago(start_time):
 def ago_ts(timestamp):
     return ago(datetime.utcfromtimestamp(timestamp))
 
+def ago_string(s):
+    try:
+        return ago(parse(s, ignoretz=True))
+    except (ValueError, AttributeError):
+        return 'unknown'
+
 class DateTimeConverter(FancyValidator):
 
     def _to_python(self, value, state):

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/556cfdbd/Allura/allura/tests/test_helpers.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/test_helpers.py b/Allura/allura/tests/test_helpers.py
index 4eaa7ec..8407ef4 100644
--- a/Allura/allura/tests/test_helpers.py
+++ b/Allura/allura/tests/test_helpers.py
@@ -94,6 +94,10 @@ def test_ago():
     import time
     assert_equals(h.ago(datetime.utcnow() - timedelta(days=2)), '2 days ago')
     assert_equals(h.ago_ts(time.time() - 60*60*2), '2 hours ago')
+    d_str = (datetime.utcnow() - timedelta(hours=3)).isoformat()
+    assert_equals(h.ago_string(d_str), '3 hours ago')
+    assert_equals(h.ago_string('bad format'), 'unknown')
+    assert_equals(h.ago_string(None), 'unknown')
 
 def test_urlquote_unicode():
     # No exceptions please


[14/22] git commit: [#2835] ticket:288 Get rid of placeholders

Posted by br...@apache.org.
[#2835] ticket:288 Get rid of placeholders


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

Branch: refs/heads/master
Commit: 978b241023327b2d67b2c3343ee1494ff8283cbe
Parents: cd839bb
Author: Igor Bondarenko <je...@gmail.com>
Authored: Fri Mar 8 11:30:51 2013 +0000
Committer: Dave Brondsema <db...@geek.net>
Committed: Tue Mar 26 20:57:37 2013 +0000

----------------------------------------------------------------------
 .../allura/templates/widgets/search_results.html   |    4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/978b2410/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 4cfc891..997b5ec 100644
--- a/Allura/allura/templates/widgets/search_results.html
+++ b/Allura/allura/templates/widgets/search_results.html
@@ -43,8 +43,6 @@
     {% if doc['type_s'] %}<span class="gray"><sup>{{ '(%s)' % doc['type_s'] }}</sup></span>{% endif %}
     <br>
     {{ doc.snippet }}
-    TODO: change me to something useful! Mark <strong>matches</strong>.<br/>
-    an open source implementation of a software "forge", <strong>a web site</strong> that manages source code repositories, bug reports, discussions, mailing lists, wiki pages, blogs and more for any number of individual proje<br>
     <span class="gray">Last updated: {{ h.ago_string(doc['mod_date_dt']) }}</span>
     </p>
   </div>
@@ -55,5 +53,5 @@
 </div>
 <div class="grid-19" style="clear:both">
   {# TODO: highlight active sorting order #}
-  <p>Sort by <a href="#"><strong>relevance</strong></a> or <a href="#">date</a></p>
+  {# <p>Sort by <a href="#"><strong>relevance</strong></a> or <a href="#">date</a></p> #}
 </div>


[21/22] git commit: [#2835] ticket:303 Get rid of `title_s`, use `title` instead

Posted by br...@apache.org.
[#2835] ticket:303 Get rid of `title_s`, use `title` instead


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

Branch: refs/heads/master
Commit: f211493fef93814cbbe27209e5346e339bdc9d4a
Parents: 186cf48
Author: Igor Bondarenko <je...@gmail.com>
Authored: Fri Mar 15 10:46:49 2013 +0000
Committer: Dave Brondsema <db...@geek.net>
Committed: Tue Mar 26 20:57:39 2013 +0000

----------------------------------------------------------------------
 Allura/allura/lib/helpers.py                       |   12 ++++++++++++
 Allura/allura/model/artifact.py                    |   11 +++++------
 Allura/allura/model/discuss.py                     |    6 +++---
 Allura/allura/model/notification.py                |    6 +++---
 Allura/allura/model/repository.py                  |    4 ++--
 Allura/allura/templates/search_index.html          |    2 +-
 .../allura/templates/widgets/search_results.html   |    2 +-
 Allura/allura/tests/model/test_artifact.py         |    2 +-
 Allura/allura/tests/model/test_discussion.py       |    2 +-
 Allura/allura/tests/test_helpers.py                |    9 +++++++++
 ForgeBlog/forgeblog/model/blog.py                  |    4 ++--
 ForgeBlog/forgeblog/templates/blog/search.html     |    2 +-
 ForgeChat/forgechat/command.py                     |    2 +-
 ForgeChat/forgechat/templates/chat/search.html     |    2 +-
 ForgeShortUrl/forgeshorturl/model/shorturl.py      |    2 +-
 ForgeTracker/forgetracker/model/ticket.py          |    4 ++--
 ForgeWiki/forgewiki/model/wiki.py                  |    2 --
 17 files changed, 46 insertions(+), 28 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/f211493f/Allura/allura/lib/helpers.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/helpers.py b/Allura/allura/lib/helpers.py
index 5e32882..eeee7bc 100644
--- a/Allura/allura/lib/helpers.py
+++ b/Allura/allura/lib/helpers.py
@@ -652,3 +652,15 @@ def get_tool_package(tool_name):
     "Return package for given tool (e.g. 'forgetracker' for 'tickets')"
     app = g.entry_points['tool'].get(tool_name.lower())
     return app.__module__.split('.')[0] if app else ''
+
+
+def get_first(d, key):
+    """Return value for d[key][0] if d[key] is a list with elements, else return d[key].
+
+    Useful to retrieve values from solr index (e.g. `title` and `text` fields),
+    which are stored as lists.
+    """
+    v = d.get(key)
+    if isinstance(v, list):
+        return v[0] if len(v) > 0 else None
+    return v

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/f211493f/Allura/allura/model/artifact.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/artifact.py b/Allura/allura/model/artifact.py
index 95da7dd..aa3ddfa 100644
--- a/Allura/allura/model/artifact.py
+++ b/Allura/allura/model/artifact.py
@@ -212,7 +212,7 @@ class Artifact(MappedClass):
 
         The _s and _t suffixes, for example, follow solr dynamic field naming
         pattern.
-        You probably want to override at least title, title_s and text to have
+        You probably want to override at least title and text to have
         meaningful search results and email senders.
         """
 
@@ -220,7 +220,6 @@ class Artifact(MappedClass):
         return dict(
             id=self.index_id(),
             mod_date_dt=self.mod_date,
-            title_s='Artifact %s' % self._id,
             title='Artifact %s' % self._id,
             project_id_s=str(project._id),
             project_name_t=project.name,
@@ -268,7 +267,7 @@ class Artifact(MappedClass):
             t = Thread.new(
                 discussion_id=self.app_config.discussion_id,
                 ref_id=idx['id'],
-                subject='%s discussion' % idx['title_s'])
+                subject='%s discussion' % h.get_first(idx, 'title'))
         parent_id = None
         if data:
             in_reply_to = data.get('in_reply_to', [])
@@ -316,8 +315,8 @@ class Snapshot(Artifact):
         if original:
             original_index = original.index()
             result.update(original_index)
-            result['title_s'] = 'Version %d of %s' % (
-                    self.version, original_index['title_s'])
+            result['title'] = 'Version %d of %s' % (
+                    self.version, h.get_first(original_index, 'title'))
         result.update(
             id=self.index_id(),
             version_i=self.version,
@@ -640,7 +639,7 @@ class Feed(MappedClass):
         if author_name is None:
             author_name = author.get_pref('display_name')
         if title is None:
-            title='%s modified by %s' % (idx['title_s'], author_name)
+            title='%s modified by %s' % (h.get_first(idx, 'title'), author_name)
         if description is None: description = title
         if pubdate is None:
             pubdate = datetime.utcnow()

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/f211493f/Allura/allura/model/discuss.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/discuss.py b/Allura/allura/model/discuss.py
index 9d26242..2ea6f4c 100644
--- a/Allura/allura/model/discuss.py
+++ b/Allura/allura/model/discuss.py
@@ -90,7 +90,7 @@ class Discussion(Artifact, ActivityObject):
     def index(self):
         result = Artifact.index(self)
         result.update(
-            title_s='Discussion: %s' % self.name,
+            title='Discussion: %s' % self.name,
             name_s=self.name,
             text=self.description)
         return result
@@ -339,7 +339,7 @@ class Thread(Artifact, ActivityObject):
     def index(self):
         result = Artifact.index(self)
         result.update(
-           title_s='Thread: %s' % (self.subject or '(no subject)'),
+           title='Thread: %s' % (self.subject or '(no subject)'),
            name_s=self.subject,
            views_i=self.num_views,
            text=self.subject)
@@ -459,7 +459,7 @@ class Post(Message, VersionedArtifact, ActivityObject):
     def index(self):
         result = super(Post, self).index()
         result.update(
-            title_s='Post by %s on %s' % (
+            title='Post by %s on %s' % (
                 self.author().username, self.subject),
             name_s=self.subject,
             type_s='Post',

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/f211493f/Allura/allura/model/notification.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/notification.py b/Allura/allura/model/notification.py
index 7003e29..c9b1e35 100644
--- a/Allura/allura/model/notification.py
+++ b/Allura/allura/model/notification.py
@@ -153,9 +153,9 @@ class Notification(MappedClass):
             return n
         else:
             subject = kwargs.pop('subject', '%s modified by %s' % (
-                    idx['title_s'],c.user.get_pref('display_name')))
+                    h.get_first(idx, 'title'),c.user.get_pref('display_name')))
             reply_to = '"%s" <%s>' % (
-                idx['title_s'],
+                h.get_first(idx, 'title'),
                 getattr(artifact, 'email_address', u'noreply@in.sf.net'))
             d = dict(
                 from_address=reply_to,
@@ -355,7 +355,7 @@ class Mailbox(MappedClass):
             artifact_index_id = None
         else:
             i = artifact.index()
-            artifact_title = i['title_s']
+            artifact_title = h.get_first(i, 'title')
             artifact_url = artifact.url()
             artifact_index_id = i['id']
             artifact_already_subscribed = cls.query.get(user_id=user_id,

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/f211493f/Allura/allura/model/repository.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/repository.py b/Allura/allura/model/repository.py
index f822cc2..d6f843d 100644
--- a/Allura/allura/model/repository.py
+++ b/Allura/allura/model/repository.py
@@ -426,7 +426,7 @@ class Repository(Artifact, ActivityObject):
         result.update(
             name_s=self.name,
             type_s=self.type_s,
-            title_s='Repository %s %s' % (self.project.name, self.name))
+            title='Repository %s %s' % (self.project.name, self.name))
         return result
 
     @property
@@ -614,7 +614,7 @@ class MergeRequest(VersionedArtifact, ActivityObject):
         result.update(
             name_s='Merge Request #%d' % self.request_number,
             type_s=self.type_s,
-            title_s='Merge Request #%d of %s:%s' % (
+            title='Merge Request #%d of %s:%s' % (
                 self.request_number, self.project.name, self.app.repo.name))
         return result
 

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/f211493f/Allura/allura/templates/search_index.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/search_index.html b/Allura/allura/templates/search_index.html
index 52033d8..6fd2107 100644
--- a/Allura/allura/templates/search_index.html
+++ b/Allura/allura/templates/search_index.html
@@ -27,7 +27,7 @@
   <ol>
   {% for doc in results %}
   <li>
-    <a href="{{doc['url_s']}}">{{doc.title_s}}</a>
+    <a href="{{doc['url_s']}}">{{h.get_first(doc, 'title')}}</a>
     {% if doc.get('snippet') %}
       <p>{{doc['snippet']|safe}}</p>
     {% endif %}

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/f211493f/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 b5b0c5a..d1067cc 100644
--- a/Allura/allura/templates/widgets/search_results.html
+++ b/Allura/allura/templates/widgets/search_results.html
@@ -41,7 +41,7 @@
   <div class="grid-19">
     {# TODO: mark matches in title and snippet #}
     <p>
-    <a href="{{doc['url_paginated'] or doc['url_s']}}">{{ doc.title_s }}</a>
+    <a href="{{doc['url_paginated'] or doc['url_s']}}">{{ h.get_first(doc, 'title') }}</a>
     {% if doc['type_s'] %}<span class="gray"><sup>{{ '(%s)' % doc['type_s'] }}</sup></span>{% endif %}
     <br>
     {{ doc.snippet }}

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/f211493f/Allura/allura/tests/model/test_artifact.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/model/test_artifact.py b/Allura/allura/tests/model/test_artifact.py
index 0ad9d49..ec02de9 100644
--- a/Allura/allura/tests/model/test_artifact.py
+++ b/Allura/allura/tests/model/test_artifact.py
@@ -72,7 +72,7 @@ def test_artifact():
     c.memoize_cache = {}
     assert not security.has_access(pg, 'delete')(user=u)
     idx = pg.index()
-    assert 'title_s' in idx
+    assert 'title' in idx
     assert 'url_s' in idx
     assert 'project_id_s' in idx
     assert 'mount_point_s' in idx

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/f211493f/Allura/allura/tests/model/test_discussion.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/model/test_discussion.py b/Allura/allura/tests/model/test_discussion.py
index 861f665..7efe0c9 100644
--- a/Allura/allura/tests/model/test_discussion.py
+++ b/Allura/allura/tests/model/test_discussion.py
@@ -137,7 +137,7 @@ def test_post_methods():
     assert p.link_text() == p.subject
 
     ss = p.history().first()
-    assert 'Version' in ss.index()['title_s']
+    assert 'Version' in h.get_first(ss.index(), 'title')
     assert '#' in ss.shorthand_id()
 
     jsn = p.__json__()

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/f211493f/Allura/allura/tests/test_helpers.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/test_helpers.py b/Allura/allura/tests/test_helpers.py
index 8407ef4..4829549 100644
--- a/Allura/allura/tests/test_helpers.py
+++ b/Allura/allura/tests/test_helpers.py
@@ -167,3 +167,12 @@ def test_get_tool_package():
     assert h.get_tool_package('tickets') == 'forgetracker'
     assert h.get_tool_package('Wiki') == 'forgewiki'
     assert h.get_tool_package('wrong_tool') == ''
+
+
+def test_get_first():
+    assert_equals(h.get_first({}, 'title'), None)
+    assert_equals(h.get_first({'title': None}, 'title'), None)
+    assert_equals(h.get_first({'title': 'Value'}, 'title'), 'Value')
+    assert_equals(h.get_first({'title': ['Value']}, 'title'), 'Value')
+    assert_equals(h.get_first({'title': []}, 'title'), None)
+    assert_equals(h.get_first({'title': ['Value']}, 'title'), 'Value')

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/f211493f/ForgeBlog/forgeblog/model/blog.py
----------------------------------------------------------------------
diff --git a/ForgeBlog/forgeblog/model/blog.py b/ForgeBlog/forgeblog/model/blog.py
index a2dae6c..88e2204 100644
--- a/ForgeBlog/forgeblog/model/blog.py
+++ b/ForgeBlog/forgeblog/model/blog.py
@@ -57,7 +57,7 @@ class BlogPostSnapshot(M.Snapshot):
             return None
         result = super(BlogPostSnapshot, self).index()
         result.update(
-            title_s='Version %d of %s' % (
+            title='Version %d of %s' % (
                 self.version, orig.shorthand_id()),
             type_s=self.type_s,
             text=self.data.text)
@@ -184,7 +184,7 @@ class BlogPost(M.VersionedArtifact, ActivityObject):
     def index(self):
         result = super(BlogPost, self).index()
         result.update(
-            title_s=self.slug,
+            title=self.slug,
             type_s=self.type_s,
             state_s=self.state,
             snippet_s='%s: %s' % (self.title, h.text.truncate(self.text, 200)),

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/f211493f/ForgeBlog/forgeblog/templates/blog/search.html
----------------------------------------------------------------------
diff --git a/ForgeBlog/forgeblog/templates/blog/search.html b/ForgeBlog/forgeblog/templates/blog/search.html
index a4f7129..320f265 100644
--- a/ForgeBlog/forgeblog/templates/blog/search.html
+++ b/ForgeBlog/forgeblog/templates/blog/search.html
@@ -22,7 +22,7 @@
   {% endif %}
   {% for doc in results %}
   <div>
-    <div class="grid-19"><a href="{{doc['url_s']}}">{{doc.title_s}}</a></div>
+    <div class="grid-19"><a href="{{doc['url_s']}}">{{ h.get_first(doc, 'title') }}</a></div>
     <p>{{doc.get('snippet_s', '...')}}</p>
     <hr/>
   </div>

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/f211493f/ForgeChat/forgechat/command.py
----------------------------------------------------------------------
diff --git a/ForgeChat/forgechat/command.py b/ForgeChat/forgechat/command.py
index 13b00fc..2a20414 100644
--- a/ForgeChat/forgechat/command.py
+++ b/ForgeChat/forgechat/command.py
@@ -146,7 +146,7 @@ class IRCBot(asynchat.async_chat):
         art = lnk.ref.artifact
         if security.has_access(art, 'read', user=M.User.anonymous())():
             index = art.index()
-            text = index['snippet_s'] or index['title_s']
+            text = index['snippet_s'] or h.get_first(index, 'title')
             url = urljoin(tg.config.get('base_url', 'http://sourceforge.net'), index['url_s'])
             self.notice(rcpt, '[%s] - [%s](%s)' % (lnk.link, text,url))
 

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/f211493f/ForgeChat/forgechat/templates/chat/search.html
----------------------------------------------------------------------
diff --git a/ForgeChat/forgechat/templates/chat/search.html b/ForgeChat/forgechat/templates/chat/search.html
index debc1ec..bd64d04 100644
--- a/ForgeChat/forgechat/templates/chat/search.html
+++ b/ForgeChat/forgechat/templates/chat/search.html
@@ -24,7 +24,7 @@
 
   {% for doc in results %}
   <div class="grid-19">
-    <a href="{{doc['url_s']}}">{{doc.title_s}}</a><br/>
+    <a href="{{doc['url_s']}}">{{ h.get_first(doc, 'title') }}</a><br/>
     <pre>{{doc|pprint}}</pre>
     <hr/>
   </div>

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/f211493f/ForgeShortUrl/forgeshorturl/model/shorturl.py
----------------------------------------------------------------------
diff --git a/ForgeShortUrl/forgeshorturl/model/shorturl.py b/ForgeShortUrl/forgeshorturl/model/shorturl.py
index 7e550b7..f38894a 100644
--- a/ForgeShortUrl/forgeshorturl/model/shorturl.py
+++ b/ForgeShortUrl/forgeshorturl/model/shorturl.py
@@ -45,7 +45,7 @@ class ShortUrl(M.Artifact):
             full_url_s=self.full_url,
             short_name_s=self.short_name,
             description_s=self.description,
-            title_s='%s => %s' % (self.url(), self.full_url),
+            title='%s => %s' % (self.url(), self.full_url),
             private_b=self.private,
             type_s=self.type_s)
         return result

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/f211493f/ForgeTracker/forgetracker/model/ticket.py
----------------------------------------------------------------------
diff --git a/ForgeTracker/forgetracker/model/ticket.py b/ForgeTracker/forgetracker/model/ticket.py
index db7113a..1abeaac 100644
--- a/ForgeTracker/forgetracker/model/ticket.py
+++ b/ForgeTracker/forgetracker/model/ticket.py
@@ -206,7 +206,7 @@ class TicketHistory(Snapshot):
             return None
         result = Snapshot.index(self)
         result.update(
-            title_s='Version %d of %s' % (
+            title='Version %d of %s' % (
                 self.version, orig.summary),
             type_s='Ticket Snapshot',
             text=self.data.summary)
@@ -303,7 +303,7 @@ class Ticket(VersionedArtifact, ActivityObject, VotableArtifact):
     def index(self):
         result = VersionedArtifact.index(self)
         result.update(
-            title_s='Ticket %s' % self.ticket_num,
+            title='Ticket %s' % self.ticket_num,
             version_i=self.version,
             type_s=self.type_s,
             ticket_num_i=self.ticket_num,

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/f211493f/ForgeWiki/forgewiki/model/wiki.py
----------------------------------------------------------------------
diff --git a/ForgeWiki/forgewiki/model/wiki.py b/ForgeWiki/forgewiki/model/wiki.py
index c477b91..816a5ee 100644
--- a/ForgeWiki/forgewiki/model/wiki.py
+++ b/ForgeWiki/forgewiki/model/wiki.py
@@ -48,7 +48,6 @@ class PageHistory(Snapshot):
         result = Snapshot.index(self)
         title = '%s (version %d)' % (self.original().title, self.version)
         result.update(
-            title_s=title,
             title=title,
             type_s='WikiPage Snapshot',
             text=self.data.text)
@@ -130,7 +129,6 @@ class Page(VersionedArtifact, ActivityObject):
     def index(self):
         result = VersionedArtifact.index(self)
         result.update(
-            title_s=self.title,
             title=self.title,
             version_i=self.version,
             type_s='WikiPage',


[16/22] git commit: [#2835] ticket:288 Fix failing tests due to changes in wiki pages indexation

Posted by br...@apache.org.
[#2835] ticket:288 Fix failing tests due to changes in wiki pages indexation


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

Branch: refs/heads/master
Commit: 88d7b8256deb5ea2e75812eb632a1378c63c4b54
Parents: 01c9d1c
Author: Igor Bondarenko <je...@gmail.com>
Authored: Fri Mar 8 12:05:29 2013 +0000
Committer: Dave Brondsema <db...@geek.net>
Committed: Tue Mar 26 20:57:38 2013 +0000

----------------------------------------------------------------------
 .../allura/tests/functional/test_user_profile.py   |    2 +-
 Allura/allura/tests/model/test_notification.py     |    4 ++--
 Allura/allura/tests/test_globals.py                |    4 ++--
 3 files changed, 5 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/88d7b825/Allura/allura/tests/functional/test_user_profile.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/functional/test_user_profile.py b/Allura/allura/tests/functional/test_user_profile.py
index fcea8b4..1589a2b 100644
--- a/Allura/allura/tests/functional/test_user_profile.py
+++ b/Allura/allura/tests/functional/test_user_profile.py
@@ -38,4 +38,4 @@ class TestUserProfile(TestController):
     def test_feed(self):
         response = self.app.get('/u/test-admin/profile/feed')
         assert 'Recent posts by Test Admin' in response
-        assert 'WikiPage Home modified by Test Admin' in response
+        assert 'Home modified by Test Admin' in response

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/88d7b825/Allura/allura/tests/model/test_notification.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/model/test_notification.py b/Allura/allura/tests/model/test_notification.py
index 92e244f..f8f8afb 100644
--- a/Allura/allura/tests/model/test_notification.py
+++ b/Allura/allura/tests/model/test_notification.py
@@ -81,7 +81,7 @@ class TestPostNotifications(unittest.TestCase):
         flash_msgs = list(h.pop_user_notifications(u))
         assert len(flash_msgs) == 1, flash_msgs
         msg = flash_msgs[0]
-        assert msg['text'].startswith('WikiPage Home modified by Test Admin')
+        assert msg['text'].startswith('Home modified by Test Admin')
         assert msg['subject'].startswith('[test:wiki]')
         flash_msgs = list(h.pop_user_notifications(u))
         assert not flash_msgs, flash_msgs
@@ -124,7 +124,7 @@ class TestPostNotifications(unittest.TestCase):
         assert_in(str(user2._id), first_destinations)
         assert_equal(email_tasks[0].kwargs['fromaddr'], '"Test Admin" <te...@users.localhost>')
         assert_equal(email_tasks[1].kwargs['fromaddr'], '"Test Admin" <te...@users.localhost>')
-        assert email_tasks[0].kwargs['text'].startswith('WikiPage Home modified by Test Admin')
+        assert email_tasks[0].kwargs['text'].startswith('Home modified by Test Admin')
         assert 'you indicated interest in ' in email_tasks[0].kwargs['text']
 
     def test_permissions(self):

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/88d7b825/Allura/allura/tests/test_globals.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/test_globals.py b/Allura/allura/tests/test_globals.py
index 493787c..7ad940e 100644
--- a/Allura/allura/tests/test_globals.py
+++ b/Allura/allura/tests/test_globals.py
@@ -126,7 +126,7 @@ def test_macros():
     assert_equal(r, '<div class="markdown_content"><p><span class="download-button-%s" style="margin-bottom: 1em; display: block;"></span></p>\n</div>' % p_test._id)
     h.set_context('--init--', 'wiki', neighborhood='Projects')
     r = g.markdown_wiki.convert('[[neighborhood_feeds tool_name=Wiki]]')
-    assert 'WikiPage Home modified by' in r, r
+    assert 'Home modified by' in r, r
     orig_len = len(r)
     # Make project private & verify we don't see its new feed items
     proj = M.Project.query.get(shortname='test', neighborhood_id=p_nbhd._id)
@@ -316,7 +316,7 @@ def test_macro_include():
 def test_macro_nbhd_feeds():
     with h.push_context('--init--', 'wiki', neighborhood='Projects'):
         r = g.markdown_wiki.convert('[[neighborhood_feeds tool_name=Wiki]]')
-        assert 'WikiPage Home modified by ' in r, r
+        assert 'Home modified by ' in r, r
 
 
 def test_sort_alpha():


[18/22] git commit: [#2835] ticket:303 Comment out help button

Posted by br...@apache.org.
[#2835] ticket:303 Comment out help button


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

Branch: refs/heads/master
Commit: 975b2093be08a993d17f55c9cdb246cb73d20ee6
Parents: fa1d3af
Author: Igor Bondarenko <je...@gmail.com>
Authored: Fri Mar 15 08:47:22 2013 +0000
Committer: Dave Brondsema <db...@geek.net>
Committed: Tue Mar 26 20:57:38 2013 +0000

----------------------------------------------------------------------
 .../allura/templates/widgets/search_results.html   |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/975b2093/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 997b5ec..b5b0c5a 100644
--- a/Allura/allura/templates/widgets/search_results.html
+++ b/Allura/allura/templates/widgets/search_results.html
@@ -6,10 +6,12 @@
     <input type="submit" value="Search">
   </div>
   <div class="grid-6">
+    {# TODO: when help text provided, show button
     <a href="#" class="btn search_help_modal">
       <b data-icon="{{g.icons['help'].char}}" class="ico {{g.icons['help'].css}}"></b>
       Help
     </a>
+    #}
   </div>
   <div class="grid-10">
     {% set search_project = request.GET['project'] == '1' %}


[03/22] git commit: [#2835] ticket:287 Search results styles (with stubs for some data)

Posted by br...@apache.org.
[#2835] ticket:287 Search results styles (with stubs for some data)


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

Branch: refs/heads/master
Commit: 86bd80f7294bbf034afee92d937fbeaa37e6ab07
Parents: b7f967d
Author: Igor Bondarenko <je...@gmail.com>
Authored: Tue Mar 5 13:07:15 2013 +0000
Committer: Dave Brondsema <db...@geek.net>
Committed: Tue Mar 26 20:57:34 2013 +0000

----------------------------------------------------------------------
 Allura/allura/lib/widgets/resources/css/search.css |    4 ++++
 .../allura/templates/widgets/search_results.html   |   13 ++++++++-----
 2 files changed, 12 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/86bd80f7/Allura/allura/lib/widgets/resources/css/search.css
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/widgets/resources/css/search.css b/Allura/allura/lib/widgets/resources/css/search.css
index 16b792a..8d4f308 100644
--- a/Allura/allura/lib/widgets/resources/css/search.css
+++ b/Allura/allura/lib/widgets/resources/css/search.css
@@ -1,3 +1,7 @@
 input.search-query {
   width: 95%;
 }
+
+.date {
+  color: #aaa;
+}

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/86bd80f7/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 6700c48..0b1fcdf 100644
--- a/Allura/allura/templates/widgets/search_results.html
+++ b/Allura/allura/templates/widgets/search_results.html
@@ -36,12 +36,15 @@
 </div>
 {% for doc in results %}
   <div class="grid-19">
-    <a href="{{doc['url_paginated'] or doc['url_s']}}">{{doc.title_s}}</a><br>
-    {% if doc.get('snippet') %}
-      <p>{{doc.snippet}}</p>
-    {% endif %}
+    {# TODO: mark matches in title and snippet #}
+    <p>
+    <a href="{{doc['url_paginated'] or doc['url_s']}}">{{ doc.title_s }}</a><br>
+    {{ doc.snippet }}
+    TODO: change me to something useful! Mark <strong>matches</strong>.<br/>
+    an open source implementation of a software "forge", <strong>a web site</strong> that manages source code repositories, bug reports, discussions, mailing lists, wiki pages, blogs and more for any number of individual proje<br>
+    <span class="date">Last updated: {{ doc['mod_date_dt'] }}</span>
+    </p>
   </div>
-  <hr>
 {% endfor %}
 <div class="grid-19" style="clear:both">
   {{widget.fields['page_list'].display(limit=limit, page=page, count=count)}}


[05/22] git commit: [#2835] ticket:287 Use radiobuttons for searching app/project

Posted by br...@apache.org.
[#2835] ticket:287 Use radiobuttons for searching app/project


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

Branch: refs/heads/master
Commit: aaa1e453a5c3533c316d0d37416d8a2459d042b3
Parents: 4ab5bda
Author: Igor Bondarenko <je...@gmail.com>
Authored: Tue Mar 5 11:59:28 2013 +0000
Committer: Dave Brondsema <db...@geek.net>
Committed: Tue Mar 26 20:57:34 2013 +0000

----------------------------------------------------------------------
 .../allura/templates/widgets/search_results.html   |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/aaa1e453/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 d6811a6..bc1cfdc 100644
--- a/Allura/allura/templates/widgets/search_results.html
+++ b/Allura/allura/templates/widgets/search_results.html
@@ -11,12 +11,12 @@
       Help
     </a>
   </div>
-
-
-
   <div class="grid-19">
-    <input type="submit" value="Search App">
-    <input type="submit" name="project" value="Search Entire Project">
+    {% set search_project = request.GET['project'] == '1' %}
+    <input type="radio" name="project" value="0" id="search-app" {% if not search_project %}checked{% endif %}>
+    <label for="search-app">Search {{c.app.config.options.mount_point or 'app'}}</label>
+    <input type="radio" name="project" value="1" id="search-project" {% if search_project %}checked{% endif %}>
+    <label for="search-project">Search entire project</label>
   </div>
   <div class="grid-19">
     Search history? <input type="checkbox" name="history"{% if history %} checked="checked"{% endif %}/>