Link to email settings profile when viewing email attempt
This commit is contained in:
parent
7c4e9b56c7
commit
511e185f33
|
@ -425,6 +425,9 @@ class EmailAttemptView(MasterView):
|
||||||
def configure_form(self, f):
|
def configure_form(self, f):
|
||||||
super(EmailAttemptView, self).configure_form(f)
|
super(EmailAttemptView, self).configure_form(f)
|
||||||
|
|
||||||
|
# key
|
||||||
|
f.set_renderer('key', self.render_email_key)
|
||||||
|
|
||||||
# status_code
|
# status_code
|
||||||
f.set_enum('status_code', self.enum.EMAIL_ATTEMPT)
|
f.set_enum('status_code', self.enum.EMAIL_ATTEMPT)
|
||||||
|
|
||||||
|
|
|
@ -911,6 +911,20 @@ class MasterView(View):
|
||||||
url = self.request.route_url('customers.view', uuid=customer.uuid)
|
url = self.request.route_url('customers.view', uuid=customer.uuid)
|
||||||
return tags.link_to(text, url)
|
return tags.link_to(text, url)
|
||||||
|
|
||||||
|
def render_email_key(self, obj, field):
|
||||||
|
if hasattr(obj, field):
|
||||||
|
email_key = getattr(obj, field)
|
||||||
|
else:
|
||||||
|
email_key = obj[field]
|
||||||
|
if not email_key:
|
||||||
|
return
|
||||||
|
|
||||||
|
if self.request.has_perm('emailprofiles.view'):
|
||||||
|
url = self.request.route_url('emailprofiles.view', key=email_key)
|
||||||
|
return tags.link_to(email_key, url)
|
||||||
|
|
||||||
|
return email_key
|
||||||
|
|
||||||
def before_create_flush(self, obj, form):
|
def before_create_flush(self, obj, form):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
|
@ -652,18 +652,6 @@ class ProblemReportView(MasterView):
|
||||||
f.set_renderer('email_key', self.render_email_key)
|
f.set_renderer('email_key', self.render_email_key)
|
||||||
f.set_renderer('email_recipients', self.render_email_recipients)
|
f.set_renderer('email_recipients', self.render_email_recipients)
|
||||||
|
|
||||||
def render_email_key(self, report_info, field):
|
|
||||||
email_key = report_info[field]
|
|
||||||
if not email_key:
|
|
||||||
return
|
|
||||||
|
|
||||||
if self.request.has_perm('emailprofiles.view'):
|
|
||||||
text = email_key
|
|
||||||
url = self.request.route_url('emailprofiles.view', key=email_key)
|
|
||||||
return tags.link_to(text, url)
|
|
||||||
|
|
||||||
return email_key
|
|
||||||
|
|
||||||
def render_email_recipients(self, report_info, field):
|
def render_email_recipients(self, report_info, field):
|
||||||
recips = report_info['email_recipients']
|
recips = report_info['email_recipients']
|
||||||
return ', '.join(recips)
|
return ', '.join(recips)
|
||||||
|
|
Loading…
Reference in a new issue