Show More
@@ -64,20 +64,10 b' class ReposController(BaseController):' | |||||
64 | super(ReposController, self).__before__() |
|
64 | super(ReposController, self).__before__() | |
65 |
|
65 | |||
66 | def __load_defaults(self): |
|
66 | def __load_defaults(self): | |
67 | repo_model = RepoModel() |
|
67 | c.repo_groups = Group.groups_choices() | |
|
68 | c.repo_groups_choices = map(lambda k: unicode(k[0]), c.repo_groups) | |||
68 |
|
69 | |||
69 | c.repo_groups = [('', '')] |
|
70 | repo_model = RepoModel() | |
70 | parents_link = lambda k: h.literal('»'.join( |
|
|||
71 | map(lambda k: k.group_name, |
|
|||
72 | k.parents + [k]) |
|
|||
73 | ) |
|
|||
74 | ) |
|
|||
75 |
|
||||
76 | c.repo_groups.extend([(x.group_id, parents_link(x)) for \ |
|
|||
77 | x in self.sa.query(Group).all()]) |
|
|||
78 | c.repo_groups = sorted(c.repo_groups, |
|
|||
79 | key=lambda t: t[1].split('»')[0]) |
|
|||
80 | c.repo_groups_choices = map(lambda k: unicode(k[0]), c.repo_groups) |
|
|||
81 | c.users_array = repo_model.get_users_js() |
|
71 | c.users_array = repo_model.get_users_js() | |
82 | c.users_groups_array = repo_model.get_users_groups_js() |
|
72 | c.users_groups_array = repo_model.get_users_groups_js() | |
83 |
|
73 |
@@ -32,15 +32,7 b' class ReposGroupsController(BaseControll' | |||||
32 | super(ReposGroupsController, self).__before__() |
|
32 | super(ReposGroupsController, self).__before__() | |
33 |
|
33 | |||
34 | def __load_defaults(self): |
|
34 | def __load_defaults(self): | |
35 |
|
35 | c.repo_groups = Group.groups_choices() | ||
36 | c.repo_groups = [('', '')] |
|
|||
37 | parents_link = lambda k: h.literal('»'.join(k)) |
|
|||
38 |
|
||||
39 | c.repo_groups.extend([(x.group_id, parents_link(x.full_path_splitted)) |
|
|||
40 | for x in self.sa.query(Group).all()]) |
|
|||
41 |
|
||||
42 | c.repo_groups = sorted(c.repo_groups, |
|
|||
43 | key=lambda t: t[1].split('»')[0]) |
|
|||
44 | c.repo_groups_choices = map(lambda k: unicode(k[0]), c.repo_groups) |
|
36 | c.repo_groups_choices = map(lambda k: unicode(k[0]), c.repo_groups) | |
45 |
|
37 | |||
46 | def __load_data(self, group_id): |
|
38 | def __load_data(self, group_id): |
@@ -366,17 +366,7 b' class SettingsController(BaseController)' | |||||
366 | def create_repository(self): |
|
366 | def create_repository(self): | |
367 | """GET /_admin/create_repository: Form to create a new item""" |
|
367 | """GET /_admin/create_repository: Form to create a new item""" | |
368 |
|
368 | |||
369 |
c.repo_groups = |
|
369 | c.repo_groups = Group.groups_choices() | |
370 | parents_link = lambda k: h.literal('»'.join( |
|
|||
371 | map(lambda k: k.group_name, |
|
|||
372 | k.parents + [k]) |
|
|||
373 | ) |
|
|||
374 | ) |
|
|||
375 |
|
||||
376 | c.repo_groups.extend([(x.group_id, parents_link(x)) for \ |
|
|||
377 | x in self.sa.query(Group).all()]) |
|
|||
378 | c.repo_groups = sorted(c.repo_groups, |
|
|||
379 | key=lambda t: t[1].split('»')[0]) |
|
|||
380 | c.repo_groups_choices = map(lambda k: unicode(k[0]), c.repo_groups) |
|
370 | c.repo_groups_choices = map(lambda k: unicode(k[0]), c.repo_groups) | |
381 |
|
371 | |||
382 | new_repo = request.GET.get('repo', '') |
|
372 | new_repo = request.GET.get('repo', '') |
@@ -598,12 +598,11 b' def repo_link(groups_and_repos):' | |||||
598 | return repo_name |
|
598 | return repo_name | |
599 | else: |
|
599 | else: | |
600 | def make_link(group): |
|
600 | def make_link(group): | |
601 |
return link_to(group. |
|
601 | return link_to(group.name, url('repos_group_home', | |
602 |
|
|
602 | group_name=group.group_name)) | |
603 | return literal(' » '.join(map(make_link, groups)) + \ |
|
603 | return literal(' » '.join(map(make_link, groups)) + \ | |
604 | " » " + repo_name) |
|
604 | " » " + repo_name) | |
605 |
|
605 | |||
606 |
|
||||
607 | def fancy_file_stats(stats): |
|
606 | def fancy_file_stats(stats): | |
608 | """ |
|
607 | """ | |
609 | Displays a fancy two colored bar for number of added/deleted |
|
608 | Displays a fancy two colored bar for number of added/deleted |
@@ -389,6 +389,11 b' def repo2db_mapper(initial_repo_list, re' | |||||
389 | rm = RepoModel() |
|
389 | rm = RepoModel() | |
390 | user = sa.query(User).filter(User.admin == True).first() |
|
390 | user = sa.query(User).filter(User.admin == True).first() | |
391 | added = [] |
|
391 | added = [] | |
|
392 | # fixup groups paths to new format on the fly | |||
|
393 | # TODO: remove this in future | |||
|
394 | for g in Group.query().all(): | |||
|
395 | g.group_name = g.get_new_name(g.name) | |||
|
396 | sa.add(g) | |||
392 | for name, repo in initial_repo_list.items(): |
|
397 | for name, repo in initial_repo_list.items(): | |
393 | group = map_groups(name.split(os.sep)) |
|
398 | group = map_groups(name.split(os.sep)) | |
394 | if not rm.get_by_repo_name(name, cache=False): |
|
399 | if not rm.get_by_repo_name(name, cache=False): |
@@ -744,6 +744,19 b' class Group(Base, BaseModel):' | |||||
744 | self.group_name) |
|
744 | self.group_name) | |
745 |
|
745 | |||
746 | @classmethod |
|
746 | @classmethod | |
|
747 | def groups_choices(cls): | |||
|
748 | from webhelpers.html import literal as _literal | |||
|
749 | repo_groups = [('', '')] | |||
|
750 | sep = ' » ' | |||
|
751 | _name = lambda k: _literal(sep.join(k)) | |||
|
752 | ||||
|
753 | repo_groups.extend([(x.group_id, _name(x.full_path_splitted)) | |||
|
754 | for x in cls.query().all()]) | |||
|
755 | ||||
|
756 | repo_groups = sorted(repo_groups,key=lambda t: t[1].split(sep)[0]) | |||
|
757 | return repo_groups | |||
|
758 | ||||
|
759 | @classmethod | |||
747 | def url_sep(cls): |
|
760 | def url_sep(cls): | |
748 | return '/' |
|
761 | return '/' | |
749 |
|
762 |
@@ -45,17 +45,17 b'' | |||||
45 |
|
45 | |||
46 | ##REPO TYPE |
|
46 | ##REPO TYPE | |
47 | %if c.dbrepo.repo_type =='hg': |
|
47 | %if c.dbrepo.repo_type =='hg': | |
48 |
<img style="margin-bottom:2px" class="icon" title="${_('Mercurial repository')}" alt="${_('Mercurial repository')}" src="${h.url( |
|
48 | <img style="margin-bottom:2px" class="icon" title="${_('Mercurial repository')}" alt="${_('Mercurial repository')}" src="${h.url('/images/icons/hgicon.png')}"/> | |
49 | %endif |
|
49 | %endif | |
50 | %if c.dbrepo.repo_type =='git': |
|
50 | %if c.dbrepo.repo_type =='git': | |
51 |
<img style="margin-bottom:2px" class="icon" title="${_('Git repository')}" alt="${_('Git repository')}" src="${h.url( |
|
51 | <img style="margin-bottom:2px" class="icon" title="${_('Git repository')}" alt="${_('Git repository')}" src="${h.url('/images/icons/giticon.png')}"/> | |
52 | %endif |
|
52 | %endif | |
53 |
|
53 | |||
54 | ##PUBLIC/PRIVATE |
|
54 | ##PUBLIC/PRIVATE | |
55 | %if c.dbrepo.private: |
|
55 | %if c.dbrepo.private: | |
56 |
<img style="margin-bottom:2px" class="icon" title="${_('private repository')}" alt="${_('private repository')}" src="${h.url( |
|
56 | <img style="margin-bottom:2px" class="icon" title="${_('private repository')}" alt="${_('private repository')}" src="${h.url('/images/icons/lock.png')}"/> | |
57 | %else: |
|
57 | %else: | |
58 |
<img style="margin-bottom:2px" class="icon" title="${_('public repository')}" alt="${_('public repository')}" src="${h.url( |
|
58 | <img style="margin-bottom:2px" class="icon" title="${_('public repository')}" alt="${_('public repository')}" src="${h.url('/images/icons/lock_open.png')}"/> | |
59 | %endif |
|
59 | %endif | |
60 |
|
60 | |||
61 | ##REPO NAME |
|
61 | ##REPO NAME | |
@@ -67,7 +67,7 b'' | |||||
67 | <a href="${h.url('summary_home',repo_name=c.dbrepo.fork.repo_name)}"> |
|
67 | <a href="${h.url('summary_home',repo_name=c.dbrepo.fork.repo_name)}"> | |
68 | <img class="icon" alt="${_('public')}" |
|
68 | <img class="icon" alt="${_('public')}" | |
69 | title="${_('Fork of')} ${c.dbrepo.fork.repo_name}" |
|
69 | title="${_('Fork of')} ${c.dbrepo.fork.repo_name}" | |
70 |
src="${h.url( |
|
70 | src="${h.url('/images/icons/arrow_divide.png')}"/> | |
71 | ${_('Fork of')} ${c.dbrepo.fork.repo_name} |
|
71 | ${_('Fork of')} ${c.dbrepo.fork.repo_name} | |
72 | </a> |
|
72 | </a> | |
73 | </div> |
|
73 | </div> | |
@@ -78,7 +78,7 b'' | |||||
78 | <a href="${h.url(str(h.hide_credentials(c.dbrepo.clone_uri)))}"> |
|
78 | <a href="${h.url(str(h.hide_credentials(c.dbrepo.clone_uri)))}"> | |
79 | <img class="icon" alt="${_('remote clone')}" |
|
79 | <img class="icon" alt="${_('remote clone')}" | |
80 | title="${_('Clone from')} ${h.hide_credentials(c.dbrepo.clone_uri)}" |
|
80 | title="${_('Clone from')} ${h.hide_credentials(c.dbrepo.clone_uri)}" | |
81 |
src="${h.url( |
|
81 | src="${h.url('/images/icons/connect.png')}"/> | |
82 | ${_('Clone from')} ${h.hide_credentials(c.dbrepo.clone_uri)} |
|
82 | ${_('Clone from')} ${h.hide_credentials(c.dbrepo.clone_uri)} | |
83 | </a> |
|
83 | </a> | |
84 | </div> |
|
84 | </div> |
General Comments 0
You need to be logged in to leave comments.
Login now