##// END OF EJS Templates
Added repo group page showing what reposiories are inside a group
marcink -
r1193:52338254 beta
parent child Browse files
Show More
@@ -0,0 +1,121 b''
1 ## -*- coding: utf-8 -*-
2 <%inherit file="/base/base.html"/>
3
4 <%def name="title()">
5 ${_('Repository group')} - ${c.rhodecode_name}
6 </%def>
7
8
9 <%def name="breadcrumbs_links()">
10 ${_('Group')} &raquo; ${c.group.group_name} - ${_(' %s repositories' % c.repo_cnt)}
11 </%def>
12 <%def name="page_nav()">
13 ${self.menu('admin')}
14 </%def>
15 <%def name="main()">
16 <%def name="get_sort(name)">
17 <%name_slug = name.lower().replace(' ','_') %>
18
19 %if name_slug == c.sort_slug:
20 %if c.sort_by.startswith('-'):
21 <a href="?sort=${name_slug}">${name}&uarr;</a>
22 %else:
23 <a href="?sort=-${name_slug}">${name}&darr;</a>
24 %endif:
25 %else:
26 <a href="?sort=${name_slug}">${name}</a>
27 %endif
28 </%def>
29 <div class="box">
30 <!-- box / title -->
31 <div class="title">
32 ${self.breadcrumbs()}
33 </div>
34 <!-- end box / title -->
35 <div class="table">
36 <table>
37 <thead>
38 <tr>
39 <th class="left">${get_sort(_('Name'))}</th>
40 <th class="left">${get_sort(_('Description'))}</th>
41 <th class="left">${get_sort(_('Last change'))}</th>
42 <th class="left">${get_sort(_('Tip'))}</th>
43 <th class="left">${get_sort(_('Owner'))}</th>
44 <th class="left">${_('RSS')}</th>
45 <th class="left">${_('Atom')}</th>
46 </tr>
47 </thead>
48 <tbody>
49 %for cnt,repo in enumerate(c.repos_list):
50 <tr class="parity${cnt%2}">
51 <td>
52 <div style="white-space: nowrap">
53 ## TYPE OF REPO
54 %if repo['dbrepo']['repo_type'] =='hg':
55 <img class="icon" title="${_('Mercurial repository')}" alt="${_('Mercurial repository')}" src="${h.url("/images/icons/hgicon.png")}"/>
56 %elif repo['dbrepo']['repo_type'] =='git':
57 <img class="icon" title="${_('Git repository')}" alt="${_('Git repository')}" src="${h.url("/images/icons/giticon.png")}"/>
58 %else:
59
60 %endif
61
62 ##PRIVATE/PUBLIC
63 %if repo['dbrepo']['private']:
64 <img class="icon" title="${_('private repository')}" alt="${_('private repository')}" src="${h.url("/images/icons/lock.png")}"/>
65 %else:
66 <img class="icon" title="${_('public repository')}" alt="${_('public repository')}" src="${h.url("/images/icons/lock_open.png")}"/>
67 %endif
68
69 ##NAME
70 ${h.link_to(repo['name'],
71 h.url('summary_home',repo_name=repo['name']),class_="repo_name")}
72 %if repo['dbrepo_fork']:
73 <a href="${h.url('summary_home',repo_name=repo['dbrepo_fork']['repo_name'])}">
74 <img class="icon" alt="${_('fork')}"
75 title="${_('Fork of')} ${repo['dbrepo_fork']['repo_name']}"
76 src="${h.url("/images/icons/arrow_divide.png")}"/></a>
77 %endif
78 </div>
79 </td>
80 ##DESCRIPTION
81 <td><span class="tooltip" title="${h.tooltip(repo['description'])}">
82 ${h.truncate(repo['description'],60)}</span>
83 </td>
84 ##LAST CHANGE
85 <td>
86 <span class="tooltip" title="${repo['last_change']}">
87 ${h.age(repo['last_change'])}</span>
88 </td>
89 <td>
90 %if repo['rev']>=0:
91 ${h.link_to('r%s:%s' % (repo['rev'],h.short_id(repo['tip'])),
92 h.url('changeset_home',repo_name=repo['name'],revision=repo['tip']),
93 class_="tooltip",
94 title=h.tooltip(repo['last_msg']))}
95 %else:
96 ${_('No changesets yet')}
97 %endif
98 </td>
99 <td title="${repo['contact']}">${h.person(repo['contact'])}</td>
100 <td>
101 %if c.rhodecode_user.username != 'default':
102 <a title="${_('Subscribe to %s rss feed')%repo['name']}" class="rss_icon" href="${h.url('rss_feed_home',repo_name=repo['name'],api_key=c.rhodecode_user.api_key)}"></a>
103 %else:
104 <a title="${_('Subscribe to %s rss feed')%repo['name']}" class="rss_icon" href="${h.url('rss_feed_home',repo_name=repo['name'])}"></a>
105 %endif:
106 </td>
107 <td>
108 %if c.rhodecode_user.username != 'default':
109 <a title="${_('Subscribe to %s atom feed')%repo['name']}" class="atom_icon" href="${h.url('atom_feed_home',repo_name=repo['name'],api_key=c.rhodecode_user.api_key)}"></a>
110 %else:
111 <a title="${_('Subscribe to %s atom feed')%repo['name']}" class="atom_icon" href="${h.url('atom_feed_home',repo_name=repo['name'])}"></a>
112 %endif:
113 </td>
114 </tr>
115 %endfor
116 </tbody>
117 </table>
118 </div>
119 </div>
120
121 </%def>
@@ -1,9 +1,11 b''
1 import logging
1 import logging
2 from operator import itemgetter
2
3
3 from pylons import request, response, session, tmpl_context as c, url
4 from pylons import request, response, session, tmpl_context as c, url
4 from pylons.controllers.util import abort, redirect
5 from pylons.controllers.util import abort, redirect
5
6
6 from rhodecode.lib.base import BaseController, render
7 from rhodecode.lib.base import BaseController, render
8 from rhodecode.model.db import Group
7
9
8 log = logging.getLogger(__name__)
10 log = logging.getLogger(__name__)
9
11
@@ -47,6 +49,43 b' class ReposGroupsController(BaseControll'
47 """GET /repos_groups/id: Show a specific item"""
49 """GET /repos_groups/id: Show a specific item"""
48 # url('repos_group', id=ID)
50 # url('repos_group', id=ID)
49
51
52 c.group = Group.get(id)
53 if c.group:
54 c.group_repos = c.group.repositories
55 else:
56 return redirect(url('repos_group'))
57
58 sortables = ['name', 'description', 'last_change', 'tip', 'owner']
59 current_sort = request.GET.get('sort', 'name')
60 current_sort_slug = current_sort.replace('-', '')
61
62 if current_sort_slug not in sortables:
63 c.sort_by = 'name'
64 current_sort_slug = c.sort_by
65 else:
66 c.sort_by = current_sort
67 c.sort_slug = current_sort_slug
68
69 sort_key = current_sort_slug + '_sort'
70
71
72 #overwrite our cached list with current filter
73 gr_filter = [r.repo_name for r in c.group_repos]
74 c.cached_repo_list = self.scm_model.get_repos(all_repos=gr_filter)
75
76 if c.sort_by.startswith('-'):
77 c.repos_list = sorted(c.cached_repo_list, key=itemgetter(sort_key),
78 reverse=True)
79 else:
80 c.repos_list = sorted(c.cached_repo_list, key=itemgetter(sort_key),
81 reverse=False)
82
83 c.repo_cnt = len(c.repos_list)
84
85
86 return render('admin/repos_groups/repos_groups.html')
87
88
50 def edit(self, id, format='html'):
89 def edit(self, id, format='html'):
51 """GET /repos_groups/id/edit: Form to edit an existing item"""
90 """GET /repos_groups/id/edit: Form to edit an existing item"""
52 # url('edit_repos_group', id=ID)
91 # url('edit_repos_group', id=ID)
@@ -270,6 +270,10 b' class Group(Base):'
270 groups.insert(0, gr)
270 groups.insert(0, gr)
271 return groups
271 return groups
272
272
273 @property
274 def repositories(self):
275 return Session.query(Repository).filter(Repository.group == self).all()
276
273 class Permission(Base):
277 class Permission(Base):
274 __tablename__ = 'permissions'
278 __tablename__ = 'permissions'
275 __table_args__ = {'useexisting':True}
279 __table_args__ = {'useexisting':True}
@@ -125,8 +125,9 b' class ScmModel(BaseModel):'
125 this have to be a list of just the repository names
125 this have to be a list of just the repository names
126 """
126 """
127 if all_repos is None:
127 if all_repos is None:
128 all_repos = [r.repo_name for r in self.sa.query(Repository)\
128 repos = self.sa.query(Repository)\
129 .order_by(Repository.repo_name).all()]
129 .order_by(Repository.repo_name).all()
130 all_repos = [r.repo_name for r in repos]
130
131
131 #get the repositories that should be invalidated
132 #get the repositories that should be invalidated
132 invalidation_list = [str(x.cache_key) for x in \
133 invalidation_list = [str(x.cache_key) for x in \
General Comments 0
You need to be logged in to leave comments. Login now