Convert Roles to use master view.

Also tweak the grid API here and there.
This commit is contained in:
Lance Edgar 2015-08-11 15:01:21 -05:00
parent 585eb09bec
commit 9605d44b05
14 changed files with 144 additions and 281 deletions

View file

@ -0,0 +1,9 @@
## -*- coding: utf-8 -*-
<%inherit file="/master/create.mako" />
<%def name="head_tags()">
${parent.head_tags()}
${h.stylesheet_link(request.static_url('tailbone:static/css/perms.css'))}
</%def>
${parent.body()}

View file

@ -1,22 +0,0 @@
## -*- coding: utf-8 -*-
<%inherit file="/crud.mako" />
<%def name="head_tags()">
${parent.head_tags()}
${h.stylesheet_link(request.static_url('tailbone:static/css/perms.css'))}
</%def>
<%def name="context_menu_items()">
<li>${h.link_to("Back to Roles", url('roles'))}</li>
% if form.readonly:
<li>${h.link_to("Edit this Role", url('role.update', uuid=form.fieldset.model.uuid))}</li>
% elif form.updating:
<li>${h.link_to("View this Role", url('role.read', uuid=form.fieldset.model.uuid))}</li>
% endif
<li>${h.link_to("Delete this Role", url('role.delete', uuid=form.fieldset.model.uuid), class_='delete')}</li>
% if version_count is not Undefined and request.has_perm('role.versions.view'):
<li>${h.link_to("View Change History ({0})".format(version_count), url('role.versions', uuid=form.fieldset.model.uuid))}</li>
% endif
</%def>
${parent.body()}

View file

@ -0,0 +1,16 @@
## -*- coding: utf-8 -*-
<%inherit file="/master/edit.mako" />
<%def name="head_tags()">
${parent.head_tags()}
${h.stylesheet_link(request.static_url('tailbone:static/css/perms.css'))}
</%def>
<%def name="context_menu_items()">
${parent.context_menu_items()}
% if version_count is not Undefined and request.has_perm('role.versions.view'):
<li>${h.link_to("View Change History ({0})".format(version_count), url('role.versions', uuid=instance.uuid))}</li>
% endif
</%def>
${parent.body()}

View file

@ -1,12 +0,0 @@
## -*- coding: utf-8 -*-
<%inherit file="/grid.mako" />
<%def name="title()">Roles</%def>
<%def name="context_menu_items()">
% if request.has_perm('roles.create'):
<li>${h.link_to("Create a new Role", url('role.create'))}</li>
% endif
</%def>
${parent.body()}

View file

@ -1,37 +0,0 @@
## -*- coding: utf-8 -*-
<%inherit file="/roles/crud.mako" />
${parent.body()}
<h2>Users</h2>
% if role is guest_role:
<p>The guest role is implied for all users.</p>
% elif role.users:
<p>The following users are assigned to this role:</p>
<br />
<div class="grid clickable">
<table>
<thead>
<th>Username</th>
<th>Full Name</th>
</thead>
<tbody>
% for i, user in enumerate(role.users, 1):
<tr class="${'odd' if i % 2 else 'even'}" url="${url('user.read', uuid=user.uuid)}">
<td>${user.username}
<td>${user.display_name}</td>
</tr>
% endfor
</tbody>
</table>
</div>
% else:
<p>There are no users assigned to this role.</p>
% endif

View file

@ -0,0 +1,27 @@
## -*- coding: utf-8 -*-
<%inherit file="/master/view.mako" />
<%def name="head_tags()">
${parent.head_tags()}
${h.stylesheet_link(request.static_url('tailbone:static/css/perms.css'))}
</%def>
<%def name="context_menu_items()">
${parent.context_menu_items()}
% if version_count is not Undefined and request.has_perm('role.versions.view'):
<li>${h.link_to("View Change History ({0})".format(version_count), url('role.versions', uuid=instance.uuid))}</li>
% endif
</%def>
${parent.body()}
<h2>Users</h2>
% if instance is guest_role:
<p>The guest role is implied for all users.</p>
% elif users:
<p>The following users are assigned to this role:</p>
${users.render_grid()|n}
% else:
<p>There are no users assigned to this role.</p>
% endif