diff --git a/rhodecode/controllers/admin/repos_groups.py b/rhodecode/controllers/admin/repos_groups.py --- a/rhodecode/controllers/admin/repos_groups.py +++ b/rhodecode/controllers/admin/repos_groups.py @@ -52,7 +52,7 @@ class ReposGroupsController(BaseControll c.group = Group.get(id) if c.group: - c.group_repos = c.group.repositories + c.group_repos = c.group.repositories.all() else: return redirect(url('repos_group')) @@ -82,6 +82,10 @@ class ReposGroupsController(BaseControll c.repo_cnt = len(c.repos_list) + + c.groups = self.sa.query(Group).order_by(Group.group_name)\ + .filter(Group.group_parent_id == id).all() + return render('admin/repos_groups/repos_groups.html') def edit(self, id, format='html'): diff --git a/rhodecode/controllers/home.py b/rhodecode/controllers/home.py --- a/rhodecode/controllers/home.py +++ b/rhodecode/controllers/home.py @@ -31,7 +31,7 @@ from paste.httpexceptions import HTTPBad from rhodecode.lib.auth import LoginRequired from rhodecode.lib.base import BaseController, render - +from rhodecode.model.db import Group log = logging.getLogger(__name__) @@ -64,6 +64,12 @@ class HomeController(BaseController): reverse=False) c.repo_cnt = len(c.repos_list) + + + c.groups = self.sa.query(Group)\ + .filter(Group.group_parent_id == None).all() + + return render('/index.html') def repo_switcher(self): diff --git a/rhodecode/model/db.py b/rhodecode/model/db.py --- a/rhodecode/model/db.py +++ b/rhodecode/model/db.py @@ -297,10 +297,12 @@ class Repository(Base): class Group(Base): __tablename__ = 'groups' __table_args__ = (UniqueConstraint('group_name'), {'useexisting':True},) + __mapper_args__ = {'order_by':'group_name'} group_id = Column("group_id", Integer(), nullable=False, unique=True, default=None, primary_key=True) group_name = Column("group_name", String(length=255, convert_unicode=False, assert_unicode=None), nullable=False, unique=True, default=None) group_parent_id = Column("group_parent_id", Integer(), ForeignKey('groups.group_id'), nullable=True, unique=None, default=None) + group_description = Column("group_description", String(length=10000, convert_unicode=False, assert_unicode=None), nullable=True, unique=None, default=None) parent_group = relationship('Group', remote_side=group_id) @@ -336,7 +338,7 @@ class Group(Base): @property def repositories(self): - return Session.query(Repository).filter(Repository.group == self).all() + return Session.query(Repository).filter(Repository.group == self) class Permission(Base): __tablename__ = 'permissions' diff --git a/rhodecode/model/scm.py b/rhodecode/model/scm.py --- a/rhodecode/model/scm.py +++ b/rhodecode/model/scm.py @@ -119,14 +119,16 @@ class ScmModel(BaseModel): return repos_list def get_repos(self, all_repos=None): - """Get all repos from db and for each repo create it's + """ + Get all repos from db and for each repo create it's backend instance and fill that backed with information from database - :param all_repos: give specific repositories list, good for filtering - this have to be a list of just the repository names + :param all_repos: list of repository names as strings + give specific repositories list, good for filtering """ if all_repos is None: repos = self.sa.query(Repository)\ + .filter(Repository.group_id == None)\ .order_by(Repository.repo_name).all() all_repos = [r.repo_name for r in repos] diff --git a/rhodecode/templates/admin/repos_groups/repos_groups.html b/rhodecode/templates/admin/repos_groups/repos_groups.html --- a/rhodecode/templates/admin/repos_groups/repos_groups.html +++ b/rhodecode/templates/admin/repos_groups/repos_groups.html @@ -7,7 +7,12 @@ <%def name="breadcrumbs_links()"> - ${_('Group')} » ${c.group.group_name} - ${_(' %s repositories' % c.repo_cnt)} + ${_('Repository Groups')} + %if c.group.parent_group: + » ${h.link_to(c.group.parent_group.group_name,h.url('repos_group',id=c.group.parent_group.group_id))} + %endif + + » "${c.group.group_name}" ${_('with %s repositories' % c.repo_cnt)} %def> <%def name="page_nav()"> ${self.menu('admin')} @@ -33,6 +38,35 @@
${_('Group name')} | +${_('Description')} | +${_('Number of repositories')} | +
---|---|---|
+
+
+ ${h.link_to(gr.group_name,url('repos_group',id=gr.group_id))}
+
+ |
+ ${gr.group_description} | +${gr.repositories.count()} | +
${_('Group name')} | +${_('Description')} | +${_('Number of repositories')} | +
---|---|---|
+
+
+ ${h.link_to(gr.group_name,url('repos_group',id=gr.group_id))}
+
+ |
+ ${gr.group_description} | +${gr.repositories.count()} | +