1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192 |
- {#
- 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>
- {% if admin.id(object) and admin.isGranted('VIEW') and admin.getViewFieldDescriptions is not empty %}
- <li class="sonata-action-element"><a href="{{ admin.generateUrl('view', {'id' : admin.id(object)}) }}">{% trans from 'SonataAdminBundle' %}link_action_view{% endtrans %}</a></li>
- {% endif %}
- {% if admin.isGranted('CREATE')%}
- <li class="sonata-action-element"><a href="{{ admin.generateUrl('create') }}">{% trans from 'SonataAdminBundle' %}link_action_create{% endtrans %}</a></li>
- {% endif %}
- {% if admin.isGranted('LIST')%}
- <li class="sonata-action-element"><a href="{{ admin.generateUrl('list') }}">{% trans from 'SonataAdminBundle' %}link_action_list{% endtrans %}</a></li>
- {% endif %}
- </ul>
- </div>
- {% endblock %}
- {% block side_menu %}{{ admin.sidemenu(action).render|raw }}{% endblock %}
- {% block form %}
- {% if admin.id(object) %}
- {% set url = 'edit' %}
- {% else %}
- {% set url = 'create' %}
- {% endif %}
- <form action="{{ admin.generateUrl(url, {'id': admin.id(object), '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({}, admin.translationdomain) }}
- {% if form_group.collapsed %}
- <a href="" class="sonata-ba-collapsed">{% trans from 'SonataAdminBundle' %}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 admin.id(object) %}
- <input type="submit" name="btn_update" value="{% trans from 'SonataAdminBundle' %}btn_update{% endtrans %}"/>
- {% else %}
- <input type="submit" name="btn_create" value="{% trans from 'SonataAdminBundle' %}btn_create{% endtrans %}"/>
- {% endif %}
- {% else %}
- {% if admin.id(object) %}
- <input type="submit" name="btn_update_and_edit" value="{% trans from 'SonataAdminBundle' %}btn_update_and_edit_again{% endtrans %}"/>
- <input type="submit" name="btn_update_and_list" value="{% trans from 'SonataAdminBundle' %}btn_update_and_return_to_list{% endtrans %}"/>
- {% else %}
- <input type="submit" name="btn_create_and_edit" value="{% trans from 'SonataAdminBundle' %}btn_create_and_edit_again{% endtrans %}"/>
- <input type="submit" name="btn_create_and_create" value="{% trans from 'SonataAdminBundle' %}btn_create_and_create_a_new_one{% endtrans %}"/>
- {% endif %}
- {% endif %}
- </form>
- {% endblock %}
|