Tweak permissions styles for view/edit of User, Role
per Buefy themes, but still compatible with jQuery theme also
This commit is contained in:
parent
40ab3cda9c
commit
ea0aff1a3e
|
@ -3,12 +3,13 @@
|
||||||
* Permission Lists
|
* Permission Lists
|
||||||
******************************/
|
******************************/
|
||||||
|
|
||||||
.field-wrapper.permissions .field .group {
|
.permissions-group {
|
||||||
margin-bottom: 10px;
|
margin-bottom: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.field-wrapper.permissions .field .group p {
|
.permissions-group .group-label {
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
|
margin-bottom: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.field-wrapper.permissions .field label {
|
.field-wrapper.permissions .field label {
|
||||||
|
@ -21,12 +22,12 @@
|
||||||
margin-right: 10px;
|
margin-right: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.field-wrapper.permissions .field .group p.perm {
|
.permissions-group .perm {
|
||||||
font-weight: normal;
|
font-weight: normal;
|
||||||
margin-left: 15px;
|
margin-left: 15px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.field-wrapper.permissions .field .group p.perm span {
|
.permissions-group p.perm span {
|
||||||
font-family: monospace;
|
font-family: monospace;
|
||||||
margin-right: 10px;
|
margin-right: 10px;
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,10 +3,12 @@
|
||||||
tal:omit-tag="">
|
tal:omit-tag="">
|
||||||
${field.start_mapping()}
|
${field.start_mapping()}
|
||||||
|
|
||||||
|
<div class="permissions-outer">
|
||||||
|
|
||||||
<tal:loop tal:repeat="groupkey sorted(permissions, key=lambda k: permissions[k]['label'].lower())">
|
<tal:loop tal:repeat="groupkey sorted(permissions, key=lambda k: permissions[k]['label'].lower())">
|
||||||
<div tal:define="perms permissions[groupkey]['perms'];"
|
<div tal:define="perms permissions[groupkey]['perms'];"
|
||||||
class="group">
|
class="permissions-group">
|
||||||
<p class="group">${permissions[groupkey]['label']}</p>
|
<p class="group-label">${permissions[groupkey]['label']}</p>
|
||||||
|
|
||||||
<tal:loop tal:repeat="key sorted(perms, key=lambda p: perms[p]['label'].lower())">
|
<tal:loop tal:repeat="key sorted(perms, key=lambda p: perms[p]['label'].lower())">
|
||||||
<div class="perm">
|
<div class="perm">
|
||||||
|
@ -24,5 +26,7 @@
|
||||||
</div>
|
</div>
|
||||||
</tal:loop>
|
</tal:loop>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
${field.end_mapping()}
|
${field.end_mapping()}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -147,7 +147,7 @@ class PermissionsRenderer(Object):
|
||||||
principal = self.principal
|
principal = self.principal
|
||||||
html = ''
|
html = ''
|
||||||
for groupkey in sorted(self.permissions, key=lambda k: self.permissions[k]['label'].lower()):
|
for groupkey in sorted(self.permissions, key=lambda k: self.permissions[k]['label'].lower()):
|
||||||
inner = HTML.tag('p', c=self.permissions[groupkey]['label'])
|
inner = HTML.tag('p', class_='group-label', c=self.permissions[groupkey]['label'])
|
||||||
perms = self.permissions[groupkey]['perms']
|
perms = self.permissions[groupkey]['perms']
|
||||||
rendered = False
|
rendered = False
|
||||||
for key in sorted(perms, key=lambda p: perms[p]['label'].lower()):
|
for key in sorted(perms, key=lambda p: perms[p]['label'].lower()):
|
||||||
|
@ -160,5 +160,5 @@ class PermissionsRenderer(Object):
|
||||||
inner += HTML.tag('p', class_='perm', c=[span, HTML(' '), label])
|
inner += HTML.tag('p', class_='perm', c=[span, HTML(' '), label])
|
||||||
rendered = True
|
rendered = True
|
||||||
if rendered:
|
if rendered:
|
||||||
html += HTML.tag('div', class_='group', c=[inner])
|
html += HTML.tag('div', class_='permissions-group', c=[inner])
|
||||||
return html or "(none granted)"
|
return HTML.tag('div', class_='permissions-outer', c=[html or "(none granted)"])
|
||||||
|
|
|
@ -93,6 +93,8 @@ class RolesView(PrincipalMasterView):
|
||||||
if has_permission(self.Session(), role, key, include_guest=False, include_authenticated=False):
|
if has_permission(self.Session(), role, key, include_guest=False, include_authenticated=False):
|
||||||
granted.append(key)
|
granted.append(key)
|
||||||
f.set_default('permissions', granted)
|
f.set_default('permissions', granted)
|
||||||
|
elif self.deleting:
|
||||||
|
f.remove_field('permissions')
|
||||||
|
|
||||||
# session_timeout
|
# session_timeout
|
||||||
f.set_renderer('session_timeout', self.render_session_timeout)
|
f.set_renderer('session_timeout', self.render_session_timeout)
|
||||||
|
|
Loading…
Reference in a new issue