base_edit.twig.html 3.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  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 side_menu %}{% if side_menu %}{{ side_menu.render|raw }}{% endif %}{% endblock %}
  25. {% block form %}
  26. <form action="{{ admin.generateUrl('update', {'id': object.id}) }}" method="POST">
  27. {{ form_hidden(form) }}
  28. {% if form.errors %}
  29. <div class="sonata-ba-form-error">
  30. {{ form_errors(form) }}
  31. </div>
  32. {% endif %}
  33. {% for name, form_group in form_groups %}
  34. {% if name %}
  35. <fieldset>
  36. <legend>
  37. {{ name }}
  38. {% if form_group.collapsed %}
  39. <a href="" class="sonata-ba-collapsed">{% trans 'link_expand' from 'BaseApplicationBundle' %}</a>
  40. {% endif %}
  41. </legend>
  42. <div class="sonata-ba-collapsed-fields">
  43. {% endif %}
  44. {% for field_name in form_group.fields %}
  45. {% if fields[field_name] is defined %}
  46. {{ fields[field_name]|render_form_element(form, object) }}
  47. {% endif %}
  48. {% endfor %}
  49. {% if name %}
  50. </div>
  51. </fieldset>
  52. {% endif %}
  53. {% endfor %}
  54. {% if app.request.isxmlhttprequest %}
  55. {% if object.id %}
  56. <input type="submit" name="btn_update" value="{% trans "btn_update" from "BaseApplicationBundle" %}"/>
  57. {% else %}
  58. <input type="submit" name="btn_create" value="{% trans "btn_create" from "BaseApplicationBundle" %}"/>
  59. {% endif %}
  60. {% else %}
  61. {% if object.id %}
  62. <input type="submit" name="btn_update_and_edit" value="{% trans "btn_update_and_edit_again" from "BaseApplicationBundle" %}"/>
  63. <input type="submit" name="btn_update_and_list" value="{% trans "btn_update_and_return_to_list" from "BaseApplicationBundle" %}"/>
  64. {% else %}
  65. <input type="submit" name="btn_create_and_edit" value="{% trans "btn_create_and_edit_again" from "BaseApplicationBundle" %}"/>
  66. <input type="submit" name="btn_create_and_create" value="{% trans "btn_create_and_create_a_new_one" from "BaseApplicationBundle" %}"/>
  67. {% endif %}
  68. {% endif %}
  69. </form>
  70. {% endblock %}