Show More
@@ -69,6 +69,7 b' class AdminRepoGroupsView(BaseAppView, D' | |||
|
69 | 69 | c.repo_groups = RepoGroup.groups_choices( |
|
70 | 70 | groups=groups_with_admin_rights, |
|
71 | 71 | show_empty_group=allow_empty_group) |
|
72 | c.personal_repo_group = self._rhodecode_user.personal_repo_group | |
|
72 | 73 | |
|
73 | 74 | def _can_create_repo_group(self, parent_group_id=None): |
|
74 | 75 | is_admin = HasPermissionAny('hg.admin')('group create controller') |
@@ -261,15 +262,28 b' class AdminRepoGroupsView(BaseAppView, D' | |||
|
261 | 262 | |
|
262 | 263 | # perm check for admin, create_group perm or admin of parent_group |
|
263 | 264 | parent_group_id = safe_int(self.request.GET.get('parent_group')) |
|
265 | _gr = RepoGroup.get(parent_group_id) | |
|
264 | 266 | if not self._can_create_repo_group(parent_group_id): |
|
265 | 267 | raise HTTPForbidden() |
|
266 | 268 | |
|
267 | 269 | self._load_form_data(c) |
|
268 | 270 | |
|
269 | 271 | defaults = {} # Future proof for default of repo group |
|
272 | ||
|
273 | parent_group_choice = '-1' | |
|
274 | if not self._rhodecode_user.is_admin and self._rhodecode_user.personal_repo_group: | |
|
275 | parent_group_choice = self._rhodecode_user.personal_repo_group | |
|
276 | ||
|
277 | if parent_group_id and _gr: | |
|
278 | if parent_group_id in [x[0] for x in c.repo_groups]: | |
|
279 | parent_group_choice = safe_unicode(parent_group_id) | |
|
280 | ||
|
281 | defaults.update({'group_parent_id': parent_group_choice}) | |
|
282 | ||
|
270 | 283 | data = render( |
|
271 | 284 | 'rhodecode:templates/admin/repo_groups/repo_group_add.mako', |
|
272 | 285 | self._get_template_context(c), self.request) |
|
286 | ||
|
273 | 287 | html = formencode.htmlfill.render( |
|
274 | 288 | data, |
|
275 | 289 | defaults=defaults, |
@@ -169,8 +169,8 b' class AdminReposView(BaseAppView, DataGr' | |||
|
169 | 169 | c = self.load_default_context() |
|
170 | 170 | |
|
171 | 171 | new_repo = self.request.GET.get('repo', '') |
|
172 | parent_group = safe_int(self.request.GET.get('parent_group')) | |
|
173 | _gr = RepoGroup.get(parent_group) | |
|
172 | parent_group_id = safe_int(self.request.GET.get('parent_group')) | |
|
173 | _gr = RepoGroup.get(parent_group_id) | |
|
174 | 174 | |
|
175 | 175 | if not HasPermissionAny('hg.admin', 'hg.create.repository')(): |
|
176 | 176 | # you're not super admin nor have global create permissions, |
@@ -196,9 +196,9 b' class AdminReposView(BaseAppView, DataGr' | |||
|
196 | 196 | if not self._rhodecode_user.is_admin and self._rhodecode_user.personal_repo_group: |
|
197 | 197 | parent_group_choice = self._rhodecode_user.personal_repo_group |
|
198 | 198 | |
|
199 | if parent_group and _gr: | |
|
200 | if parent_group in [x[0] for x in c.repo_groups]: | |
|
201 | parent_group_choice = safe_unicode(parent_group) | |
|
199 | if parent_group_id and _gr: | |
|
200 | if parent_group_id in [x[0] for x in c.repo_groups]: | |
|
201 | parent_group_choice = safe_unicode(parent_group_id) | |
|
202 | 202 | |
|
203 | 203 | defaults.update({'repo_group': parent_group_choice}) |
|
204 | 204 |
@@ -44,7 +44,12 b'' | |||
|
44 | 44 | <label for="group_parent_id">${_('Repository group')}:</label> |
|
45 | 45 | </div> |
|
46 | 46 | <div class="select"> |
|
47 | ${h.select('group_parent_id',request.GET.get('parent_group'),c.repo_groups,class_="medium")} | |
|
47 | ${h.select('group_parent_id', request.GET.get('parent_group'),c.repo_groups,class_="medium")} | |
|
48 | % if c.personal_repo_group: | |
|
49 | <a class="btn" href="#" id="select_my_group" data-personal-group-id="${c.personal_repo_group.group_id}"> | |
|
50 | ${_('Select my personal group ({})').format(c.personal_repo_group.group_name)} | |
|
51 | </a> | |
|
52 | % endif | |
|
48 | 53 | </div> |
|
49 | 54 | </div> |
|
50 | 55 | |
@@ -106,6 +111,12 b'' | |||
|
106 | 111 | setCopyPermsOption(e.val) |
|
107 | 112 | }); |
|
108 | 113 | $('#group_name').focus(); |
|
114 | ||
|
115 | $('#select_my_group').on('click', function(e){ | |
|
116 | e.preventDefault(); | |
|
117 | $("#group_parent_id").val($(this).data('personalGroupId')).trigger("change"); | |
|
118 | }) | |
|
119 | ||
|
109 | 120 | }) |
|
110 | 121 | </script> |
|
111 | 122 | </%def> |
@@ -46,7 +46,7 b'' | |||
|
46 | 46 | ${h.select('repo_group',request.GET.get('parent_group'),c.repo_groups,class_="medium")} |
|
47 | 47 | % if c.personal_repo_group: |
|
48 | 48 | <a class="btn" href="#" id="select_my_group" data-personal-group-id="${c.personal_repo_group.group_id}"> |
|
49 |
${_('Select my personal group ( |
|
|
49 | ${_('Select my personal group ({})').format(c.personal_repo_group.group_name)} | |
|
50 | 50 | </a> |
|
51 | 51 | % endif |
|
52 | 52 | <span class="help-block">${_('Optionally select a group to put this repository into.')}</span> |
General Comments 0
You need to be logged in to leave comments.
Login now