fix: allow view supplements to add extra links for profile employee tab
This commit is contained in:
parent
793a15883e
commit
89d7009a18
|
@ -1274,8 +1274,7 @@
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div>
|
<div style="display: flex; gap: 0.75rem;">
|
||||||
<div class="buttons">
|
|
||||||
|
|
||||||
% if request.has_perm('people_profile.toggle_employee'):
|
% if request.has_perm('people_profile.toggle_employee'):
|
||||||
|
|
||||||
|
@ -1410,6 +1409,17 @@
|
||||||
</${b}-modal>
|
</${b}-modal>
|
||||||
% endif
|
% endif
|
||||||
|
|
||||||
|
<div style="display: flex; flex-direction: column; align-items: right; gap: 0.75rem;">
|
||||||
|
|
||||||
|
<b-button v-for="link in employee.external_links"
|
||||||
|
:key="link.url"
|
||||||
|
type="is-primary"
|
||||||
|
tag="a" :href="link.url" target="_blank"
|
||||||
|
icon-pack="fas"
|
||||||
|
icon-left="external-link-alt">
|
||||||
|
{{ link.label }}
|
||||||
|
</b-button>
|
||||||
|
|
||||||
% if request.has_perm('employees.view'):
|
% if request.has_perm('employees.view'):
|
||||||
<b-button v-if="employee.view_url"
|
<b-button v-if="employee.view_url"
|
||||||
tag="a" :href="employee.view_url">
|
tag="a" :href="employee.view_url">
|
||||||
|
|
|
@ -803,6 +803,12 @@ class PersonView(MasterView):
|
||||||
app = self.get_rattail_app()
|
app = self.get_rattail_app()
|
||||||
handler = app.get_employment_handler()
|
handler = app.get_employment_handler()
|
||||||
context = handler.get_context_employee(employee)
|
context = handler.get_context_employee(employee)
|
||||||
|
context.setdefault('external_links', [])
|
||||||
|
|
||||||
|
for supp in self.iter_view_supplements():
|
||||||
|
if hasattr(supp, 'get_context_for_employee'):
|
||||||
|
context = supp.get_context_for_employee(employee, context)
|
||||||
|
|
||||||
context['view_url'] = self.request.route_url('employees.view', uuid=employee.uuid)
|
context['view_url'] = self.request.route_url('employees.view', uuid=employee.uuid)
|
||||||
return context
|
return context
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue