<%
is_admin = h.HasPermissionAny('hg.admin')('can create repos index page')
create_repo = h.HasPermissionAny('hg.create.repository')('can create repository index page')
create_repo_group = h.HasPermissionAny('hg.repogroup.create.true')('can create repository groups index page')
create_user_group = h.HasPermissionAny('hg.usergroup.create.true')('can create user groups index page')
gr_name = c.repo_group.group_name if c.repo_group else None
# create repositories with write permission on group is set to true
create_on_write = h.HasPermissionAny('hg.create.write_on_repogroup.true')()
group_admin = h.HasRepoGroupPermissionAny('group.admin')(gr_name, 'group admin index page')
group_write = h.HasRepoGroupPermissionAny('group.write')(gr_name, 'can write into group index page')
%>
%if not c.repo_group:
## no repository group context here
%if is_admin or create_repo:
${_('Add Repository')}
%endif
%if is_admin or create_repo_group:
${_(u'Add Repository Group')}
%endif
%else:
##we're inside other repository group other terms apply
%if is_admin or group_admin or (group_write and create_on_write):
${_('Add Repository')}
%endif
%if is_admin or group_admin:
${_(u'Add Repository Group')}
%endif
%if is_admin or group_admin:
${_('Edit Repository Group')}
%endif
%endif