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()}
|
${parent.extra_javascript()}
|
||||||
% if not instance.users and request.has_perm('users.create'):
|
% if not instance.users and request.has_perm('users.create'):
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
## TODO: should do this differently for Buefy themes
|
||||||
$(function() {
|
$(function() {
|
||||||
$('#make-user').click(function() {
|
$('#make-user').click(function() {
|
||||||
if (confirm("Really make a user account for this person?")) {
|
if (confirm("Really make a user account for this person?")) {
|
||||||
|
% if not use_buefy:
|
||||||
disable_button(this);
|
disable_button(this);
|
||||||
|
% endif
|
||||||
$('form[name="make-user-form"]').submit();
|
$('form[name="make-user-form"]').submit();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -25,6 +28,7 @@
|
||||||
|
|
||||||
${parent.body()}
|
${parent.body()}
|
||||||
|
|
||||||
|
## TODO: should do this differently for Buefy themes
|
||||||
% if not instance.users and request.has_perm('users.create'):
|
% if not instance.users and request.has_perm('users.create'):
|
||||||
${h.form(url('people.make_user'), name='make-user-form')}
|
${h.form(url('people.make_user'), name='make-user-form')}
|
||||||
${h.csrf_token(request)}
|
${h.csrf_token(request)}
|
||||||
|
|
|
@ -203,6 +203,7 @@ class PeopleView(MasterView):
|
||||||
return HTML.tag('ul', c=items)
|
return HTML.tag('ul', c=items)
|
||||||
|
|
||||||
def render_users(self, person, field):
|
def render_users(self, person, field):
|
||||||
|
use_buefy = self.get_use_buefy()
|
||||||
users = person.users
|
users = person.users
|
||||||
items = []
|
items = []
|
||||||
for user in users:
|
for user in users:
|
||||||
|
@ -212,7 +213,11 @@ class PeopleView(MasterView):
|
||||||
if items:
|
if items:
|
||||||
return HTML.tag('ul', c=items)
|
return HTML.tag('ul', c=items)
|
||||||
elif self.request.has_perm('users.create'):
|
elif self.request.has_perm('users.create'):
|
||||||
return HTML.tag('button', type='button', id='make-user', c="Make User")
|
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:
|
else:
|
||||||
return ""
|
return ""
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue