blessing-skin-server/resources/views/forms/form.twig
2020-03-24 18:44:45 +08:00

76 lines
2.4 KiB
Twig

<div class="card card-{{ type }}">
<div class="card-header">
<h3 class="card-title">{{ title }} {{ hint|raw }}</h3>
</div>
<form method="post">
{{ csrf_field() }}
<input type="hidden" name="option" value="{{ id }}">
<div class="card-body">
{% for message in messages %}
<div class="callout callout-{{ message.type }}">
{{ message.content|raw }}
</div>
{% endfor %}
{% for alert in alerts %}
<div class="alert alert-{{ alert.type }}">
{% if alert.type == 'success' %}
<i class="fas fa-check icon"></i>
{% elseif alert.type == 'info' %}
<i class="fas fa-info icon"></i>
{% elseif alert.type == 'warning' %}
<i class="fas fa-exclamation-triangle icon"></i>
{% elseif alert.type == 'danger' %}
<i class="fas fa-times-circle icon"></i>
{% endif %}
<span>{{ alert.content }}</span>
</div>
{% endfor %}
{% if renderWithoutTable %}
{% for item in items %}
{{ item.render()|raw }}
{% if item.description %}
<p class="description">{{ item.description|raw }}</p>
{% endif %}
{% endfor %}
{% else %}
<div class="container-fluid">
{% for item in items %}
<div class="row {{ loop.index == 1 ? 'mb-3' : (loop.index == loop.length ? 'mt-3' : 'my-3') }}">
{% if not renderInputTagsOnly %}
<div class="col-sm-4">
{{ item.name }} {{ item.hint|raw }}
</div>
{% endif %}
<div class="col-sm-{{ renderInputTagsOnly ? '12' : '8' }}">
{{ item.render()|raw }}
{% if item.description %}
<p class="description">{{ item.description|raw }}</p>
{% endif %}
</div>
</div>
{% endfor %}
</div>
{% endif %}
</div>
<div class="card-footer">
{% for button in buttons %}
{% if button.href %}
<a href="{{ button.href }}" class="{{ button.class|join(' ') }}">
{{ button.text|raw }}
</a>
{% else %}
<button
type="{{ button.type }}"
name="{{ button.name }}"
class="{{ button.class|join(' ') }}"
>
{{ button.text|raw }}
</button>
{% endif %}
{% endfor %}
</div>
</form>
</div>