Add basic Buefy support for "Make User" button when viewing Person
this still relies on jQuery for now, but has Buefy styles at least...
This commit is contained in:
parent
f4f435c682
commit
eea3f671af
|
@ -6,10 +6,13 @@
|
|||
${parent.extra_javascript()}
|
||||
% if not instance.users and request.has_perm('users.create'):
|
||||
<script type="text/javascript">
|
||||
## TODO: should do this differently for Buefy themes
|
||||
$(function() {
|
||||
$('#make-user').click(function() {
|
||||
if (confirm("Really make a user account for this person?")) {
|
||||
% if not use_buefy:
|
||||
disable_button(this);
|
||||
% endif
|
||||
$('form[name="make-user-form"]').submit();
|
||||
}
|
||||
});
|
||||
|
@ -25,6 +28,7 @@
|
|||
|
||||
${parent.body()}
|
||||
|
||||
## TODO: should do this differently for Buefy themes
|
||||
% if not instance.users and request.has_perm('users.create'):
|
||||
${h.form(url('people.make_user'), name='make-user-form')}
|
||||
${h.csrf_token(request)}
|
||||
|
|
|
@ -203,6 +203,7 @@ class PeopleView(MasterView):
|
|||
return HTML.tag('ul', c=items)
|
||||
|
||||
def render_users(self, person, field):
|
||||
use_buefy = self.get_use_buefy()
|
||||
users = person.users
|
||||
items = []
|
||||
for user in users:
|
||||
|
@ -212,6 +213,10 @@ class PeopleView(MasterView):
|
|||
if items:
|
||||
return HTML.tag('ul', c=items)
|
||||
elif self.request.has_perm('users.create'):
|
||||
if use_buefy:
|
||||
return HTML.tag('button', type='button', class_='button is-primary',
|
||||
id='make-user', c="Make User")
|
||||
else:
|
||||
return HTML.tag('button', type='button', id='make-user', c="Make User")
|
||||
else:
|
||||
return ""
|
||||
|
|
Loading…
Reference in a new issue