{#
/*
 * Spring Signage Ltd - http://www.springsignage.com
 * Copyright (C) 2015 Spring Signage Ltd
 * (${FILE_NAME})
 */
#}

{% extends "form-base.twig" %}
{% import "forms.twig" as forms %}

{% block formTitle %}
    {% trans "Edit Embedded" %}
{% endblock %}

{% block formButtons %}
    {% trans "Help" %}, XiboHelpRender("{{ help }}")
    {% trans "Cancel" %}, XiboDialogClose()
    {% trans "Apply" %}, XiboDialogApply("#embeddedFormEdit")
    {% trans "Save" %}, $("#embeddedFormEdit").submit()
{% endblock %}

{% block formFieldActions %}
    [{
    "field": "useDuration",
    "trigger": "init",
    "value": false,
    "operation": "is:checked",
    "actions": {
    ".duration-fields": { "display": "none" }
    }
    },{
    "field": "useDuration",
    "trigger": "change",
    "value": false,
    "operation": "is:checked",
    "actions": {
    ".duration-fields": { "display": "none" }
    }
    },{
    "field": "useDuration",
    "trigger": "init",
    "value": true,
    "operation": "is:checked",
    "actions": {
    ".duration-fields": { "display": "block" }
    }
    },{
    "field": "useDuration",
    "trigger": "change",
    "value": true,
    "operation": "is:checked",
    "actions": {
    ".duration-fields": { "display": "block" }
    }
    }]
{% endblock %}

{% block formHtml %}
    <div class="row">
        <div class="col-md-12">
            <form id="embeddedFormEdit" class="XiboForm form-horizontal" method="put" action="{{ urlFor("module.widget.edit", {id: module.widget.widgetId}) }}">
                {% set title %}{% trans "Name" %}{% endset %}
                {% set helpText %}{% trans "An optional name for this widget" %}{% endset %}
                {{ forms.input("name", title, module.getOption("name"), helpText) }}

                {% set title %}{% trans "Set a duration?" %}{% endset %}
                {% set helpText %}{% trans "Select to provide a specific duration for this Widget" %}{% endset %}
                {{ forms.checkbox("useDuration", title, module.getUseDuration(), helpText) }}

                {% set title %}{% trans "Duration" %}{% endset %}
                {% set helpText %}{% trans "The duration in seconds this should be displayed" %}{% endset %}
                {{ forms.number("duration", title, module.getDuration(), helpText, "duration-fields", "required") }}

                {% set title %}{% trans "Background transparent?" %}{% endset %}
                {% set helpText %}{% trans "Should the HTML be shown with a transparent background. Not current available on the Windows Display Client." %}{% endset %}
                {{ forms.checkbox("transparency", title, module.getOption("transparency"), helpText) }}

                {% set title %}{% trans "Scale Content?" %}{% endset %}
                {% set helpText %}{% trans "Should the embedded content be scaled along with the layout?" %}{% endset %}
                {{ forms.checkbox("scaleContent", title, module.getOption("scaleContent"), helpText) }}

                {% set helpText %}{% trans "HTML to Embed" %}{% endset %}
                {{ forms.textarea("embedHtml", "", module.getRawNode('embedHtml'), helpText, "", "", 10) }}

                {% set helpText %}{% trans "Custom Style Sheets" %}{% endset %}
                {{ forms.textarea("embedStyle", "", module.getRawNode('embedStyle'), helpText, "", "", 10) }}

                {% set helpText %}{% trans "HEAD content to Embed (including script tags)" %}{% endset %}
                {{ forms.textarea("embedScript", "", module.getRawNode('embedScript'), helpText, "", "", 10) }}
            </form>
        </div>
    </div>
{% endblock %}