|
a/Allura/allura/lib/macro.py |
|
b/Allura/allura/lib/macro.py |
|
... |
|
... |
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, show_awards_banner=True,
|
137 |
columns=1, show_proj_icon=True, show_download_button=True, show_awards_banner=True,
|
|
|
138 |
grid_view_tools='',
|
138 |
initial_q={}):
|
139 |
initial_q={}):
|
139 |
from allura.lib.widgets.project_list import ProjectList
|
140 |
from allura.lib.widgets.project_list import ProjectList
|
140 |
from allura.lib import utils
|
141 |
from allura.lib import utils
|
141 |
from allura import model as M
|
142 |
from allura import model as M
|
142 |
# 'trove' is internal substitution for 'category' filter in wiki macro
|
143 |
# 'trove' is internal substitution for 'category' filter in wiki macro
|
|
... |
|
... |
218 |
pl = ProjectList()
|
219 |
pl = ProjectList()
|
219 |
g.resource_manager.register(pl)
|
220 |
g.resource_manager.register(pl)
|
220 |
response = pl.display(projects=projects, display_mode=display_mode,
|
221 |
response = pl.display(projects=projects, display_mode=display_mode,
|
221 |
columns=columns, show_proj_icon=show_proj_icon,
|
222 |
columns=columns, show_proj_icon=show_proj_icon,
|
222 |
show_download_button=show_download_button,
|
223 |
show_download_button=show_download_button,
|
223 |
show_awards_banner=show_awards_banner)
|
224 |
show_awards_banner=show_awards_banner,
|
|
|
225 |
grid_view_tools=grid_view_tools)
|
224 |
if show_total:
|
226 |
if show_total:
|
225 |
if total is None:
|
227 |
if total is None:
|
226 |
total = 0
|
228 |
total = 0
|
227 |
for p in M.Project.query.find(q):
|
229 |
for p in M.Project.query.find(q):
|
228 |
if h.has_access(p, 'read')():
|
230 |
if h.has_access(p, 'read')():
|
|
... |
|
... |
233 |
|
235 |
|
234 |
|
236 |
|
235 |
@macro('neighborhood-wiki')
|
237 |
@macro('neighborhood-wiki')
|
236 |
def projects(category=None, display_mode='grid', sort='last_updated',
|
238 |
def projects(category=None, display_mode='grid', sort='last_updated',
|
237 |
show_total=False, limit=100, labels='', award='', private=False,
|
239 |
show_total=False, limit=100, labels='', award='', private=False,
|
238 |
columns=1, show_proj_icon=True, show_download_button=True, show_awards_banner=True):
|
240 |
columns=1, show_proj_icon=True, show_download_button=True, show_awards_banner=True,
|
|
|
241 |
grid_view_tools=''):
|
239 |
initial_q = dict(neighborhood_id=c.project.neighborhood_id)
|
242 |
initial_q = dict(neighborhood_id=c.project.neighborhood_id)
|
240 |
return get_projects_for_macro(category=category, display_mode=display_mode, sort=sort,
|
243 |
return get_projects_for_macro(category=category, display_mode=display_mode, sort=sort,
|
241 |
show_total=show_total, limit=limit, labels=labels, award=award, private=private,
|
244 |
show_total=show_total, limit=limit, labels=labels, award=award, private=private,
|
242 |
columns=columns, show_proj_icon=show_proj_icon, show_download_button=show_download_button,
|
245 |
columns=columns, show_proj_icon=show_proj_icon, show_download_button=show_download_button,
|
243 |
show_awards_banner=show_awards_banner,
|
246 |
show_awards_banner=show_awards_banner, grid_view_tools=grid_view_tools,
|
244 |
initial_q=initial_q)
|
247 |
initial_q=initial_q)
|
245 |
|
248 |
|
246 |
@macro('userproject-wiki')
|
249 |
@macro('userproject-wiki')
|
247 |
def my_projects(category=None, display_mode='grid', sort='last_updated',
|
250 |
def my_projects(category=None, display_mode='grid', sort='last_updated',
|
248 |
show_total=False, limit=100, labels='', award='', private=False,
|
251 |
show_total=False, limit=100, labels='', award='', private=False,
|
249 |
columns=1, show_proj_icon=True, show_download_button=True, show_awards_banner=True):
|
252 |
columns=1, show_proj_icon=True, show_download_button=True, show_awards_banner=True,
|
|
|
253 |
grid_view_tools=''):
|
250 |
|
254 |
|
251 |
myproj_user = c.project.user_project_of
|
255 |
myproj_user = c.project.user_project_of
|
252 |
if myproj_user is None:
|
256 |
if myproj_user is None:
|
253 |
myproj_user = c.user.anonymous()
|
257 |
myproj_user = c.user.anonymous()
|
254 |
|
258 |
|
|
... |
|
... |
258 |
|
262 |
|
259 |
initial_q = dict(_id={'$in': ids})
|
263 |
initial_q = dict(_id={'$in': ids})
|
260 |
return get_projects_for_macro(category=category, display_mode=display_mode, sort=sort,
|
264 |
return get_projects_for_macro(category=category, display_mode=display_mode, sort=sort,
|
261 |
show_total=show_total, limit=limit, labels=labels, award=award, private=private,
|
265 |
show_total=show_total, limit=limit, labels=labels, award=award, private=private,
|
262 |
columns=columns, show_proj_icon=show_proj_icon, show_download_button=show_download_button,
|
266 |
columns=columns, show_proj_icon=show_proj_icon, show_download_button=show_download_button,
|
263 |
show_awards_banner=show_awards_banner,
|
267 |
show_awards_banner=show_awards_banner, grid_view_tools=grid_view_tools,
|
264 |
initial_q=initial_q)
|
268 |
initial_q=initial_q)
|
265 |
|
269 |
|
266 |
@macro()
|
270 |
@macro()
|
267 |
def project_screenshots():
|
271 |
def project_screenshots():
|
268 |
from allura.lib.widgets.project_list import ProjectScreenshots
|
272 |
from allura.lib.widgets.project_list import ProjectScreenshots
|