Add "make user" button when viewing person w/ no user account

This commit is contained in:
Lance Edgar 2017-10-29 01:18:05 -07:00
parent b26036f366
commit 2bbe6c8346
2 changed files with 68 additions and 5 deletions

View file

@ -0,0 +1,27 @@
## -*- coding: utf-8; -*-
<%inherit file="/master/view.mako" />
<%def name="extra_javascript()">
${parent.extra_javascript()}
% if not instance.users and request.has_perm('users.create'):
<script type="text/javascript">
$(function() {
$('#make-user').click(function() {
if (confirm("Really make a user account for this person?")) {
disable_button(this);
$('form[name="make-user-form"]').submit();
}
});
});
</script>
% endif
</%def>
${parent.body()}
% if not instance.users and request.has_perm('users.create'):
${h.form(url('people.make_user'), name='make-user-form')}
${h.csrf_token(request)}
${h.hidden('person_uuid', value=instance.uuid)}
${h.end_form()}
% endif