diff --git a/tailbone/templates/people/view_profile.mako b/tailbone/templates/people/view_profile.mako
new file mode 100644
index 00000000..35a4e700
--- /dev/null
+++ b/tailbone/templates/people/view_profile.mako
@@ -0,0 +1,155 @@
+## -*- coding: utf-8; -*-
+<%inherit file="/master/view.mako" />
+
+<%def name="extra_javascript()">
+ ${parent.extra_javascript()}
+
+%def>
+
+
+
+
+
+
+
+
+
+
+ ${person.first_name}
+
+
+
+
+
+
+
+
+ ${person.middle_name}
+
+
+
+
+
+
+
+
+ ${person.last_name}
+
+
+
+
+
+
+
+
+ ${person.address.street if person.address else ''}
+
+
+
+
+
+
+
+
+ ${person.address.street2 if person.address else ''}
+
+
+
+
+
+
+
+
+ ${person.address.city if person.address else ''}
+
+
+
+
+
+
+
+
+ ${person.address.state if person.address else ''}
+
+
+
+
+
+
+
+
+ ${person.address.zipcode if person.address else ''}
+
+
+
+
+
+
+
+ % for customer in person.customers:
+
+
+
+
+
+ ${customer.id or ''}
+
+
+
+
+
+
+
+
+ ${customer.name}
+
+
+
+
+ % endfor
+
+
+
+ % if person.employee:
+
+
+
+
+
+ ${person.employee.id or ''}
+
+
+
+
+
+
+
+
+ ${person.employee.display_name or ''}
+
+
+
+
+
+
+
+
+ ${enum.EMPLOYEE_STATUS[person.employee.status]}
+
+
+
+
+ % else:
+
${person} has never been an employee.
+ % endif
+
+
+
diff --git a/tailbone/views/people.py b/tailbone/views/people.py
index cdf40766..ec201ac3 100644
--- a/tailbone/views/people.py
+++ b/tailbone/views/people.py
@@ -225,6 +225,20 @@ class PeopleView(MasterView):
(model.VendorContact, 'person_uuid'),
]
+ def view_profile(self):
+ """
+ View which exposes the "full profile" for a given person, i.e. all
+ related customer, employee, user info etc.
+ """
+ self.viewing = True
+ person = self.get_instance()
+ context = {
+ 'person': person,
+ 'instance': person,
+ 'instance_title': self.get_instance_title(person),
+ }
+ return self.render_to_response('view_profile', context)
+
def make_user(self):
uuid = self.request.POST['person_uuid']
person = self.Session.query(model.Person).get(uuid)
@@ -249,8 +263,19 @@ class PeopleView(MasterView):
@classmethod
def _people_defaults(cls, config):
+ permission_prefix = cls.get_permission_prefix()
route_prefix = cls.get_route_prefix()
url_prefix = cls.get_url_prefix()
+ model_key = cls.get_model_key()
+ model_title = cls.get_model_title()
+
+ # view profile
+ config.add_tailbone_permission(permission_prefix, '{}.view_profile'.format(permission_prefix),
+ "View full \"profile\" for {}".format(model_title))
+ config.add_route('{}.view_profile'.format(route_prefix), '{}/{{{}}}/profile'.format(url_prefix, model_key),
+ request_method='GET')
+ config.add_view(cls, attr='view_profile', route_name='{}.view_profile'.format(route_prefix),
+ permission='{}.view_profile'.format(permission_prefix))
# make user for person
config.add_route('{}.make_user'.format(route_prefix), '{}/make-user'.format(url_prefix),