Add "view profile" helper for all person-related views

This commit is contained in:
Lance Edgar 2019-04-12 15:03:26 -05:00
parent 97345c9710
commit 80158ffa95
5 changed files with 51 additions and 0 deletions

View file

@ -1,5 +1,6 @@
## -*- coding: utf-8; -*-
<%inherit file="/master/view.mako" />
<%namespace file="/util.mako" import="view_profiles_helper" />
<%def name="extra_javascript()">
${parent.extra_javascript()}
@ -18,4 +19,9 @@
% endif
</%def>
<%def name="object_helpers()">
${parent.object_helpers()}
${view_profiles_helper(instance.people)}
</%def>
${parent.body()}

View file

@ -0,0 +1,10 @@
## -*- coding: utf-8; -*-
<%inherit file="/master/view.mako" />
<%namespace file="/util.mako" import="view_profiles_helper" />
<%def name="object_helpers()">
${parent.object_helpers()}
${view_profiles_helper([instance.person])}
</%def>
${parent.body()}

View file

@ -1,5 +1,6 @@
## -*- coding: utf-8; -*-
<%inherit file="/master/view.mako" />
<%namespace file="/util.mako" import="view_profiles_helper" />
<%def name="extra_javascript()">
${parent.extra_javascript()}
@ -17,6 +18,11 @@
% endif
</%def>
<%def name="object_helpers()">
${parent.object_helpers()}
${view_profiles_helper([instance])}
</%def>
${parent.body()}
% if not instance.users and request.has_perm('users.create'):

View file

@ -1,9 +1,17 @@
## -*- coding: utf-8; -*-
<%inherit file="/master/view.mako" />
<%namespace file="/util.mako" import="view_profiles_helper" />
<%def name="extra_styles()">
${parent.extra_styles()}
${h.stylesheet_link(request.static_url('tailbone:static/css/perms.css'))}
</%def>
<%def name="object_helpers()">
${parent.object_helpers()}
% if instance.person:
${view_profiles_helper([instance.person])}
% endif
</%def>
${parent.body()}

View file

@ -0,0 +1,21 @@
## -*- coding: utf-8; -*-
<%def name="view_profile_button(person)">
<div class="buttons">
${h.link_to(person, url('people.view_profile', uuid=person.uuid), class_='button')}
</div>
</%def>
<%def name="view_profiles_helper(people)">
% if request.has_perm('people.view_profile'):
<div class="object-helper">
<h3>Profiles</h3>
<div class="object-helper-content">
<p>View full profile for:</p>
% for person in people:
${view_profile_button(person)}
% endfor
</div>
</div>
% endif
</%def>