Browse Source

hide forbidden actions on user list admin screen

Damien ACCORSI 10 years ago
parent
commit
78b2b311a8
2 changed files with 16 additions and 4 deletions
  1. 8 0
      tracim/tracim/templates/pod.mak
  2. 8 4
      tracim/tracim/templates/user_get_all.mak

+ 8 - 0
tracim/tracim/templates/pod.mak View File

@@ -9,6 +9,14 @@
9 9
 
10 10
 <%def name="NO_CONTENT_INFO(message)"><div class="alert alert-warning" role="alert">${ICO(32, 'status/dialog-information')} ${message|n}</div></%def>
11 11
                 
12
+<%def name="ICO_ACTION(icon_size, icon_path, title, link_url, current_user, required_profile_id)">
13
+    % if current_user.profile.id>=required_profile_id:
14
+        <a href="${link_url}">${ICO_TOOLTIP(icon_size, icon_path, title)}</a>
15
+    % else:
16
+        <span class="tracim-less-visible">${ICO(icon_size, icon_path)}</span>
17
+    % endif
18
+</%def>
19
+
12 20
 <%def name="MODAL_DIALOG(css_id, modal_size='')">
13 21
     <div id="${css_id}" class="modal" tabindex="-1" role="dialog" aria-hidden="true">
14 22
         <div class="modal-dialog ${modal_size}">

+ 8 - 4
tracim/tracim/templates/user_get_all.mak View File

@@ -98,21 +98,25 @@
98 98
                             % for user in result.users:
99 99
                                 <tr>
100 100
                                     % if user.enabled:
101
-                                        <td title="${_('User enabled. Click to disable this user')}"><a href="${tg.url('/admin/users/{}/disable'.format(user.id))}">${TIM.ICO(16, 'status/item-enabled')}</a></td>
101
+                                        <td>
102
+                                            ${TIM.ICO_ACTION(16, 'status/item-enabled', _('User enabled. Click to disable this user'), tg.url('/admin/users/{}/disable'.format(user.id)), fake_api.current_user, 3)}
103
+                                        </td>
102 104
                                         <td><a href="${tg.url('/admin/users/{}'.format(user.id))}"><b>${user.name}</b></a></td>
103 105
                                         <td><a href="mailto:${user.email}">${user.email}</a></td>
104 106
                                         <td>
105 107
                                             <% icon = ('emblems/emblem-unreadable', 'emblems/emblem-checked')[user.profile.id>=2] %>
106 108
                                             <% linked_profile = ('tracim-profile-manager', 'tracim-profile-user')[user.profile.id>=2] %>
107
-                                            <a href="${tg.url('/admin/users/{}/profile/switch?new_role={}'.format(user.id, linked_profile))}">${TIM.ICO(16, icon)}</a>
109
+                                            ${TIM.ICO_ACTION(16, icon, '', tg.url('/admin/users/{}/profile/switch?new_role={}'.format(user.id, linked_profile)), fake_api.current_user, 3)}
108 110
                                         </td>
109 111
                                         <td>
110 112
                                             <% icon = ('emblems/emblem-unreadable', 'emblems/emblem-checked')[user.profile.id>=3] %>
111 113
                                             <% linked_profile = ('tracim-profile-admin', 'tracim-profile-manager')[user.profile.id>=3] %>
112
-                                            <a href="${tg.url('/admin/users/{}/profile/switch?new_role={}'.format(user.id, linked_profile))}">${TIM.ICO(16, icon)}</a>
114
+                                            ${TIM.ICO_ACTION(16, icon, '', tg.url('/admin/users/{}/profile/switch?new_role={}'.format(user.id, linked_profile)), fake_api.current_user, 3)}
113 115
                                         </td>
114 116
                                     % else:
115
-                                        <td title="${_('User disabled. Click to enable this user')}"><a href="${tg.url('/admin/users/{}/enable'.format(user.id))}">${TIM.ICO(16, 'status/item-disabled')}</a></td>
117
+                                        <td>
118
+                                            ${TIM.ICO_ACTION(16, 'status/item-disabled', _('User disabled. Click to enable this user'), tg.url('/admin/users/{}/enable'.format(user.id)), fake_api.current_user, 3)}
119
+                                        </td>
116 120
                                         <td>${user.name}</td>
117 121
                                         <td>${user.email}</td>
118 122
                                         <td>