Add Buefy support for email preview buttons
This commit is contained in:
parent
a0cd1f4cd0
commit
4a92b05b57
|
@ -1,8 +1,9 @@
|
||||||
## -*- coding: utf-8; -*-
|
## -*- coding: utf-8; -*-
|
||||||
<%inherit file="/master/view.mako" />
|
<%inherit file="/master/view.mako" />
|
||||||
|
|
||||||
<%def name="head_tags()">
|
<%def name="extra_javascript()">
|
||||||
${parent.head_tags()}
|
${parent.extra_javascript()}
|
||||||
|
% if not use_buefy:
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
% if not email.get_template('html'):
|
% if not email.get_template('html'):
|
||||||
$(function() {
|
$(function() {
|
||||||
|
@ -17,10 +18,72 @@
|
||||||
});
|
});
|
||||||
% endif
|
% endif
|
||||||
</script>
|
</script>
|
||||||
|
% endif
|
||||||
</%def>
|
</%def>
|
||||||
|
|
||||||
${parent.body()}
|
${parent.body()}
|
||||||
|
|
||||||
|
% if use_buefy:
|
||||||
|
|
||||||
|
${h.form(url('email.preview'))}
|
||||||
|
${h.csrf_token(request)}
|
||||||
|
${h.hidden('email_key', value=instance['key'])}
|
||||||
|
|
||||||
|
<div class="field is-grouped">
|
||||||
|
|
||||||
|
<div class="control">
|
||||||
|
% if email.get_template('html'):
|
||||||
|
<a class="button"
|
||||||
|
href="${url('email.preview')}?key=${instance['key']}&type=html"
|
||||||
|
target="_blank">
|
||||||
|
Preview HTML
|
||||||
|
</a>
|
||||||
|
% else:
|
||||||
|
<button class="button"
|
||||||
|
type="button"
|
||||||
|
title="There is no HTML template on file for this email."
|
||||||
|
disabled>
|
||||||
|
Preview HTML
|
||||||
|
</button>
|
||||||
|
% endif
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="control">
|
||||||
|
% if email.get_template('txt'):
|
||||||
|
<a class="button"
|
||||||
|
href="${url('email.preview')}?key=${instance['key']}&type=txt"
|
||||||
|
target="_blank">
|
||||||
|
Preview TXT
|
||||||
|
</a>
|
||||||
|
% else:
|
||||||
|
<button class="button"
|
||||||
|
type="button"
|
||||||
|
title="There is no TXT template on file for this email."
|
||||||
|
disabled>
|
||||||
|
Preview TXT
|
||||||
|
</button>
|
||||||
|
% endif
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="control">
|
||||||
|
or
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="control">
|
||||||
|
<input name="recipient" type="email" class="input" value="${request.user.email_address or ''}" />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="control">
|
||||||
|
<input type="submit" class="button" name="send_${instance['key']}" value="Send Preview Email" />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div><!-- field -->
|
||||||
|
|
||||||
|
${h.end_form()}
|
||||||
|
|
||||||
|
% else:
|
||||||
|
## not buefy; do traditional thing
|
||||||
|
|
||||||
${h.form(url('email.preview'), name='send-email-preview', class_='autodisable')}
|
${h.form(url('email.preview'), name='send-email-preview', class_='autodisable')}
|
||||||
${h.csrf_token(request)}
|
${h.csrf_token(request)}
|
||||||
${h.hidden('email_key', value=instance['key'])}
|
${h.hidden('email_key', value=instance['key'])}
|
||||||
|
@ -30,3 +93,5 @@ ${h.form(url('email.preview'), name='send-email-preview', class_='autodisable')}
|
||||||
${h.text('recipient', value=request.user.email_address or '')}
|
${h.text('recipient', value=request.user.email_address or '')}
|
||||||
${h.submit('send_{}'.format(instance['key']), value="Send Preview Email")}
|
${h.submit('send_{}'.format(instance['key']), value="Send Preview Email")}
|
||||||
${h.end_form()}
|
${h.end_form()}
|
||||||
|
|
||||||
|
% endif
|
||||||
|
|
|
@ -318,8 +318,8 @@
|
||||||
## Bulma 0.7.4
|
## Bulma 0.7.4
|
||||||
${h.stylesheet_link('https://cdnjs.cloudflare.com/ajax/libs/bulma/0.7.4/css/bulma.min.css')}
|
${h.stylesheet_link('https://cdnjs.cloudflare.com/ajax/libs/bulma/0.7.4/css/bulma.min.css')}
|
||||||
|
|
||||||
## Buefy 0.7.3
|
## Buefy 0.7.4
|
||||||
${h.stylesheet_link('https://unpkg.com/buefy@0.7.3/dist/buefy.min.css')}
|
${h.stylesheet_link('https://unpkg.com/buefy@0.7.4/dist/buefy.min.css')}
|
||||||
|
|
||||||
## ${self.jquery_theme()}
|
## ${self.jquery_theme()}
|
||||||
## ${h.stylesheet_link(request.static_url('tailbone:static/css/jquery.loadmask.css'))}
|
## ${h.stylesheet_link(request.static_url('tailbone:static/css/jquery.loadmask.css'))}
|
||||||
|
|
|
@ -294,7 +294,6 @@ class MasterView(View):
|
||||||
|
|
||||||
context = {
|
context = {
|
||||||
'grid': grid,
|
'grid': grid,
|
||||||
'use_buefy': use_buefy,
|
|
||||||
}
|
}
|
||||||
return self.render_to_response('index', context)
|
return self.render_to_response('index', context)
|
||||||
|
|
||||||
|
@ -2088,6 +2087,7 @@ class MasterView(View):
|
||||||
"""
|
"""
|
||||||
context = {
|
context = {
|
||||||
'master': self,
|
'master': self,
|
||||||
|
'use_buefy': self.get_use_buefy(),
|
||||||
'mobile': mobile,
|
'mobile': mobile,
|
||||||
'model_title': self.get_model_title(),
|
'model_title': self.get_model_title(),
|
||||||
'model_title_plural': self.get_model_title_plural(),
|
'model_title_plural': self.get_model_title_plural(),
|
||||||
|
|
Loading…
Reference in a new issue