Add <once-button> for sending email preview; various other tweaks

This commit is contained in:
Lance Edgar 2019-06-06 15:58:46 -05:00
parent 0a80e01d0b
commit f10a80333b
4 changed files with 40 additions and 17 deletions

View file

@ -35,7 +35,13 @@
${h.form(request.current_route_url(), class_=None if form.use_buefy else 'autodisable')}
${h.csrf_token(request)}
<div class="buttons">
% if use_buefy:
<once-button tag="a" href="${form.cancel_url}"
text="Whoops, nevermind...">
</once-button>
% else:
<a class="button" href="${form.cancel_url}">Whoops, nevermind...</a>
% endif
% if form.use_buefy:
<once-button type="is-primary" native-type="submit"
text="Yes, please DELETE this data forever!">

View file

@ -23,20 +23,8 @@
<%def name="object_helpers()"></%def>
<div style="display: flex; justify-content: space-between;">
${self.render_form_complete()}
<div class="form-wrapper">
${form.render()|n}
</div><!-- form-wrapper -->
<div style="display: flex;">
<div class="object-helpers">
${self.object_helpers()}
</div>
<ul id="context-menu">
${self.context_menu_items()}
</ul>
</div>
</div>
% if use_buefy:
${self.make_tailbone_form_app()}
% endif

View file

@ -25,6 +25,8 @@ ${parent.body()}
% if use_buefy:
<script type="text/x-template" id="email-preview-tools-template">
${h.form(url('email.preview'))}
${h.csrf_token(request)}
${h.hidden('email_key', value=instance['key'])}
@ -74,12 +76,38 @@ ${parent.body()}
</div>
<div class="control">
<input type="submit" class="button is-primary" name="send_${instance['key']}" value="Send Preview Email" />
<once-button type="is-primary"
native-type="submit"
text="Send Preview Email">
</once-button>
</div>
</div><!-- field -->
${h.end_form()}
</script>
<script type="text/javascript">
const EmailPreviewTools = {
template: '#email-preview-tools-template'
}
Vue.component('email-preview-tools', EmailPreviewTools)
</script>
<div id="email-preview-tools-app">
<email-preview-tools></email-preview-tools>
</div>
<script type="text/javascript">
new Vue({
el: '#email-preview-tools-app'
})
</script>
% else:
## not buefy; do traditional thing

View file

@ -3280,6 +3280,7 @@ class MasterView(View):
'readonly': self.viewing,
'model_class': getattr(self, 'model_row_class', None),
'action_url': self.request.current_route_url(_query=None),
'use_buefy': self.get_use_buefy(),
}
if self.creating:
kwargs.setdefault('cancel_url', self.request.get_referrer())