|
@@ -14,8 +14,8 @@ file that was distributed with this source code.
|
|
|
{% block actions %}
|
|
|
<div class="sonata-actions">
|
|
|
<ul>
|
|
|
- {% if admin.isGranted('VIEW')%}
|
|
|
- <li class="sonata-action-element"><a href="{{ admin.generateUrl('view', {'id' : object.id}) }}">{% trans from 'SonataAdminBundle' %}link_action_view{% endtrans %}</a></li>
|
|
|
+ {% if admin.id(object) and admin.isGranted('VIEW')%}
|
|
|
+ <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>
|
|
@@ -31,13 +31,13 @@ file that was distributed with this source code.
|
|
|
|
|
|
{% block form %}
|
|
|
|
|
|
- {% if object.id > 0 %}
|
|
|
+ {% if admin.id(object) > 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">
|
|
|
+ <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">
|
|
@@ -74,13 +74,13 @@ file that was distributed with this source code.
|
|
|
{{ form_rest(form) }}
|
|
|
|
|
|
{% if app.request.isxmlhttprequest %}
|
|
|
- {% if object.id %}
|
|
|
+ {% 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 object.id %}
|
|
|
+ {% 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 %}
|