Tweak email config views, to support subject "templates"
This commit is contained in:
parent
cfd6e87cff
commit
083f8ecde0
|
@ -96,7 +96,7 @@ class ProfilesView(MasterView):
|
||||||
'fallback_key': email.fallback_key,
|
'fallback_key': email.fallback_key,
|
||||||
'description': email.__doc__,
|
'description': email.__doc__,
|
||||||
'prefix': email.get_prefix(data),
|
'prefix': email.get_prefix(data),
|
||||||
'subject': email.get_subject(data),
|
'subject': email.get_subject(data, render=False),
|
||||||
'sender': email.get_sender(),
|
'sender': email.get_sender(),
|
||||||
'replyto': email.get_replyto(),
|
'replyto': email.get_replyto(),
|
||||||
'to': get_recips('to'),
|
'to': get_recips('to'),
|
||||||
|
@ -127,7 +127,7 @@ class ProfilesView(MasterView):
|
||||||
return self.normalize(mail.get_email(self.rattail_config, key))
|
return self.normalize(mail.get_email(self.rattail_config, key))
|
||||||
|
|
||||||
def get_instance_title(self, email):
|
def get_instance_title(self, email):
|
||||||
return email['_email'].get_complete_subject()
|
return email['_email'].get_complete_subject(render=False)
|
||||||
|
|
||||||
def make_form(self, email, **kwargs):
|
def make_form(self, email, **kwargs):
|
||||||
"""
|
"""
|
||||||
|
@ -228,11 +228,18 @@ class EmailPreview(View):
|
||||||
self.request.response.content_type = b'text/plain'
|
self.request.response.content_type = b'text/plain'
|
||||||
return self.request.response
|
return self.request.response
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def defaults(cls, config):
|
||||||
|
# email preview
|
||||||
|
config.add_route('email.preview', '/email/preview/')
|
||||||
|
config.add_view(cls, route_name='email.preview',
|
||||||
|
renderer='/email/preview.mako',
|
||||||
|
permission='emailprofiles.preview')
|
||||||
|
config.add_tailbone_permission('emailprofiles', 'emailprofiles.preview',
|
||||||
|
"Send preview email")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def includeme(config):
|
def includeme(config):
|
||||||
ProfilesView.defaults(config)
|
ProfilesView.defaults(config)
|
||||||
|
EmailPreview.defaults(config)
|
||||||
config.add_route('email.preview', '/email/preview/')
|
|
||||||
config.add_view(EmailPreview, route_name='email.preview',
|
|
||||||
renderer='/email/preview.mako',
|
|
||||||
permission='admin')
|
|
||||||
|
|
Loading…
Reference in a new issue