{% extends "layout2.html" %} {% load i18n %} {% load static %} {% block css_include %} {% endblock %} {% block js_include %} {% endblock %} {% block content %}
{% if form.non_field_errors %}
{# Print form errors correctly #}

{% translate "Form errors" %}

{{ form.non_field_errors|safe }}
{# If there is save/configuration errors #} {% if save_error %} {% endif %}
{% endif %}
{% csrf_token %}
{% endblock %} {% block jquery_code %} if (!String.prototype.endsWith) { String.prototype.endsWith = function(searchString, position) { var subjectString = this.toString(); if (typeof position !== 'number' || !isFinite(position) || Math.floor(position) !== position || position > subjectString.length) { position = subjectString.length; } position -= searchString.length; var lastIndex = subjectString.lastIndexOf(searchString, position); return lastIndex !== -1 && lastIndex === position; }; } //$(function() { /* Switchery mandatory code */ var elems = Array.prototype.slice.call(document.querySelectorAll('.js-switch')); elems.forEach(function(html) { var switchery = new Switchery(html, { 'color': '#FA9834', }); }); /* Initialize select2 objects */ $('.select2').select2(); /* Error modes bind */ $('.mode').on("change", function(e) { var value = $(this).val(); // Retrieve the id of the selected item var id = $(this).attr('id'); // With its id, retrieve the 2 associated inputs (_html and _url) var code = id.substring(3, id.lastIndexOf("_mode")); console.log(code); if( value === "display" ) { $('.'+code+'_html').show(); $('.'+code+'_url').hide(); } else { $('.'+code+'_html').hide(); $('.'+code+'_url').show(); } }); $('.mode').trigger("change"); $('.tag-editor').css({"min-width": "100px"}); //}); // end of function() {% endblock %}