##// END OF EJS Templates
Gist: added shortcut for my public gists
marcink -
r3847:bec04f37 beta
parent child Browse files
Show More
@@ -66,12 +66,18 b' class GistsController(BaseController):'
66 """GET /admin/gists: All items in the collection"""
66 """GET /admin/gists: All items in the collection"""
67 # url('gists')
67 # url('gists')
68 c.show_private = request.GET.get('private') and c.rhodecode_user.username != 'default'
68 c.show_private = request.GET.get('private') and c.rhodecode_user.username != 'default'
69 c.show_public = request.GET.get('public') and c.rhodecode_user.username != 'default'
70
69 gists = Gist().query()\
71 gists = Gist().query()\
70 .filter(or_(Gist.gist_expires == -1, Gist.gist_expires >= time.time()))\
72 .filter(or_(Gist.gist_expires == -1, Gist.gist_expires >= time.time()))\
71 .order_by(Gist.created_on.desc())
73 .order_by(Gist.created_on.desc())
72 if c.show_private:
74 if c.show_private:
73 c.gists = gists.filter(Gist.gist_type == Gist.GIST_PRIVATE)\
75 c.gists = gists.filter(Gist.gist_type == Gist.GIST_PRIVATE)\
74 .filter(Gist.gist_owner == c.rhodecode_user.user_id)
76 .filter(Gist.gist_owner == c.rhodecode_user.user_id)
77 elif c.show_public:
78 c.gists = gists.filter(Gist.gist_type == Gist.GIST_PUBLIC)\
79 .filter(Gist.gist_owner == c.rhodecode_user.user_id)
80
75 else:
81 else:
76 c.gists = gists.filter(Gist.gist_type == Gist.GIST_PUBLIC)
82 c.gists = gists.filter(Gist.gist_type == Gist.GIST_PUBLIC)
77 p = safe_int(request.GET.get('page', 1), 1)
83 p = safe_int(request.GET.get('page', 1), 1)
@@ -8,6 +8,8 b''
8 <%def name="breadcrumbs_links()">
8 <%def name="breadcrumbs_links()">
9 %if c.show_private:
9 %if c.show_private:
10 ${_('Private Gists for user %s') % c.rhodecode_user.username}
10 ${_('Private Gists for user %s') % c.rhodecode_user.username}
11 %elif c.show_public:
12 ${_('Public Gists for user %s') % c.rhodecode_user.username}
11 %else:
13 %else:
12 ${_('Public Gists')}
14 ${_('Public Gists')}
13 %endif
15 %endif
@@ -292,8 +292,9 b''
292 </a>
292 </a>
293 <ul class="admin_menu">
293 <ul class="admin_menu">
294 <li>${h.link_to(_('Create new gist'),h.url('new_gist'),class_='gists-new ')}</li>
294 <li>${h.link_to(_('Create new gist'),h.url('new_gist'),class_='gists-new ')}</li>
295 <li>${h.link_to(_('Public gists'),h.url('gists'),class_='gists ')}</li>
295 <li>${h.link_to(_('All public gists'),h.url('gists'),class_='gists ')}</li>
296 %if c.rhodecode_user.username != 'default':
296 %if c.rhodecode_user.username != 'default':
297 <li>${h.link_to(_('My public gists'),h.url('gists', public=1),class_='gists')}</li>
297 <li>${h.link_to(_('My private gists'),h.url('gists', private=1),class_='gists-private ')}</li>
298 <li>${h.link_to(_('My private gists'),h.url('gists', private=1),class_='gists-private ')}</li>
298 %endif
299 %endif
299 </ul>
300 </ul>
General Comments 0
You need to be logged in to leave comments. Login now