|
a/Allura/allura/controllers/search.py |
|
b/Allura/allura/controllers/search.py |
|
... |
|
... |
25 |
count=0
|
25 |
count=0
|
26 |
if not q:
|
26 |
if not q:
|
27 |
q = ''
|
27 |
q = ''
|
28 |
else:
|
28 |
else:
|
29 |
results = search.search(
|
29 |
results = search.search(
|
30 |
q,
|
30 |
q,
|
31 |
fq='is_history_b:%s' % history)
|
31 |
fq='is_history_b:%s' % history)
|
32 |
if results: count=results.hits
|
32 |
if results: count=results.hits
|
33 |
return dict(q=q, history=history, results=results or [], count=count)
|
33 |
return dict(q=q, history=history, results=results or [], count=count)
|
34 |
|
34 |
|
35 |
|
35 |
|
|
... |
|
... |
43 |
self.category = M.ProjectCategory.query.find(dict(name=category_name,parent_id=parent_id)).first()
|
43 |
self.category = M.ProjectCategory.query.find(dict(name=category_name,parent_id=parent_id)).first()
|
44 |
if not self.category:
|
44 |
if not self.category:
|
45 |
raise exc.HTTPNotFound, request.path
|
45 |
raise exc.HTTPNotFound, request.path
|
46 |
else:
|
46 |
else:
|
47 |
self.category = None
|
47 |
self.category = None
|
48 |
|
48 |
|
49 |
def _build_title(self):
|
49 |
def _build_title(self):
|
50 |
title = "All Projects"
|
50 |
title = "All Projects"
|
51 |
if self.category:
|
51 |
if self.category:
|
52 |
title = self.category.label
|
52 |
title = self.category.label
|
53 |
if self.parent_category:
|
53 |
if self.parent_category:
|
|
... |
|
... |
57 |
def _build_nav(self):
|
57 |
def _build_nav(self):
|
58 |
categories = M.ProjectCategory.query.find({'parent_id':None}).sort('name').all()
|
58 |
categories = M.ProjectCategory.query.find({'parent_id':None}).sort('name').all()
|
59 |
nav = []
|
59 |
nav = []
|
60 |
for cat in categories:
|
60 |
for cat in categories:
|
61 |
nav.append(SitemapEntry(
|
61 |
nav.append(SitemapEntry(
|
62 |
cat.label,
|
62 |
cat.label,
|
63 |
self.nav_stub+cat.name,
|
63 |
self.nav_stub+cat.name,
|
64 |
className='nav_child'))
|
64 |
className='nav_child'))
|
65 |
if (self.category and self.category._id == cat._id and cat.subcategories) or (
|
65 |
if (self.category and self.category._id == cat._id and cat.subcategories) or (
|
66 |
self.parent_category and self.parent_category._id == cat._id):
|
66 |
self.parent_category and self.parent_category._id == cat._id):
|
67 |
for subcat in cat.subcategories:
|
67 |
for subcat in cat.subcategories:
|
68 |
nav.append(SitemapEntry(
|
68 |
nav.append(SitemapEntry(
|
69 |
subcat.label,
|
69 |
subcat.label,
|
70 |
self.nav_stub+cat.name+'/'+subcat.name,
|
70 |
self.nav_stub+cat.name+'/'+subcat.name,
|
71 |
className='nav_child2'))
|
71 |
className='nav_child2'))
|
72 |
return nav
|
72 |
return nav
|
73 |
|
73 |
|
74 |
def _find_projects(self,sort='alpha', limit=None, start=0):
|
74 |
def _find_projects(self,sort='alpha', limit=None, start=0):
|
75 |
if self.category:
|
75 |
if self.category:
|