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