##// END OF EJS Templates
py3: fix display of default user permissions...
Mads Kiilerich -
r8191:de0f50a7 default
parent child Browse files
Show More
@@ -1,107 +1,107 b''
1 ${h.form(url('edit_repo_perms_update', repo_name=c.repo_name))}
1 ${h.form(url('edit_repo_perms_update', repo_name=c.repo_name))}
2 <div class="form">
2 <div class="form">
3 <div class="form-group">
3 <div class="form-group">
4 ${h.hidden('repo_private')}
4 ${h.hidden('repo_private')}
5 <table id="permissions_manage" class="table table-condensed">
5 <table id="permissions_manage" class="table table-condensed">
6 <tr>
6 <tr>
7 <td>${_('None')}</td>
7 <td>${_('None')}</td>
8 <td>${_('Read')}</td>
8 <td>${_('Read')}</td>
9 <td>${_('Write')}</td>
9 <td>${_('Write')}</td>
10 <td>${_('Admin')}</td>
10 <td>${_('Admin')}</td>
11 <td>${_('User/User Group')}</td>
11 <td>${_('User/User Group')}</td>
12 <td></td>
12 <td></td>
13 </tr>
13 </tr>
14 ## USERS
14 ## USERS
15 %for r2p in sorted(c.repo_info.repo_to_perm, key=lambda x: x.user.username != 'default' and x.user.username):
15 %for r2p in sorted(c.repo_info.repo_to_perm, key=lambda x: '' if x.user.username == 'default' else x.user.username):
16 %if r2p.user.username =='default' and c.repo_info.private:
16 %if r2p.user.username =='default' and c.repo_info.private:
17 <tr>
17 <tr>
18 <td colspan="4">
18 <td colspan="4">
19 <span class="private_repo_msg">
19 <span class="private_repo_msg">
20 ${_('Private Repository')}
20 ${_('Private Repository')}
21 </span>
21 </span>
22 </td>
22 </td>
23 <td class="private_repo_msg"><i class="icon-user"></i>${_('Default')}</td>
23 <td class="private_repo_msg"><i class="icon-user"></i>${_('Default')}</td>
24 </tr>
24 </tr>
25 %else:
25 %else:
26 <tr id="id${id(r2p.user.username)}">
26 <tr id="id${id(r2p.user.username)}">
27 <td>${h.radio('u_perm_%s' % r2p.user.username,'repository.none')}</td>
27 <td>${h.radio('u_perm_%s' % r2p.user.username,'repository.none')}</td>
28 <td>${h.radio('u_perm_%s' % r2p.user.username,'repository.read')}</td>
28 <td>${h.radio('u_perm_%s' % r2p.user.username,'repository.read')}</td>
29 <td>${h.radio('u_perm_%s' % r2p.user.username,'repository.write')}</td>
29 <td>${h.radio('u_perm_%s' % r2p.user.username,'repository.write')}</td>
30 <td>${h.radio('u_perm_%s' % r2p.user.username,'repository.admin')}</td>
30 <td>${h.radio('u_perm_%s' % r2p.user.username,'repository.admin')}</td>
31 <td>
31 <td>
32 ${h.gravatar(r2p.user.email, size=14)}
32 ${h.gravatar(r2p.user.email, size=14)}
33 %if h.HasPermissionAny('hg.admin')() and r2p.user.username != 'default':
33 %if h.HasPermissionAny('hg.admin')() and r2p.user.username != 'default':
34 <a href="${h.url('edit_user',id=r2p.user.user_id)}">${r2p.user.username}</a>
34 <a href="${h.url('edit_user',id=r2p.user.user_id)}">${r2p.user.username}</a>
35 %else:
35 %else:
36 ${r2p.user.username if r2p.user.username != 'default' else _('Default')}
36 ${r2p.user.username if r2p.user.username != 'default' else _('Default')}
37 %endif
37 %endif
38 </td>
38 </td>
39 <td>
39 <td>
40 %if r2p.user.username !='default':
40 %if r2p.user.username !='default':
41 <button type="button" class="btn btn-default btn-xs" onclick="ajaxActionRevoke(${r2p.user.user_id}, 'user', '${'id%s'%id(r2p.user.username)}', '${r2p.user.username}')">
41 <button type="button" class="btn btn-default btn-xs" onclick="ajaxActionRevoke(${r2p.user.user_id}, 'user', '${'id%s'%id(r2p.user.username)}', '${r2p.user.username}')">
42 <i class="icon-minus-circled"></i>${_('Revoke')}
42 <i class="icon-minus-circled"></i>${_('Revoke')}
43 </button>
43 </button>
44 %endif
44 %endif
45 </td>
45 </td>
46 </tr>
46 </tr>
47 %endif
47 %endif
48 %endfor
48 %endfor
49
49
50 ## USER GROUPS
50 ## USER GROUPS
51 %for g2p in sorted(c.repo_info.users_group_to_perm, key=lambda x:x.users_group.users_group_name):
51 %for g2p in sorted(c.repo_info.users_group_to_perm, key=lambda x:x.users_group.users_group_name):
52 <tr id="id${id(g2p.users_group.users_group_name)}">
52 <tr id="id${id(g2p.users_group.users_group_name)}">
53 <td>${h.radio('g_perm_%s' % g2p.users_group.users_group_name,'repository.none')}</td>
53 <td>${h.radio('g_perm_%s' % g2p.users_group.users_group_name,'repository.none')}</td>
54 <td>${h.radio('g_perm_%s' % g2p.users_group.users_group_name,'repository.read')}</td>
54 <td>${h.radio('g_perm_%s' % g2p.users_group.users_group_name,'repository.read')}</td>
55 <td>${h.radio('g_perm_%s' % g2p.users_group.users_group_name,'repository.write')}</td>
55 <td>${h.radio('g_perm_%s' % g2p.users_group.users_group_name,'repository.write')}</td>
56 <td>${h.radio('g_perm_%s' % g2p.users_group.users_group_name,'repository.admin')}</td>
56 <td>${h.radio('g_perm_%s' % g2p.users_group.users_group_name,'repository.admin')}</td>
57 <td>
57 <td>
58 <i class="icon-users"></i>
58 <i class="icon-users"></i>
59 %if h.HasPermissionAny('hg.admin')():
59 %if h.HasPermissionAny('hg.admin')():
60 <a href="${h.url('edit_users_group',id=g2p.users_group.users_group_id)}">${g2p.users_group.users_group_name}</a>
60 <a href="${h.url('edit_users_group',id=g2p.users_group.users_group_id)}">${g2p.users_group.users_group_name}</a>
61 %else:
61 %else:
62 ${g2p.users_group.users_group_name}
62 ${g2p.users_group.users_group_name}
63 %endif
63 %endif
64 </td>
64 </td>
65 <td>
65 <td>
66 <button type="button" class="btn btn-default btn-xs" onclick="ajaxActionRevoke(${g2p.users_group.users_group_id}, 'user_group', '${'id%s'%id(g2p.users_group.users_group_name)}', '${g2p.users_group.users_group_name}')">
66 <button type="button" class="btn btn-default btn-xs" onclick="ajaxActionRevoke(${g2p.users_group.users_group_id}, 'user_group', '${'id%s'%id(g2p.users_group.users_group_name)}', '${g2p.users_group.users_group_name}')">
67 <i class="icon-minus-circled"></i>${_('Revoke')}
67 <i class="icon-minus-circled"></i>${_('Revoke')}
68 </button>
68 </button>
69 </td>
69 </td>
70 </tr>
70 </tr>
71 %endfor
71 %endfor
72 ## New entries added by addPermAction here.
72 ## New entries added by addPermAction here.
73 <tr class="new_members last_new_member" id="add_perm_input"><td colspan="6"></td></tr>
73 <tr class="new_members last_new_member" id="add_perm_input"><td colspan="6"></td></tr>
74 <tr>
74 <tr>
75 <td colspan="6">
75 <td colspan="6">
76 <button type="button" id="add_perm" class="btn btn-link btn-xs">
76 <button type="button" id="add_perm" class="btn btn-link btn-xs">
77 <i class="icon-plus"></i>${_('Add new')}
77 <i class="icon-plus"></i>${_('Add new')}
78 </button>
78 </button>
79 </td>
79 </td>
80 </tr>
80 </tr>
81 </table>
81 </table>
82 </div>
82 </div>
83 <div class="form-group">
83 <div class="form-group">
84 ${h.submit('save',_('Save'),class_="btn btn-default")}
84 ${h.submit('save',_('Save'),class_="btn btn-default")}
85 ${h.reset('reset',_('Reset'),class_="btn btn-default")}
85 ${h.reset('reset',_('Reset'),class_="btn btn-default")}
86 </div>
86 </div>
87 </div>
87 </div>
88 ${h.end_form()}
88 ${h.end_form()}
89
89
90 <script>'use strict';
90 <script>'use strict';
91 function ajaxActionRevoke(obj_id, obj_type, field_id, obj_name) {
91 function ajaxActionRevoke(obj_id, obj_type, field_id, obj_name) {
92 let url = ${h.js(h.url('edit_repo_perms_revoke',repo_name=c.repo_name))};
92 let url = ${h.js(h.url('edit_repo_perms_revoke',repo_name=c.repo_name))};
93 var revoke_msg = _TM['Confirm to revoke permission for {0}: {1} ?'].format(obj_type.replace('_', ' '), obj_name);
93 var revoke_msg = _TM['Confirm to revoke permission for {0}: {1} ?'].format(obj_type.replace('_', ' '), obj_name);
94 if (confirm(revoke_msg)){
94 if (confirm(revoke_msg)){
95 ajaxActionRevokePermission(url, obj_id, obj_type, field_id);
95 ajaxActionRevokePermission(url, obj_id, obj_type, field_id);
96 }
96 }
97 }
97 }
98
98
99 $(document).ready(function () {
99 $(document).ready(function () {
100 if (!$('#perm_new_member_name').hasClass('error')) {
100 if (!$('#perm_new_member_name').hasClass('error')) {
101 $('#add_perm_input').hide();
101 $('#add_perm_input').hide();
102 }
102 }
103 $('#add_perm').click(function () {
103 $('#add_perm').click(function () {
104 addPermAction('repository');
104 addPermAction('repository');
105 });
105 });
106 });
106 });
107 </script>
107 </script>
General Comments 0
You need to be logged in to leave comments. Login now