{% load i18n %}

{% if type == 'input' %}
<form class="web-setting-form web-input-setting-form" action="">
    <h5 class="web-setting-name">{{ setting_display_name }}</h5>
    <div class="web-setting-input">
        <input class="input" type="text" name="{{ setting_name }}" value="{{ setting_val }}" data-cur="{{ setting_val }}" />
        <p class="error hide"></p>
        <p class="tip">{{ help_tip }}</p>
    </div>
    <div class="web-setting-ops">
        <button type="submit" class="submit sf2-icon-tick tick-green vam hide" title="{% trans "Submit" %}"></button>
        <button type="button" class="cancel sf2-icon-x2 vam hide" title="{% trans "Cancel" %}"></button>
    </div>
</form>
{% endif %}

{% if type == 'textarea' %}
<form class="web-setting-form web-textarea-setting-form" action="">
    <h5 class="web-setting-name">{{ setting_display_name }}</h5>
    <div class="web-setting-input">
        <textarea class="textarea" name="{{ setting_name }}" data-cur="{{ setting_val }}">{{ setting_val }}</textarea>
        <p class="error hide"></p>
        <p class="tip">{{ help_tip }}</p>
    </div>
    <div class="web-setting-ops">
        <button type="submit" class="submit sf2-icon-tick tick-green vam hide" title="{% trans "Submit" %}"></button>
        <button type="button" class="cancel sf2-icon-x2 vam hide" title="{% trans "Cancel" %}"></button>
    </div>
</form>
{% endif %}

{% if type == 'code-textarea' %}
<form class="web-setting-form web-textarea-setting-form" action="">
    <h5 class="web-setting-name">{{ setting_display_name }}</h5>
    <div class="web-setting-input">
        <textarea class="textarea code-textarea" name="{{ setting_name }}" data-cur="{{ setting_val }}">{{ setting_val }}</textarea>
        <p class="error hide"></p>
        {% if help_tip %}
        <p class="tip">{{ help_tip }}</p>
        {% endif %}
    </div>
    <div class="web-setting-ops">
        <button type="submit" class="submit sf2-icon-tick tick-green vam hide" title="{% trans "Submit" %}"></button>
        <button type="button" class="cancel sf2-icon-x2 vam hide" title="{% trans "Cancel" %}"></button>
    </div>
</form>
{% endif %}

{% if type == 'checkbox' %}
<form class="web-setting-form web-checkbox-setting-form" action="">{% csrf_token %}
    <h5 class="web-setting-name">{{ setting_display_name }}</h5>
    <div class="web-setting-input">
        <label class="checkbox-label">
            <input class="web-setting-checkbox vam" type="checkbox" name="{{ setting_name }}"{% if setting_val %} checked="checked"{% endif %} />
            <span class="vam">{{ help_tip }}</span>
        </label>
    </div>
</form>
{% endif %}

{% if type == 'file' %}
<form class="web-setting-form" action="">{% csrf_token %}
    <h5 class="web-setting-name">{{ setting_display_name }}</h5>
    <div class="web-setting-input web-setting-file-input">
        <img src="{{ MEDIA_URL }}{{ file_path }}" alt="" width="{{ file_width }}" height="{{file_height}}" class="web-setting-cur-img" />
        <p class="tip">{{ help_tip }}</p>
        <div class="web-setting-file-upload">
            <button type="button" class="web-setting-file-upload-btn">{% trans "Change" %}</button>
            <input type="file" name="{{ setting_name }}" class="web-setting-file-upload-input hide" />
        </div>
    </div>
</form>
{% endif %}
