Show More
@@ -52,7 +52,7 b' class ReposGroupsController(BaseControll' | |||||
52 |
|
52 | |||
53 | c.group = Group.get(id) |
|
53 | c.group = Group.get(id) | |
54 | if c.group: |
|
54 | if c.group: | |
55 | c.group_repos = c.group.repositories |
|
55 | c.group_repos = c.group.repositories.all() | |
56 | else: |
|
56 | else: | |
57 | return redirect(url('repos_group')) |
|
57 | return redirect(url('repos_group')) | |
58 |
|
58 | |||
@@ -82,6 +82,10 b' class ReposGroupsController(BaseControll' | |||||
82 |
|
82 | |||
83 | c.repo_cnt = len(c.repos_list) |
|
83 | c.repo_cnt = len(c.repos_list) | |
84 |
|
84 | |||
|
85 | ||||
|
86 | c.groups = self.sa.query(Group).order_by(Group.group_name)\ | |||
|
87 | .filter(Group.group_parent_id == id).all() | |||
|
88 | ||||
85 | return render('admin/repos_groups/repos_groups.html') |
|
89 | return render('admin/repos_groups/repos_groups.html') | |
86 |
|
90 | |||
87 | def edit(self, id, format='html'): |
|
91 | def edit(self, id, format='html'): |
@@ -31,7 +31,7 b' from paste.httpexceptions import HTTPBad' | |||||
31 |
|
31 | |||
32 | from rhodecode.lib.auth import LoginRequired |
|
32 | from rhodecode.lib.auth import LoginRequired | |
33 | from rhodecode.lib.base import BaseController, render |
|
33 | from rhodecode.lib.base import BaseController, render | |
34 |
|
34 | from rhodecode.model.db import Group | ||
35 |
|
35 | |||
36 | log = logging.getLogger(__name__) |
|
36 | log = logging.getLogger(__name__) | |
37 |
|
37 | |||
@@ -64,6 +64,12 b' class HomeController(BaseController):' | |||||
64 | reverse=False) |
|
64 | reverse=False) | |
65 |
|
65 | |||
66 | c.repo_cnt = len(c.repos_list) |
|
66 | c.repo_cnt = len(c.repos_list) | |
|
67 | ||||
|
68 | ||||
|
69 | c.groups = self.sa.query(Group)\ | |||
|
70 | .filter(Group.group_parent_id == None).all() | |||
|
71 | ||||
|
72 | ||||
67 | return render('/index.html') |
|
73 | return render('/index.html') | |
68 |
|
74 | |||
69 | def repo_switcher(self): |
|
75 | def repo_switcher(self): |
@@ -297,10 +297,12 b' class Repository(Base):' | |||||
297 | class Group(Base): |
|
297 | class Group(Base): | |
298 | __tablename__ = 'groups' |
|
298 | __tablename__ = 'groups' | |
299 | __table_args__ = (UniqueConstraint('group_name'), {'useexisting':True},) |
|
299 | __table_args__ = (UniqueConstraint('group_name'), {'useexisting':True},) | |
|
300 | __mapper_args__ = {'order_by':'group_name'} | |||
300 |
|
301 | |||
301 | group_id = Column("group_id", Integer(), nullable=False, unique=True, default=None, primary_key=True) |
|
302 | group_id = Column("group_id", Integer(), nullable=False, unique=True, default=None, primary_key=True) | |
302 | group_name = Column("group_name", String(length=255, convert_unicode=False, assert_unicode=None), nullable=False, unique=True, default=None) |
|
303 | group_name = Column("group_name", String(length=255, convert_unicode=False, assert_unicode=None), nullable=False, unique=True, default=None) | |
303 | group_parent_id = Column("group_parent_id", Integer(), ForeignKey('groups.group_id'), nullable=True, unique=None, default=None) |
|
304 | group_parent_id = Column("group_parent_id", Integer(), ForeignKey('groups.group_id'), nullable=True, unique=None, default=None) | |
|
305 | group_description = Column("group_description", String(length=10000, convert_unicode=False, assert_unicode=None), nullable=True, unique=None, default=None) | |||
304 |
|
306 | |||
305 | parent_group = relationship('Group', remote_side=group_id) |
|
307 | parent_group = relationship('Group', remote_side=group_id) | |
306 |
|
308 | |||
@@ -336,7 +338,7 b' class Group(Base):' | |||||
336 |
|
338 | |||
337 | @property |
|
339 | @property | |
338 | def repositories(self): |
|
340 | def repositories(self): | |
339 |
return Session.query(Repository).filter(Repository.group == self) |
|
341 | return Session.query(Repository).filter(Repository.group == self) | |
340 |
|
342 | |||
341 | class Permission(Base): |
|
343 | class Permission(Base): | |
342 | __tablename__ = 'permissions' |
|
344 | __tablename__ = 'permissions' |
@@ -119,14 +119,16 b' class ScmModel(BaseModel):' | |||||
119 | return repos_list |
|
119 | return repos_list | |
120 |
|
120 | |||
121 | def get_repos(self, all_repos=None): |
|
121 | def get_repos(self, all_repos=None): | |
122 | """Get all repos from db and for each repo create it's |
|
122 | """ | |
|
123 | Get all repos from db and for each repo create it's | |||
123 | backend instance and fill that backed with information from database |
|
124 | backend instance and fill that backed with information from database | |
124 |
|
125 | |||
125 |
:param all_repos: |
|
126 | :param all_repos: list of repository names as strings | |
126 | this have to be a list of just the repository names |
|
127 | give specific repositories list, good for filtering | |
127 | """ |
|
128 | """ | |
128 | if all_repos is None: |
|
129 | if all_repos is None: | |
129 | repos = self.sa.query(Repository)\ |
|
130 | repos = self.sa.query(Repository)\ | |
|
131 | .filter(Repository.group_id == None)\ | |||
130 | .order_by(Repository.repo_name).all() |
|
132 | .order_by(Repository.repo_name).all() | |
131 | all_repos = [r.repo_name for r in repos] |
|
133 | all_repos = [r.repo_name for r in repos] | |
132 |
|
134 |
@@ -7,7 +7,12 b'' | |||||
7 |
|
7 | |||
8 |
|
8 | |||
9 | <%def name="breadcrumbs_links()"> |
|
9 | <%def name="breadcrumbs_links()"> | |
10 | ${_('Group')} » ${c.group.group_name} - ${_(' %s repositories' % c.repo_cnt)} |
|
10 | ${_('Repository Groups')} | |
|
11 | %if c.group.parent_group: | |||
|
12 | » ${h.link_to(c.group.parent_group.group_name,h.url('repos_group',id=c.group.parent_group.group_id))} | |||
|
13 | %endif | |||
|
14 | ||||
|
15 | » "${c.group.group_name}" ${_('with %s repositories' % c.repo_cnt)} | |||
11 | </%def> |
|
16 | </%def> | |
12 | <%def name="page_nav()"> |
|
17 | <%def name="page_nav()"> | |
13 | ${self.menu('admin')} |
|
18 | ${self.menu('admin')} | |
@@ -33,6 +38,35 b'' | |||||
33 | </div> |
|
38 | </div> | |
34 | <!-- end box / title --> |
|
39 | <!-- end box / title --> | |
35 | <div class="table"> |
|
40 | <div class="table"> | |
|
41 | % if c.groups: | |||
|
42 | <table> | |||
|
43 | ||||
|
44 | <thead> | |||
|
45 | <tr> | |||
|
46 | <th class="left"><a href="#">${_('Group name')}</a></th> | |||
|
47 | <th class="left"><a href="#">${_('Description')}</a></th> | |||
|
48 | <th class="left"><a href="#">${_('Number of repositories')}</a></th> | |||
|
49 | </tr> | |||
|
50 | </thead> | |||
|
51 | ||||
|
52 | ## REPO GROUPS | |||
|
53 | ||||
|
54 | % for gr in c.groups: | |||
|
55 | <tr> | |||
|
56 | <td> | |||
|
57 | <div style="white-space: nowrap"> | |||
|
58 | <img class="icon" alt="${_('Repositories group')}" src="${h.url('/images/icons/database_link.png')}"/> | |||
|
59 | ${h.link_to(gr.group_name,url('repos_group',id=gr.group_id))} | |||
|
60 | </div> | |||
|
61 | </td> | |||
|
62 | <td>${gr.group_description}</td> | |||
|
63 | <td><b>${gr.repositories.count()}</b></td> | |||
|
64 | </tr> | |||
|
65 | % endfor | |||
|
66 | ||||
|
67 | </table> | |||
|
68 | <div style="height: 20px"></div> | |||
|
69 | % endif | |||
36 | <table> |
|
70 | <table> | |
37 | <thead> |
|
71 | <thead> | |
38 | <tr> |
|
72 | <tr> |
@@ -46,6 +46,35 b'' | |||||
46 | </div> |
|
46 | </div> | |
47 | <!-- end box / title --> |
|
47 | <!-- end box / title --> | |
48 | <div class="table"> |
|
48 | <div class="table"> | |
|
49 | % if c.groups: | |||
|
50 | <table> | |||
|
51 | ||||
|
52 | <thead> | |||
|
53 | <tr> | |||
|
54 | <th class="left"><a href="#">${_('Group name')}</a></th> | |||
|
55 | <th class="left"><a href="#">${_('Description')}</a></th> | |||
|
56 | <th class="left"><a href="#">${_('Number of repositories')}</a></th> | |||
|
57 | </tr> | |||
|
58 | </thead> | |||
|
59 | ||||
|
60 | ## REPO GROUPS | |||
|
61 | ||||
|
62 | % for gr in c.groups: | |||
|
63 | <tr> | |||
|
64 | <td> | |||
|
65 | <div style="white-space: nowrap"> | |||
|
66 | <img class="icon" alt="${_('Repositories group')}" src="${h.url('/images/icons/database_link.png')}"/> | |||
|
67 | ${h.link_to(gr.group_name,url('repos_group',id=gr.group_id))} | |||
|
68 | </div> | |||
|
69 | </td> | |||
|
70 | <td>${gr.group_description}</td> | |||
|
71 | <td><b>${gr.repositories.count()}</b></td> | |||
|
72 | </tr> | |||
|
73 | % endfor | |||
|
74 | ||||
|
75 | </table> | |||
|
76 | <div style="height: 20px"></div> | |||
|
77 | % endif | |||
49 | <table> |
|
78 | <table> | |
50 | <thead> |
|
79 | <thead> | |
51 | <tr> |
|
80 | <tr> | |
@@ -126,6 +155,7 b'' | |||||
126 | </td> |
|
155 | </td> | |
127 | </tr> |
|
156 | </tr> | |
128 | %endfor |
|
157 | %endfor | |
|
158 | ||||
129 | </tbody> |
|
159 | </tbody> | |
130 | </table> |
|
160 | </table> | |
131 | </div> |
|
161 | </div> |
General Comments 0
You need to be logged in to leave comments.
Login now