You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
haproxy-wi/app/templates/include/input_macros.html

50 lines
1.9 KiB

{% macro input(id, name='', value='', type='text', size='', readonly='', required='', placeholder='', autofocus='', title='', class='form-control', style='') -%}
{% if name == '' %}
{% set name = id %}
{% endif %}
{# {% if readonly == '' %}
{% set readonly = 'readonly onfocus=this.removeAttribute(\'readonly\');' %}
{% endif %} #}
<input type="{{ type }}" name="{{name}}" value="{{ value|e }}" id="{{ id }}" size="{{size}}" style="{{style}}" {{readonly}} {{required}} {{autofocus}} placeholder="{{placeholder}}" title="{{title}}" class="{{class}}" autocomplete="off" />
{%- endmacro %}
{%- macro checkbox(id, name='', checked='', title='', value='', desc='', disabled='') -%}
{% if name == '' %}
{% set name = id %}
{% endif %}
{% if disabled == 'true' %}
{% set disabled = 'disabled' %}
{% endif %}
<label for="{{id}}" title="{{title}}" class="{{id}}">{{desc}}</label><input name="{{name}}" type="checkbox" id="{{id}}" value="{{value|e}}" {{checked}} {{disabled}} />
{%- endmacro %}
{%- macro select(id, values, name='', required='', first='', class='', selected='', disabled='true') -%}
{% if name == '' %}
{% set name = id %}
{% endif %}
{% if disabled == 'true' %}
{% set disabled = 'disabled' %}
{% else %}
{% set disabled = '' %}
{% endif %}
<select {{required}} name="{{name}}" id="{{id}}" class="{{class}}">
{% if first %}
<option {{disabled}} selected>{{first}}</option>
{% endif %}
{% for v, des in values.items() %}
{% if v == selected %}
<option value="{{v}}" selected>{{des}}</option>
{% else %}
<option value="{{v}}">{{des}}</option>
{% endif %}
{% endfor %}
</select>
{%- endmacro %}
{%- macro copy_to_clipboard(id='', value='', show='', style='', class='') -%}
{% if show == '' %}
{% set show = value %}
{% endif %}
<span id="{{id}}" style="{{style}}" class="copyToClipboard {{class}}" data-copy="{{value}}" title="Copy {{value}} to clipboard">{{show}}</span>
{%- endmacro %}