annotate rhodecode/templates/admin/repos/repo_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 afe7c5e63aaf
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1602
1915f02f6d62 Ui fixes for tables
Marcin Kuzminski <marcin@python-works.com>
parents: 1455
diff changeset
1 <table id="permissions_manage" class="noborder">
1015
65129c332d37 #56 added ajax removal of users groups,
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
2 <tr>
65129c332d37 #56 added ajax removal of users groups,
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
3 <td>${_('none')}</td>
65129c332d37 #56 added ajax removal of users groups,
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
4 <td>${_('read')}</td>
65129c332d37 #56 added ajax removal of users groups,
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
5 <td>${_('write')}</td>
65129c332d37 #56 added ajax removal of users groups,
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
6 <td>${_('admin')}</td>
65129c332d37 #56 added ajax removal of users groups,
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
7 <td>${_('member')}</td>
65129c332d37 #56 added ajax removal of users groups,
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
8 <td></td>
65129c332d37 #56 added ajax removal of users groups,
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
9 </tr>
1888
f91d3f9b7230 White-space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents: 1701
diff changeset
10 ## USERS
1015
65129c332d37 #56 added ajax removal of users groups,
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
11 %for r2p in c.repo_info.repo_to_perm:
65129c332d37 #56 added ajax removal of users groups,
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
12 %if r2p.user.username =='default' and c.repo_info.private:
65129c332d37 #56 added ajax removal of users groups,
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
13 <tr>
65129c332d37 #56 added ajax removal of users groups,
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
14 <td colspan="4">
65129c332d37 #56 added ajax removal of users groups,
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
15 <span class="private_repo_msg">
65129c332d37 #56 added ajax removal of users groups,
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
16 ${_('private repository')}
65129c332d37 #56 added ajax removal of users groups,
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
17 </span>
65129c332d37 #56 added ajax removal of users groups,
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
18 </td>
2418
e5c8472ac0ac The ‘default’ username on the permission panels is now translatable.
Vincent Duvert <vincent@duvert.net>
parents: 2370
diff changeset
19 <td class="private_repo_msg"><img style="vertical-align:bottom" src="${h.url('/images/icons/user.png')}"/>${_('default')}</td>
1015
65129c332d37 #56 added ajax removal of users groups,
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
20 </tr>
65129c332d37 #56 added ajax removal of users groups,
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
21 %else:
65129c332d37 #56 added ajax removal of users groups,
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
22 <tr id="id${id(r2p.user.username)}">
65129c332d37 #56 added ajax removal of users groups,
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
23 <td>${h.radio('u_perm_%s' % r2p.user.username,'repository.none')}</td>
65129c332d37 #56 added ajax removal of users groups,
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
24 <td>${h.radio('u_perm_%s' % r2p.user.username,'repository.read')}</td>
65129c332d37 #56 added ajax removal of users groups,
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
25 <td>${h.radio('u_perm_%s' % r2p.user.username,'repository.write')}</td>
65129c332d37 #56 added ajax removal of users groups,
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
26 <td>${h.radio('u_perm_%s' % r2p.user.username,'repository.admin')}</td>
1455
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
27 <td style="white-space: nowrap;">
2418
e5c8472ac0ac The ‘default’ username on the permission panels is now translatable.
Vincent Duvert <vincent@duvert.net>
parents: 2370
diff changeset
28 <img class="perm-gravatar" src="${h.gravatar_url(r2p.user.email,14)}"/>${r2p.user.username if r2p.user.username != 'default' else _('default')}
1455
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
29 </td>
1015
65129c332d37 #56 added ajax removal of users groups,
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
30 <td>
65129c332d37 #56 added ajax removal of users groups,
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
31 %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
32 <span class="delete_icon action_button" onclick="ajaxActionRevoke(${r2p.user.user_id}, 'user', '${'id%s'%id(r2p.user.username)}')">
1378
832399a4a45c fixes issue #203, added revoke message
Marcin Kuzminski <marcin@python-works.com>
parents: 1051
diff changeset
33 ${_('revoke')}
1015
65129c332d37 #56 added ajax removal of users groups,
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
34 </span>
1888
f91d3f9b7230 White-space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents: 1701
diff changeset
35 %endif
1015
65129c332d37 #56 added ajax removal of users groups,
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
36 </td>
65129c332d37 #56 added ajax removal of users groups,
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
37 </tr>
65129c332d37 #56 added ajax removal of users groups,
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
38 %endif
65129c332d37 #56 added ajax removal of users groups,
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
39 %endfor
1888
f91d3f9b7230 White-space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents: 1701
diff changeset
40
3410
5f1850e4712a "Users groups" is grammatically incorrect English - rename to "user groups"
Mads Kiilerich <madski@unity3d.com>
parents: 3197
diff changeset
41 ## USER GROUPS
1015
65129c332d37 #56 added ajax removal of users groups,
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
42 %for g2p in c.repo_info.users_group_to_perm:
65129c332d37 #56 added ajax removal of users groups,
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
43 <tr id="id${id(g2p.users_group.users_group_name)}">
65129c332d37 #56 added ajax removal of users groups,
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
44 <td>${h.radio('g_perm_%s' % g2p.users_group.users_group_name,'repository.none')}</td>
65129c332d37 #56 added ajax removal of users groups,
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
45 <td>${h.radio('g_perm_%s' % g2p.users_group.users_group_name,'repository.read')}</td>
65129c332d37 #56 added ajax removal of users groups,
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
46 <td>${h.radio('g_perm_%s' % g2p.users_group.users_group_name,'repository.write')}</td>
65129c332d37 #56 added ajax removal of users groups,
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
47 <td>${h.radio('g_perm_%s' % g2p.users_group.users_group_name,'repository.admin')}</td>
1455
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
48 <td style="white-space: nowrap;">
2370
889cda9c2d14 implemented #464 users groups links inside permission box (only for admins)
Marcin Kuzminski <marcin@python-works.com>
parents: 2369
diff changeset
49 <img class="perm-gravatar" src="${h.url('/images/icons/group.png')}"/>
889cda9c2d14 implemented #464 users groups links inside permission box (only for admins)
Marcin Kuzminski <marcin@python-works.com>
parents: 2369
diff changeset
50 %if h.HasPermissionAny('hg.admin')():
889cda9c2d14 implemented #464 users groups links inside permission box (only for admins)
Marcin Kuzminski <marcin@python-works.com>
parents: 2369
diff changeset
51 <a href="${h.url('edit_users_group',id=g2p.users_group.users_group_id)}">${g2p.users_group.users_group_name}</a>
889cda9c2d14 implemented #464 users groups links inside permission box (only for admins)
Marcin Kuzminski <marcin@python-works.com>
parents: 2369
diff changeset
52 %else:
889cda9c2d14 implemented #464 users groups links inside permission box (only for admins)
Marcin Kuzminski <marcin@python-works.com>
parents: 2369
diff changeset
53 ${g2p.users_group.users_group_name}
889cda9c2d14 implemented #464 users groups links inside permission box (only for admins)
Marcin Kuzminski <marcin@python-works.com>
parents: 2369
diff changeset
54 %endif
1455
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
55 </td>
1015
65129c332d37 #56 added ajax removal of users groups,
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
56 <td>
3714
7e3d89d9d3a2 - Manage User’s Groups: create, delete, rename, add/remove users inside.
Marcin Kuzminski <marcin@python-works.com>
parents: 3417
diff changeset
57 <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)}')">
1378
832399a4a45c fixes issue #203, added revoke message
Marcin Kuzminski <marcin@python-works.com>
parents: 1051
diff changeset
58 ${_('revoke')}
1015
65129c332d37 #56 added ajax removal of users groups,
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
59 </span>
65129c332d37 #56 added ajax removal of users groups,
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
60 </td>
65129c332d37 #56 added ajax removal of users groups,
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
61 </tr>
65129c332d37 #56 added ajax removal of users groups,
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
62 %endfor
2759
c61c2ccea2b4 #538 form for permissions can handle multiple users at once
Marcin Kuzminski <marcin@python-works.com>
parents: 2418
diff changeset
63 <%
c61c2ccea2b4 #538 form for permissions can handle multiple users at once
Marcin Kuzminski <marcin@python-works.com>
parents: 2418
diff changeset
64 _tmpl = h.literal("""' \
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="repository.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
66 <td><input type="radio" value="repository.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
67 <td><input type="radio" value="repository.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
68 <td><input type="radio" value="repository.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
69 <td class="ac"> \
c61c2ccea2b4 #538 form for permissions can handle multiple users at once
Marcin Kuzminski <marcin@python-works.com>
parents: 2418
diff changeset
70 <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
71 <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
72 <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
73 <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
74 </div> \
c61c2ccea2b4 #538 form for permissions can handle multiple users at once
Marcin Kuzminski <marcin@python-works.com>
parents: 2418
diff changeset
75 </td> \
c61c2ccea2b4 #538 form for permissions can handle multiple users at once
Marcin Kuzminski <marcin@python-works.com>
parents: 2418
diff changeset
76 <td></td>'""")
2815
acc05c33cc0c White space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents: 2759
diff changeset
77 %>
acc05c33cc0c White space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents: 2759
diff changeset
78 ## 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
79 <tr class="new_members last_new_member" id="add_perm_input"></tr>
1015
65129c332d37 #56 added ajax removal of users groups,
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
80 <tr>
65129c332d37 #56 added ajax removal of users groups,
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
81 <td colspan="6">
65129c332d37 #56 added ajax removal of users groups,
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
82 <span id="add_perm" class="add_icon" style="cursor: pointer;">
65129c332d37 #56 added ajax removal of users groups,
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
83 ${_('Add another member')}
65129c332d37 #56 added ajax removal of users groups,
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
84 </span>
65129c332d37 #56 added ajax removal of users groups,
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
85 </td>
65129c332d37 #56 added ajax removal of users groups,
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
86 </tr>
1455
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
87 </table>
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
88 <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
89 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
90 url = "${h.url('delete_repo_perm_member',repo_name=c.repo_name)}";
25dbbdae3ed9 consistent handling of grant/revoke of permissions widgets
Marcin Kuzminski <marcin@python-works.com>
parents: 3714
diff changeset
91 ajaxActionRevokePermission(url, obj_id, obj_type, field_id);
1455
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
92 };
1888
f91d3f9b7230 White-space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents: 1701
diff changeset
93
1455
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
94 YUE.onDOMReady(function () {
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
95 if (!YUD.hasClass('perm_new_member_name', 'error')) {
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
96 YUD.setStyle('add_perm_input', 'display', 'none');
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
97 }
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
98 YAHOO.util.Event.addListener('add_perm', 'click', function () {
2759
c61c2ccea2b4 #538 form for permissions can handle multiple users at once
Marcin Kuzminski <marcin@python-works.com>
parents: 2418
diff changeset
99 addPermAction(${_tmpl}, ${c.users_array|n}, ${c.users_groups_array|n});
1455
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
100 });
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
101 });
9a7d0fbc4a80 fixes autocomplete on groups in non admin repository settings page
Marcin Kuzminski <marcin@python-works.com>
parents: 1378
diff changeset
102
1888
f91d3f9b7230 White-space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents: 1701
diff changeset
103 </script>