Mercurial > kallithea
changeset 3847:bec04f371579 beta
Gist: added shortcut for my public gists
author | Marcin Kuzminski <marcin@python-works.com> |
---|---|
date | Sun, 12 May 2013 14:14:59 +0200 |
parents | 2576a20d94ca |
children | 832907f41ee6 |
files | rhodecode/controllers/admin/gists.py rhodecode/templates/admin/gists/index.html rhodecode/templates/base/base.html |
diffstat | 3 files changed, 10 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/rhodecode/controllers/admin/gists.py Sun May 12 00:41:38 2013 +0200 +++ b/rhodecode/controllers/admin/gists.py Sun May 12 14:14:59 2013 +0200 @@ -66,12 +66,18 @@ """GET /admin/gists: All items in the collection""" # url('gists') c.show_private = request.GET.get('private') and c.rhodecode_user.username != 'default' + c.show_public = request.GET.get('public') and c.rhodecode_user.username != 'default' + gists = Gist().query()\ .filter(or_(Gist.gist_expires == -1, Gist.gist_expires >= time.time()))\ .order_by(Gist.created_on.desc()) if c.show_private: c.gists = gists.filter(Gist.gist_type == Gist.GIST_PRIVATE)\ .filter(Gist.gist_owner == c.rhodecode_user.user_id) + elif c.show_public: + c.gists = gists.filter(Gist.gist_type == Gist.GIST_PUBLIC)\ + .filter(Gist.gist_owner == c.rhodecode_user.user_id) + else: c.gists = gists.filter(Gist.gist_type == Gist.GIST_PUBLIC) p = safe_int(request.GET.get('page', 1), 1)
--- a/rhodecode/templates/admin/gists/index.html Sun May 12 00:41:38 2013 +0200 +++ b/rhodecode/templates/admin/gists/index.html Sun May 12 14:14:59 2013 +0200 @@ -8,6 +8,8 @@ <%def name="breadcrumbs_links()"> %if c.show_private: ${_('Private Gists for user %s') % c.rhodecode_user.username} + %elif c.show_public: + ${_('Public Gists for user %s') % c.rhodecode_user.username} %else: ${_('Public Gists')} %endif
--- a/rhodecode/templates/base/base.html Sun May 12 00:41:38 2013 +0200 +++ b/rhodecode/templates/base/base.html Sun May 12 14:14:59 2013 +0200 @@ -292,8 +292,9 @@ </a> <ul class="admin_menu"> <li>${h.link_to(_('Create new gist'),h.url('new_gist'),class_='gists-new ')}</li> - <li>${h.link_to(_('Public gists'),h.url('gists'),class_='gists ')}</li> + <li>${h.link_to(_('All public gists'),h.url('gists'),class_='gists ')}</li> %if c.rhodecode_user.username != 'default': + <li>${h.link_to(_('My public gists'),h.url('gists', public=1),class_='gists')}</li> <li>${h.link_to(_('My private gists'),h.url('gists', private=1),class_='gists-private ')}</li> %endif </ul>