Add in anchor link, and update link in notification history.

This commit is contained in:
Nicholas Staples
2016-03-17 10:59:47 +00:00
parent a13ecc5cb5
commit 0411238dd9
3 changed files with 8 additions and 2 deletions

View File

@@ -2,6 +2,7 @@ import os
import re
import dateutil
import urllib
from flask import (Flask, session, Markup, escape, render_template, make_response, current_app)
from flask._compat import string_types
from flask_login import LoginManager
@@ -75,6 +76,7 @@ def create_app(config_name, config_overrides=None):
application.add_template_filter(format_time)
application.add_template_filter(syntax_highlight_json)
application.add_template_filter(valid_phone_number)
application.add_template_filter(linkable_name)
application.after_request(useful_headers_after_request)
register_errorhandlers(application)
@@ -139,6 +141,10 @@ def nl2br(value):
return Markup(result)
def linkable_name(value):
return urllib.parse.quote_plus(value)
def syntax_highlight_json(code):
return Markup(highlight(code, JavascriptLexer(), HtmlFormatter(noclasses=True)))

View File

@@ -4,7 +4,7 @@
{% if name %}
<h3 class="sms-message-name">
{% if edit_link %}
<a href="{{ edit_link }}">{{ name }}</a>
<a name="{{ name|linkable_name }}" href="{{ edit_link }}">{{ name }}</a>
{% else %}
{{ name }}
{% endif %}

View File

@@ -21,7 +21,7 @@
{{ item.to }}
{% endcall %}
{% call field() %}
<a href="{{ url_for(".edit_service_template", service_id=service_id, template_id=item.template.id) }}">{{ item.template.name }}</a>
<a href="{{ url_for(".choose_template", service_id=service_id, template_type=item.template.template_type, _anchor=item.template.name|linkable_name) }}">{{ item.template.name }}</a>
{% endcall %}
{% call field() %}
{{ item.template.template_type }}