|
a/Allura/allura/lib/macro.py |
|
b/Allura/allura/lib/macro.py |
|
... |
|
... |
65 |
</div>
|
65 |
</div>
|
66 |
''')
|
66 |
''')
|
67 |
@macro('neighborhood-wiki')
|
67 |
@macro('neighborhood-wiki')
|
68 |
def neighborhood_feeds(tool_name, max_number=5, sort='pubdate'):
|
68 |
def neighborhood_feeds(tool_name, max_number=5, sort='pubdate'):
|
69 |
from allura import model as M
|
69 |
from allura import model as M
|
70 |
if not h.has_access(c.project.neighborhood, 'read'): return ''
|
70 |
feed = M.Feed.query.find(
|
71 |
max_number = int(max_number)
|
|
|
72 |
feed = M.Feed.items_with_access(
|
|
|
73 |
dict(
|
71 |
dict(
|
74 |
tool_name=tool_name,
|
72 |
tool_name=tool_name,
|
75 |
neighborhood_id=c.project.neighborhood._id),
|
73 |
neighborhood_id=c.project.neighborhood._id))
|
76 |
limit=max_number,
|
74 |
feed = feed.sort(sort, pymongo.DESCENDING).limit(int(max_number)).all()
|
77 |
sort=(sort, pymongo.DESCENDING))
|
75 |
output = '\n'.join(
|
78 |
items = [
|
|
|
79 |
template_neighborhood_feeds.substitute(dict(
|
76 |
template_neighborhood_feeds.substitute(dict(
|
80 |
href=item.link,
|
77 |
href=item.link,
|
81 |
title=item.title,
|
78 |
title=item.title,
|
82 |
author=item.author_name,
|
79 |
author=item.author_name,
|
83 |
ago=h.ago(item.pubdate),
|
80 |
ago=h.ago(item.pubdate),
|
84 |
description=item.description))
|
81 |
description=item.description))
|
85 |
for item in feed]
|
82 |
for item in feed)
|
86 |
return '\n'.join(items)
|
83 |
return output
|
87 |
|
84 |
|
88 |
@macro('neighborhood-wiki')
|
85 |
@macro('neighborhood-wiki')
|
89 |
def projects(
|
86 |
def projects(
|
90 |
category=None,
|
87 |
category=None,
|
91 |
display_mode='grid',
|
88 |
display_mode='grid',
|