annotate rhodecode/templates/admin/repos_groups/repos_group_edit_perms.html @ 3715:25dbbdae3ed9 beta

consistent handling of grant/revoke of permissions widgets - use 1 method for users and for users groups - use common JS for ajax revoke - cleanup code
author Marcin Kuzminski <marcin@python-works.com>
date Mon, 08 Apr 2013 23:49:08 +0200
parents 7e3d89d9d3a2
children d9b89874edf9
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1982
87f0800abc7b #227 Initial version of repository groups permissions system
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
1 <table id="permissions_manage" class="noborder">
87f0800abc7b #227 Initial version of repository groups permissions system
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
2 <tr>
87f0800abc7b #227 Initial version of repository groups permissions system
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
3 <td>${_('none')}</td>
87f0800abc7b #227 Initial version of repository groups permissions system
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
4 <td>${_('read')}</td>
87f0800abc7b #227 Initial version of repository groups permissions system
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
5 <td>${_('write')}</td>
87f0800abc7b #227 Initial version of repository groups permissions system
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
6 <td>${_('admin')}</td>
87f0800abc7b #227 Initial version of repository groups permissions system
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
7 <td>${_('member')}</td>
87f0800abc7b #227 Initial version of repository groups permissions system
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
8 <td></td>
87f0800abc7b #227 Initial version of repository groups permissions system
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
9 </tr>
87f0800abc7b #227 Initial version of repository groups permissions system
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
10 ## USERS
87f0800abc7b #227 Initial version of repository groups permissions system
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
11 %for r2p in c.repos_group.repo_group_to_perm:
3332
92dfc033ee6f forbid removing yourself as beeing an admin of a group
Marcin Kuzminski <marcin@python-works.com>
parents: 3221
diff changeset
12 ##forbid revoking permission from yourself
1982
87f0800abc7b #227 Initial version of repository groups permissions system
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
13 <tr id="id${id(r2p.user.username)}">
3332
92dfc033ee6f forbid removing yourself as beeing an admin of a group
Marcin Kuzminski <marcin@python-works.com>
parents: 3221
diff changeset
14 %if c.rhodecode_user.user_id != r2p.user.user_id or c.rhodecode_user.is_admin:
1982
87f0800abc7b #227 Initial version of repository groups permissions system
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
15 <td>${h.radio('u_perm_%s' % r2p.user.username,'group.none')}</td>
87f0800abc7b #227 Initial version of repository groups permissions system
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
16 <td>${h.radio('u_perm_%s' % r2p.user.username,'group.read')}</td>
87f0800abc7b #227 Initial version of repository groups permissions system
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
17 <td>${h.radio('u_perm_%s' % r2p.user.username,'group.write')}</td>
87f0800abc7b #227 Initial version of repository groups permissions system
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
18 <td>${h.radio('u_perm_%s' % r2p.user.username,'group.admin')}</td>
87f0800abc7b #227 Initial version of repository groups permissions system
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
19 <td style="white-space: nowrap;">
2418
e5c8472ac0ac The ‘default’ username on the permission panels is now translatable.
Vincent Duvert <vincent@duvert.net>
parents: 2369
diff changeset
20 <img class="perm-gravatar" src="${h.gravatar_url(r2p.user.email,14)}"/>${r2p.user.username if r2p.user.username != 'default' else _('default')}
1982
87f0800abc7b #227 Initial version of repository groups permissions system
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
21 </td>
87f0800abc7b #227 Initial version of repository groups permissions system
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
22 <td>
87f0800abc7b #227 Initial version of repository groups permissions system
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
23 %if r2p.user.username !='default':
3714
7e3d89d9d3a2 - Manage User’s Groups: create, delete, rename, add/remove users inside.
Marcin Kuzminski <marcin@python-works.com>
parents: 3417
diff changeset
24 <span class="delete_icon action_button" onclick="ajaxActionRevoke(${r2p.user.user_id}, 'user', '${'id%s'%id(r2p.user.username)}')">
1982
87f0800abc7b #227 Initial version of repository groups permissions system
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
25 ${_('revoke')}
87f0800abc7b #227 Initial version of repository groups permissions system
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
26 </span>
87f0800abc7b #227 Initial version of repository groups permissions system
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
27 %endif
87f0800abc7b #227 Initial version of repository groups permissions system
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
28 </td>
3332
92dfc033ee6f forbid removing yourself as beeing an admin of a group
Marcin Kuzminski <marcin@python-works.com>
parents: 3221
diff changeset
29 %else:
92dfc033ee6f forbid removing yourself as beeing an admin of a group
Marcin Kuzminski <marcin@python-works.com>
parents: 3221
diff changeset
30 <td>${h.radio('u_perm_%s' % r2p.user.username,'group.none', disabled="disabled")}</td>
92dfc033ee6f forbid removing yourself as beeing an admin of a group
Marcin Kuzminski <marcin@python-works.com>
parents: 3221
diff changeset
31 <td>${h.radio('u_perm_%s' % r2p.user.username,'group.read', disabled="disabled")}</td>
92dfc033ee6f forbid removing yourself as beeing an admin of a group
Marcin Kuzminski <marcin@python-works.com>
parents: 3221
diff changeset
32 <td>${h.radio('u_perm_%s' % r2p.user.username,'group.write', disabled="disabled")}</td>
92dfc033ee6f forbid removing yourself as beeing an admin of a group
Marcin Kuzminski <marcin@python-works.com>
parents: 3221
diff changeset
33 <td>${h.radio('u_perm_%s' % r2p.user.username,'group.admin', disabled="disabled")}</td>
92dfc033ee6f forbid removing yourself as beeing an admin of a group
Marcin Kuzminski <marcin@python-works.com>
parents: 3221
diff changeset
34 <td style="white-space: nowrap;">
92dfc033ee6f forbid removing yourself as beeing an admin of a group
Marcin Kuzminski <marcin@python-works.com>
parents: 3221
diff changeset
35 <img class="perm-gravatar" src="${h.gravatar_url(r2p.user.email,14)}"/>${r2p.user.username if r2p.user.username != 'default' else _('default')}
92dfc033ee6f forbid removing yourself as beeing an admin of a group
Marcin Kuzminski <marcin@python-works.com>
parents: 3221
diff changeset
36 </td>
92dfc033ee6f forbid removing yourself as beeing an admin of a group
Marcin Kuzminski <marcin@python-works.com>
parents: 3221
diff changeset
37 <td>
92dfc033ee6f forbid removing yourself as beeing an admin of a group
Marcin Kuzminski <marcin@python-works.com>
parents: 3221
diff changeset
38 </td>
92dfc033ee6f forbid removing yourself as beeing an admin of a group
Marcin Kuzminski <marcin@python-works.com>
parents: 3221
diff changeset
39 %endif
1982
87f0800abc7b #227 Initial version of repository groups permissions system
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
40 </tr>
87f0800abc7b #227 Initial version of repository groups permissions system
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
41 %endfor
87f0800abc7b #227 Initial version of repository groups permissions system
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
42
3410
5f1850e4712a "Users groups" is grammatically incorrect English - rename to "user groups"
Mads Kiilerich <madski@unity3d.com>
parents: 3332
diff changeset
43 ## USER GROUPS
1982
87f0800abc7b #227 Initial version of repository groups permissions system
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
44 %for g2p in c.repos_group.users_group_to_perm:
87f0800abc7b #227 Initial version of repository groups permissions system
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
45 <tr id="id${id(g2p.users_group.users_group_name)}">
87f0800abc7b #227 Initial version of repository groups permissions system
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
46 <td>${h.radio('g_perm_%s' % g2p.users_group.users_group_name,'group.none')}</td>
87f0800abc7b #227 Initial version of repository groups permissions system
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
47 <td>${h.radio('g_perm_%s' % g2p.users_group.users_group_name,'group.read')}</td>
87f0800abc7b #227 Initial version of repository groups permissions system
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
48 <td>${h.radio('g_perm_%s' % g2p.users_group.users_group_name,'group.write')}</td>
87f0800abc7b #227 Initial version of repository groups permissions system
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
49 <td>${h.radio('g_perm_%s' % g2p.users_group.users_group_name,'group.admin')}</td>
87f0800abc7b #227 Initial version of repository groups permissions system
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
50 <td style="white-space: nowrap;">
2142
a21eab6ff42f Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents: 2126
diff changeset
51 <img class="perm-gravatar" src="${h.url('/images/icons/group.png')}"/>${g2p.users_group.users_group_name}
1982
87f0800abc7b #227 Initial version of repository groups permissions system
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
52 </td>
87f0800abc7b #227 Initial version of repository groups permissions system
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
53 <td>
3714
7e3d89d9d3a2 - Manage User’s Groups: create, delete, rename, add/remove users inside.
Marcin Kuzminski <marcin@python-works.com>
parents: 3417
diff changeset
54 <span class="delete_icon action_button" onclick="ajaxActionRevoke(${g2p.users_group.users_group_id}, 'user_group', '${'id%s'%id(g2p.users_group.users_group_name)}')">
1982
87f0800abc7b #227 Initial version of repository groups permissions system
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
55 ${_('revoke')}
87f0800abc7b #227 Initial version of repository groups permissions system
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
56 </span>
87f0800abc7b #227 Initial version of repository groups permissions system
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
57 </td>
87f0800abc7b #227 Initial version of repository groups permissions system
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
58 </tr>
87f0800abc7b #227 Initial version of repository groups permissions system
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
59 %endfor
2759
c61c2ccea2b4 #538 form for permissions can handle multiple users at once
Marcin Kuzminski <marcin@python-works.com>
parents: 2418
diff changeset
60 <%
c61c2ccea2b4 #538 form for permissions can handle multiple users at once
Marcin Kuzminski <marcin@python-works.com>
parents: 2418
diff changeset
61 _tmpl = h.literal("""' \
c61c2ccea2b4 #538 form for permissions can handle multiple users at once
Marcin Kuzminski <marcin@python-works.com>
parents: 2418
diff changeset
62 <td><input type="radio" value="group.none" name="perm_new_member_{0}" id="perm_new_member_{0}"></td> \
c61c2ccea2b4 #538 form for permissions can handle multiple users at once
Marcin Kuzminski <marcin@python-works.com>
parents: 2418
diff changeset
63 <td><input type="radio" value="group.read" name="perm_new_member_{0}" id="perm_new_member_{0}"></td> \
c61c2ccea2b4 #538 form for permissions can handle multiple users at once
Marcin Kuzminski <marcin@python-works.com>
parents: 2418
diff changeset
64 <td><input type="radio" value="group.write" name="perm_new_member_{0}" id="perm_new_member_{0}"></td> \
c61c2ccea2b4 #538 form for permissions can handle multiple users at once
Marcin Kuzminski <marcin@python-works.com>
parents: 2418
diff changeset
65 <td><input type="radio" value="group.admin" name="perm_new_member_{0}" id="perm_new_member_{0}"></td> \
c61c2ccea2b4 #538 form for permissions can handle multiple users at once
Marcin Kuzminski <marcin@python-works.com>
parents: 2418
diff changeset
66 <td class="ac"> \
c61c2ccea2b4 #538 form for permissions can handle multiple users at once
Marcin Kuzminski <marcin@python-works.com>
parents: 2418
diff changeset
67 <div class="perm_ac" id="perm_ac_{0}"> \
c61c2ccea2b4 #538 form for permissions can handle multiple users at once
Marcin Kuzminski <marcin@python-works.com>
parents: 2418
diff changeset
68 <input class="yui-ac-input" id="perm_new_member_name_{0}" name="perm_new_member_name_{0}" value="" type="text"> \
c61c2ccea2b4 #538 form for permissions can handle multiple users at once
Marcin Kuzminski <marcin@python-works.com>
parents: 2418
diff changeset
69 <input id="perm_new_member_type_{0}" name="perm_new_member_type_{0}" value="" type="hidden"> \
c61c2ccea2b4 #538 form for permissions can handle multiple users at once
Marcin Kuzminski <marcin@python-works.com>
parents: 2418
diff changeset
70 <div id="perm_container_{0}"></div> \
c61c2ccea2b4 #538 form for permissions can handle multiple users at once
Marcin Kuzminski <marcin@python-works.com>
parents: 2418
diff changeset
71 </div> \
c61c2ccea2b4 #538 form for permissions can handle multiple users at once
Marcin Kuzminski <marcin@python-works.com>
parents: 2418
diff changeset
72 </td> \
c61c2ccea2b4 #538 form for permissions can handle multiple users at once
Marcin Kuzminski <marcin@python-works.com>
parents: 2418
diff changeset
73 <td></td>'""")
2815
acc05c33cc0c White space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents: 2759
diff changeset
74 %>
acc05c33cc0c White space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents: 2759
diff changeset
75 ## ADD HERE DYNAMICALLY NEW INPUTS FROM THE '_tmpl'
2759
c61c2ccea2b4 #538 form for permissions can handle multiple users at once
Marcin Kuzminski <marcin@python-works.com>
parents: 2418
diff changeset
76 <tr class="new_members last_new_member" id="add_perm_input"></tr>
1982
87f0800abc7b #227 Initial version of repository groups permissions system
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
77 <tr>
87f0800abc7b #227 Initial version of repository groups permissions system
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
78 <td colspan="6">
87f0800abc7b #227 Initial version of repository groups permissions system
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
79 <span id="add_perm" class="add_icon" style="cursor: pointer;">
87f0800abc7b #227 Initial version of repository groups permissions system
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
80 ${_('Add another member')}
87f0800abc7b #227 Initial version of repository groups permissions system
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
81 </span>
87f0800abc7b #227 Initial version of repository groups permissions system
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
82 </td>
87f0800abc7b #227 Initial version of repository groups permissions system
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
83 </tr>
2820
c0cc8f8a71b0 Permissions on group can be set in recursive mode setting defined permission to all children
Marcin Kuzminski <marcin@python-works.com>
parents: 2815
diff changeset
84 <tr>
c0cc8f8a71b0 Permissions on group can be set in recursive mode setting defined permission to all children
Marcin Kuzminski <marcin@python-works.com>
parents: 2815
diff changeset
85 <td colspan="6">
2832
b711b3377372 typo fix
Marcin Kuzminski <marcin@python-works.com>
parents: 2820
diff changeset
86 ${h.checkbox('recursive',value="True", label=_('apply to children'))}
3221
dd0ee9119aa9 recursive mode of setting permission should skip private repositories, they should remain private, it's proper thing to do !
Marcin Kuzminski <marcin@python-works.com>
parents: 3197
diff changeset
87 <span class="help-block">${_('Set or revoke permission to all children of that group, including non-private repositories and other groups')}</span>
2820
c0cc8f8a71b0 Permissions on group can be set in recursive mode setting defined permission to all children
Marcin Kuzminski <marcin@python-works.com>
parents: 2815
diff changeset
88 </td>
c0cc8f8a71b0 Permissions on group can be set in recursive mode setting defined permission to all children
Marcin Kuzminski <marcin@python-works.com>
parents: 2815
diff changeset
89 </tr>
1982
87f0800abc7b #227 Initial version of repository groups permissions system
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
90 </table>
87f0800abc7b #227 Initial version of repository groups permissions system
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
91 <script type="text/javascript">
3714
7e3d89d9d3a2 - Manage User’s Groups: create, delete, rename, add/remove users inside.
Marcin Kuzminski <marcin@python-works.com>
parents: 3417
diff changeset
92 function ajaxActionRevoke(obj_id, obj_type, field_id) {
3715
25dbbdae3ed9 consistent handling of grant/revoke of permissions widgets
Marcin Kuzminski <marcin@python-works.com>
parents: 3714
diff changeset
93 url = "${h.url('delete_repo_group_perm_member', group_name=c.repos_group.group_name)}";
25dbbdae3ed9 consistent handling of grant/revoke of permissions widgets
Marcin Kuzminski <marcin@python-works.com>
parents: 3714
diff changeset
94 ajaxActionRevokePermission(url, obj_id, obj_type, field_id, {recursive:YUD.get('recursive').checked});
1982
87f0800abc7b #227 Initial version of repository groups permissions system
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
95 };
87f0800abc7b #227 Initial version of repository groups permissions system
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
96
87f0800abc7b #227 Initial version of repository groups permissions system
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
97 YUE.onDOMReady(function () {
87f0800abc7b #227 Initial version of repository groups permissions system
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
98 if (!YUD.hasClass('perm_new_member_name', 'error')) {
87f0800abc7b #227 Initial version of repository groups permissions system
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
99 YUD.setStyle('add_perm_input', 'display', 'none');
87f0800abc7b #227 Initial version of repository groups permissions system
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
100 }
87f0800abc7b #227 Initial version of repository groups permissions system
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
101 YAHOO.util.Event.addListener('add_perm', 'click', function () {
3197
b4f401524060 html: don't use tabs
Mads Kiilerich <madski@unity3d.com>
parents: 2832
diff changeset
102 addPermAction(${_tmpl}, ${c.users_array|n}, ${c.users_groups_array|n});
1982
87f0800abc7b #227 Initial version of repository groups permissions system
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
103 });
87f0800abc7b #227 Initial version of repository groups permissions system
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
104 });
87f0800abc7b #227 Initial version of repository groups permissions system
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
105
87f0800abc7b #227 Initial version of repository groups permissions system
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
106 </script>