|
a/Allura/allura/lib/macro.py |
|
b/Allura/allura/lib/macro.py |
|
... |
|
... |
132 |
security.has_access(post.app.project, 'read', project=post.app.project)())
|
132 |
security.has_access(post.app.project, 'read', project=post.app.project)())
|
133 |
return output
|
133 |
return output
|
134 |
|
134 |
|
135 |
def get_projects_for_macro(category=None, display_mode='grid', sort='last_updated',
|
135 |
def get_projects_for_macro(category=None, display_mode='grid', sort='last_updated',
|
136 |
show_total=False, limit=100, labels='', award='', private=False,
|
136 |
show_total=False, limit=100, labels='', award='', private=False,
|
137 |
columns=1, show_proj_icon=True, show_download_button=True, macro_type='projects'):
|
137 |
columns=1, show_proj_icon=True, show_download_button=True, show_awards_banner=True,
|
|
|
138 |
macro_type='projects'):
|
138 |
from allura.lib.widgets.project_list import ProjectList
|
139 |
from allura.lib.widgets.project_list import ProjectList
|
139 |
from allura.lib import utils
|
140 |
from allura.lib import utils
|
140 |
from allura import model as M
|
141 |
from allura import model as M
|
141 |
# 'trove' is internal substitution for 'category' filter in wiki macro
|
142 |
# 'trove' is internal substitution for 'category' filter in wiki macro
|
142 |
trove = category
|
143 |
trove = category
|
|
... |
|
... |
248 |
|
249 |
|
249 |
pl = ProjectList()
|
250 |
pl = ProjectList()
|
250 |
g.resource_manager.register(pl)
|
251 |
g.resource_manager.register(pl)
|
251 |
response = pl.display(projects=projects, display_mode=display_mode,
|
252 |
response = pl.display(projects=projects, display_mode=display_mode,
|
252 |
columns=columns, show_proj_icon=show_proj_icon,
|
253 |
columns=columns, show_proj_icon=show_proj_icon,
|
253 |
show_download_button=show_download_button)
|
254 |
show_download_button=show_download_button,
|
|
|
255 |
show_awards_banner=show_awards_banner)
|
254 |
if show_total:
|
256 |
if show_total:
|
255 |
if total is None:
|
257 |
if total is None:
|
256 |
total = 0
|
258 |
total = 0
|
257 |
for p in M.Project.query.find(q):
|
259 |
for p in M.Project.query.find(q):
|
258 |
if h.has_access(p, 'read')():
|
260 |
if h.has_access(p, 'read')():
|
|
... |
|
... |
263 |
|
265 |
|
264 |
|
266 |
|
265 |
@macro('neighborhood-wiki')
|
267 |
@macro('neighborhood-wiki')
|
266 |
def projects(category=None, display_mode='grid', sort='last_updated',
|
268 |
def projects(category=None, display_mode='grid', sort='last_updated',
|
267 |
show_total=False, limit=100, labels='', award='', private=False,
|
269 |
show_total=False, limit=100, labels='', award='', private=False,
|
268 |
columns=1, show_proj_icon=True, show_download_button=True):
|
270 |
columns=1, show_proj_icon=True, show_download_button=True, show_awards_banner=True):
|
269 |
return get_projects_for_macro(category=category, display_mode=display_mode, sort=sort,
|
271 |
return get_projects_for_macro(category=category, display_mode=display_mode, sort=sort,
|
270 |
show_total=show_total, limit=limit, labels=labels, award=award, private=private,
|
272 |
show_total=show_total, limit=limit, labels=labels, award=award, private=private,
|
271 |
columns=columns, show_proj_icon=show_proj_icon, show_download_button=show_download_button,
|
273 |
columns=columns, show_proj_icon=show_proj_icon, show_download_button=show_download_button,
|
272 |
macro_type='projects')
|
274 |
show_awards_banner=show_awards_banner, macro_type='projects')
|
273 |
|
275 |
|
274 |
@macro()
|
276 |
@macro()
|
275 |
def my_projects(category=None, display_mode='grid', sort='last_updated',
|
277 |
def my_projects(category=None, display_mode='grid', sort='last_updated',
|
276 |
show_total=False, limit=100, labels='', award='', private=False,
|
278 |
show_total=False, limit=100, labels='', award='', private=False,
|
277 |
columns=1, show_proj_icon=True, show_download_button=True):
|
279 |
columns=1, show_proj_icon=True, show_download_button=True, show_awards_banner=True):
|
278 |
return get_projects_for_macro(category=category, display_mode=display_mode, sort=sort,
|
280 |
return get_projects_for_macro(category=category, display_mode=display_mode, sort=sort,
|
279 |
show_total=show_total, limit=limit, labels=labels, award=award, private=private,
|
281 |
show_total=show_total, limit=limit, labels=labels, award=award, private=private,
|
280 |
columns=columns, show_proj_icon=show_proj_icon, show_download_button=show_download_button,
|
282 |
columns=columns, show_proj_icon=show_proj_icon, show_download_button=show_download_button,
|
281 |
macro_type='my_projects')
|
283 |
show_awards_banner=show_awards_banner, macro_type='my_projects')
|
282 |
|
284 |
|
283 |
@macro()
|
285 |
@macro()
|
284 |
def project_screenshots():
|
286 |
def project_screenshots():
|
285 |
from allura.lib.widgets.project_list import ProjectScreenshots
|
287 |
from allura.lib.widgets.project_list import ProjectScreenshots
|
286 |
ps = ProjectScreenshots()
|
288 |
ps = ProjectScreenshots()
|