From bb0e2fb9e94fff96390a2fba2607f4ff8a69f187 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Wed, 3 Jul 2019 12:35:14 -0500 Subject: [PATCH] Add way to hide "view profile" helper for customer view --- tailbone/templates/customers/view.mako | 2 +- tailbone/views/customers.py | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/tailbone/templates/customers/view.mako b/tailbone/templates/customers/view.mako index 7ec2662e..6c9de1ce 100644 --- a/tailbone/templates/customers/view.mako +++ b/tailbone/templates/customers/view.mako @@ -21,7 +21,7 @@ <%def name="object_helpers()"> ${parent.object_helpers()} - % if instance.people: + % if show_profiles_helper and instance.people: ${view_profiles_helper(instance.people)} % endif diff --git a/tailbone/views/customers.py b/tailbone/views/customers.py index cc473531..e8ada107 100644 --- a/tailbone/views/customers.py +++ b/tailbone/views/customers.py @@ -54,6 +54,9 @@ class CustomersView(MasterView): people_detachable = True touchable = True + # whether to show "view full profile" helper for customer view + show_profiles_helper = True + labels = { 'id': "ID", 'default_phone': "Phone Number", @@ -245,6 +248,10 @@ class CustomersView(MasterView): f.set_renderer('groups', self.render_groups) f.set_readonly('groups') + def template_kwargs_view(self, **kwargs): + kwargs['show_profiles_helper'] = self.show_profiles_helper + return kwargs + def unique_id(self, node, value): query = self.Session.query(model.Customer)\ .filter(model.Customer.id == value)