gist/src/Gist/Resources/views/Home/index.html.twig
2015-05-06 20:39:51 +02:00

96 lines
5.1 KiB
Twig

{% extends 'base.html.twig' %}
{% block body %}
<div class="row">
<form action="{{ path('home') }}" method="post" id="main-form">
<div class="col-md-12">
<div class="panel panel-default">
<div class="panel-heading">
{{ form_widget(form.title) }}
</div>
<div class="panel-body">
<p class="text-primary hide" id="cipher-alert">
<span class="glyphicon glyphicon-info-sign"></span>
{{ 'form.cipher.alert'|trans }}
</p>
<div class="btn-toolbar">
<div class="btn-group" id="options">
<div class="btn-group">
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
<span id="type-label" data-tpl="{{ 'form.type.label'|trans }}">
</span>
<span class="caret"></span>
</button>
<ul class="dropdown-menu">
{% for item in form.type.vars.choices %}
<li>
<input
{% if item.value == form.type.vars.value %}checked{% endif %}
data-id="#type-label" type="radio" class="hide"
data-title="{{ item.label }}"
value="{{ item.value }}"
name="form[type]"
id="type-{{ loop.index }}" />
<a href="#">
<label for="type-{{ loop.index }}">
{{ item.label }}
</label>
</a>
</li>
{% endfor %}
</ul>
</div>
<div class="btn-group">
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
<span id="cipher-label" data-tpl="{{ 'form.cipher.label'|trans }}">
</span>
<span class="caret"></span>
</button>
<ul class="dropdown-menu" role="menu">
{% for item in form.cipher.vars.choices %}
<li>
<input
{% if item.value == form.cipher.vars.value %}checked{% endif %}
data-id="#cipher-label" type="radio" class="hide cipher-input"
data-title="{{ item.label }}"
value="{{ item.value }}"
name="form[cipher]"
id="cipher-{{ loop.index }}" />
<a href="#">
<label for="cipher-{{ loop.index }}">
{{ item.label }}
</label>
</a>
</li>
{% endfor %}
</ul>
</div>
</div>
</div>
<p>
{{ form_errors(form.content) }}
{{ form_widget(form.content) }}
</p>
<p>
<input type="submit" class="btn btn-primary" value="Envoyer">
</p>
</div>
</div>
</div>
{{ form_widget(form._token) }}
</form>
</div>
{% endblock %}
{% block js %}
{{ parent() }}
{% if gist is not null %}
<script type="text/javascript">
document.location.href = '{{ path("view", {gist: gist.file}) }}'{% if gist.cipher %} + '#' + (document.location.href).split('#')[1]{% endif %};
</script>
{% endif %}
{% endblock %}