base_edit.twig.html 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. {#
  2. This file is part of the Sonata package.
  3. (c) Thomas Rabaix <thomas.rabaix@sonata-project.org>
  4. For the full copyright and license information, please view the LICENSE
  5. file that was distributed with this source code.
  6. #}
  7. {% extends base_template %}
  8. {% block title %}
  9. <a href="{{ admin.generateUrl('list') }}">{{ admin.label }}</a> &gt;
  10. {% if object.id %}
  11. {% trans 'title_edit' from 'BaseApplicationBundle'%}
  12. {% else %}
  13. {% trans 'title_create' from 'BaseApplicationBundle'%}
  14. {% endif %}
  15. {% endblock %}
  16. {% block actions %}
  17. <div class="sonata-actions">
  18. <ul>
  19. <li class="sonata-action-element"><a href="{{ admin.generateUrl('create') }}">{% trans "link_action_create" from "BaseApplicationBundle" %}</a></li>
  20. <li class="sonata-action-element"><a href="{{ admin.generateUrl('list') }}">{% trans "link_action_list" from "BaseApplicationBundle" %}</a></li>
  21. </ul>
  22. </div>
  23. {% endblock %}
  24. {% block form %}
  25. <form action="{{ admin.generateUrl('update', {'id': object.id}) }}" method="POST">
  26. {{ form_hidden(form) }}
  27. {% for name, form_group in form_groups %}
  28. {% if name %}
  29. <fieldset>
  30. <legend>
  31. {{ name }}
  32. {% if form_group.collapsed %}
  33. <a href="" class="sonata-ba-collapsed">{% trans 'link_expand' from 'BaseApplicationBundle' %}</a>
  34. {% endif %}
  35. </legend>
  36. <div class="sonata-ba-collapsed-fields">
  37. {% endif %}
  38. {% for field_name in form_group.fields %}
  39. {{ fields[field_name]|render_form_element(form, object) }}
  40. {% endfor %}
  41. {% if name %}
  42. </div>
  43. </fieldset>
  44. {% endif %}
  45. {% endfor %}
  46. {% if app.request.isxmlhttprequest %}
  47. {% if object.id %}
  48. <input type="submit" name="btn_update" value="{% trans "btn_update" from "BaseApplicationBundle" %}"/>
  49. {% else %}
  50. <input type="submit" name="btn_create" value="{% trans "btn_create" from "BaseApplicationBundle" %}"/>
  51. {% endif %}
  52. {% else %}
  53. {% if object.id %}
  54. <input type="submit" name="btn_update_and_edit" value="{% trans "btn_update_and_edit_again" from "BaseApplicationBundle" %}"/>
  55. <input type="submit" name="btn_update_and_list" value="{% trans "btn_update_and_return_to_list" from "BaseApplicationBundle" %}"/>
  56. {% else %}
  57. <input type="submit" name="btn_create_and_edit" value="{% trans "btn_create_and_edit_again" from "BaseApplicationBundle" %}"/>
  58. <input type="submit" name="btn_create_and_create" value="{% trans "btn_create_and_create_a_new_one" from "BaseApplicationBundle" %}"/>
  59. {% endif %}
  60. {% endif %}
  61. </form>
  62. {% endblock %}