12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485 |
- {#
- This file is part of the Sonata package.
- (c) Thomas Rabaix <thomas.rabaix@sonata-project.org>
- For the full copyright and license information, please view the LICENSE
- file that was distributed with this source code.
- #}
- {% extends base_template %}
- {% block actions %}
- <div class="sonata-actions">
- <ul>
- <li class="sonata-action-element"><a href="{{ admin.generateUrl('create') }}">{% trans from admin.translationdomain %}link_action_create{% endtrans %}</a></li>
- <li class="sonata-action-element"><a href="{{ admin.generateUrl('list') }}">{% trans from admin.translationdomain %}link_action_list{% endtrans %}</a></li>
- </ul>
- </div>
- {% endblock %}
- {% block side_menu %}{{ admin.sidemenu(action).render|raw }}{% endblock %}
- {% block form %}
- {% if object.id > 0 %}
- {% set url = 'edit' %}
- {% else %}
- {% set url = 'create' %}
- {% endif %}
- <form action="{{ admin.generateUrl(url, {'id': object.id, 'uniqid': admin.uniqid}) }}" {{ form_enctype(form) }} method="POST">
- {% if form.vars.errors|length > 0 %}
- <div class="sonata-ba-form-error">
- {{ form_errors(form) }}
- </div>
- {% endif %}
- {% for name, form_group in admin.formgroups %}
- {% if name %}
- <fieldset>
- <legend>
- {{ name|trans }}
- {% if form_group.collapsed %}
- <a href="" class="sonata-ba-collapsed">{% trans from 'AdminBundle' %}link_expand{% endtrans %}</a>
- {% endif %}
- </legend>
- <div class="sonata-ba-collapsed-fields">
- {% endif %}
- {% for field_name in form_group.fields %}
- {% if admin.formfielddescriptions[field_name] is defined %}
- {{ admin.formfielddescriptions[field_name]|render_form_element(form, object) }}
- {% endif %}
- {% endfor %}
- {% if name %}
- </div>
- </fieldset>
- {% endif %}
- {% endfor %}
- {{ form_rest(form) }}
- {% if app.request.isxmlhttprequest %}
- {% if object.id %}
- <input type="submit" name="btn_update" value="{% trans from admin.translationdomain %}btn_update{% endtrans %}"/>
- {% else %}
- <input type="submit" name="btn_create" value="{% trans from admin.translationdomain %}btn_create{% endtrans %}"/>
- {% endif %}
- {% else %}
- {% if object.id %}
- <input type="submit" name="btn_update_and_edit" value="{% trans from admin.translationdomain %}btn_update_and_edit_again{% endtrans %}"/>
- <input type="submit" name="btn_update_and_list" value="{% trans from admin.translationdomain %}btn_update_and_return_to_list{% endtrans %}"/>
- {% else %}
- <input type="submit" name="btn_create_and_edit" value="{% trans from admin.translationdomain %}btn_create_and_edit_again{% endtrans %}"/>
- <input type="submit" name="btn_create_and_create" value="{% trans from admin.translationdomain %}btn_create_and_create_a_new_one{% endtrans %}"/>
- {% endif %}
- {% endif %}
- </form>
- {% endblock %}
|