##// END OF EJS Templates
helpers: show boolean value of value as icon, not just the True and False singletons
Mads Kiilerich -
r3627:32cb8d45 beta
parent child Browse files
Show More
@@ -99,9 +99,9 b' class UsersController(BaseController):'
99 "lastname": user.lastname,
99 "lastname": user.lastname,
100 "last_login": h.fmt_date(user.last_login),
100 "last_login": h.fmt_date(user.last_login),
101 "last_login_raw": datetime_to_time(user.last_login),
101 "last_login_raw": datetime_to_time(user.last_login),
102 "active": h.bool2icon(user.active),
102 "active": h.boolicon(user.active),
103 "admin": h.bool2icon(user.admin),
103 "admin": h.boolicon(user.admin),
104 "ldap": h.bool2icon(bool(user.ldap_dn)),
104 "ldap": h.boolicon(bool(user.ldap_dn)),
105 "action": user_actions(user.user_id, user.username),
105 "action": user_actions(user.user_id, user.username),
106 })
106 })
107
107
@@ -494,23 +494,20 b' def desc_stylize(value):'
494 return value
494 return value
495
495
496
496
497 def bool2icon(value):
497 def boolicon(value):
498 """Returns True/False values represented as small html image of true/false
498 """Returns boolean value of a value, represented as small html image of true/false
499 icons
499 icons
500
500
501 :param value: bool value
501 :param value: value
502 """
502 """
503
503
504 if value is True:
504 if value:
505 return HTML.tag('img', src=url("/images/icons/accept.png"),
505 return HTML.tag('img', src=url("/images/icons/accept.png"),
506 alt=_('True'))
506 alt=_('True'))
507
507 else:
508 if value is False:
509 return HTML.tag('img', src=url("/images/icons/cancel.png"),
508 return HTML.tag('img', src=url("/images/icons/cancel.png"),
510 alt=_('False'))
509 alt=_('False'))
511
510
512 return value
513
514
511
515 def action_parser(user_log, feed=False, parse_cs=False):
512 def action_parser(user_log, feed=False, parse_cs=False):
516 """
513 """
@@ -139,7 +139,7 b''
139 </td>
139 </td>
140 <td>
140 <td>
141 %if section == 'global':
141 %if section == 'global':
142 ${h.bool2icon(k.split('.')[-1] != 'none')}
142 ${h.boolicon(k.split('.')[-1] != 'none')}
143 %else:
143 %else:
144 <span class="perm_tag ${_perm}">${section_perm}</span>
144 <span class="perm_tag ${_perm}">${section_perm}</span>
145 %endif
145 %endif
@@ -221,7 +221,7 b''
221 <tr>
221 <tr>
222 <td>${cache.get_prefix() or '-'}</td>
222 <td>${cache.get_prefix() or '-'}</td>
223 <td>${cache.cache_key}</td>
223 <td>${cache.cache_key}</td>
224 <td>${h.bool2icon(cache.cache_active)}</td>
224 <td>${h.boolicon(cache.cache_active)}</td>
225 </tr>
225 </tr>
226 %endfor
226 %endfor
227 </table>
227 </table>
@@ -225,7 +225,7 b''
225 </td>
225 </td>
226 <td>
226 <td>
227 %if section == 'global':
227 %if section == 'global':
228 ${h.bool2icon(k.split('.')[-1] != 'none')}
228 ${h.boolicon(k.split('.')[-1] != 'none')}
229 %else:
229 %else:
230 <span class="perm_tag ${_perm}">${section_perm}</span>
230 <span class="perm_tag ${_perm}">${section_perm}</span>
231 %endif
231 %endif
@@ -77,7 +77,7 b''
77 </td>
77 </td>
78 <td>
78 <td>
79 %if section == 'global':
79 %if section == 'global':
80 ${h.bool2icon(True)}
80 ${h.boolicon(True)}
81 %else:
81 %else:
82 <span class="perm_tag ${_perm}">${section_perm}</span>
82 <span class="perm_tag ${_perm}">${section_perm}</span>
83 %endif
83 %endif
@@ -40,7 +40,7 b''
40 <tr class="parity${cnt%2}">
40 <tr class="parity${cnt%2}">
41 <td>${h.link_to(u_group.users_group_name,h.url('edit_users_group', id=u_group.users_group_id))}</td>
41 <td>${h.link_to(u_group.users_group_name,h.url('edit_users_group', id=u_group.users_group_id))}</td>
42 <td><span class="tooltip" title="${h.tooltip(', '.join(map(h.safe_unicode,[x.user.username for x in u_group.members[:50]])))}">${len(u_group.members)}</span></td>
42 <td><span class="tooltip" title="${h.tooltip(', '.join(map(h.safe_unicode,[x.user.username for x in u_group.members[:50]])))}">${len(u_group.members)}</span></td>
43 <td>${h.bool2icon(u_group.users_group_active)}</td>
43 <td>${h.boolicon(u_group.users_group_active)}</td>
44 <td>
44 <td>
45 ${h.form(url('users_group', id=u_group.users_group_id),method='delete')}
45 ${h.form(url('users_group', id=u_group.users_group_id),method='delete')}
46 ${h.submit('remove_',_('delete'),id="remove_group_%s" % u_group.users_group_id,
46 ${h.submit('remove_',_('delete'),id="remove_group_%s" % u_group.users_group_id,
General Comments 0
You need to be logged in to leave comments. Login now