diff options
Diffstat (limited to 'module')
| -rw-r--r-- | module/web/pyload/templatetags/__init__.py | 0 | ||||
| -rw-r--r-- | module/web/pyload/templatetags/contains.py | 14 | ||||
| -rw-r--r-- | module/web/templates/default/settings.html | 3 | 
3 files changed, 16 insertions, 1 deletions
| diff --git a/module/web/pyload/templatetags/__init__.py b/module/web/pyload/templatetags/__init__.py new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/module/web/pyload/templatetags/__init__.py diff --git a/module/web/pyload/templatetags/contains.py b/module/web/pyload/templatetags/contains.py new file mode 100644 index 000000000..ed6225a95 --- /dev/null +++ b/module/web/pyload/templatetags/contains.py @@ -0,0 +1,14 @@ +from django import template +register = template.Library() + +@register.filter() +def contains(value, arg): +    """  +      Usage: +        {% if text|contains:" http://"  %} +          This is a link. +    {% else %} +    Not a link. +    {% endif %} +    """  +    return arg in value diff --git a/module/web/templates/default/settings.html b/module/web/templates/default/settings.html index 07c87a936..d9aef5303 100644 --- a/module/web/templates/default/settings.html +++ b/module/web/templates/default/settings.html @@ -1,5 +1,6 @@  {% extends 'default/base.html' %}  {% load i18n %} +{% load contains %}  {% block title %}{% trans "Config" %} - {{block.super}} {% endblock %}  {% block subtitle %}{% trans "Config" %}{% endblock %} @@ -49,7 +50,7 @@                  <option {% if not option.value %} selected="selected" {% endif %}value="False">{% trans "off" %}</option>          </select>          {% else %} -        {% if ";" in option.typ %} +        {% if option.typ|contains:";" %}          <select id="{{skey}}|{{okey}}" name="{{skey}}|{{okey}}">                  {% for entry in option.list %}                  <option {% ifequal option.value entry %} selected="selected" {% endifequal %}>{{entry}}</option> | 
