Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
soullivaneuh committed Oct 26, 2015
2 parents 5b3e18d + 8196f30 commit b6ff023
Show file tree
Hide file tree
Showing 26 changed files with 114 additions and 65 deletions.
44 changes: 44 additions & 0 deletions Resources/doc/cookbook/recipe_lock_protection.rst
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,50 @@ You can enable it in your ``sonata_admin`` configuration :
sonata_admin:
options:
lock_protection: true
You must also configure each entity that you want to support by adding a field called ``$version`` on which the Doctrine ``Version`` feature is activated.

Using Annotations:

.. code-block:: php
<?php
// src/AppBundle/Entity/Car.php
namespace AppBundle\Entity\Car;
use Doctrine\ORM\Mapping as ORM;
class Car
{
// ...
/**
* @ORM\Column(type="integer")
* @ORM\Version
*/
protected $version;
// ...
}
Using XML:

.. code-block:: xml
<?xml version="1.0" encoding="utf-8"?>
<!-- src/AppBundle/Resources/orm/Car.orm.xml -->
<doctrine-mapping>
<entity name="AppBundle\Entity\Car">
<!-- ... -->
<field name="version" type="integer" version="true" />
<!-- ... -->
</entity>
</doctrine-mapping>
For more information about this visit the `Doctrine docs <http://doctrine-orm.readthedocs.org/en/latest/reference/transactions-and-concurrency.html?highlight=optimistic#optimistic-locking>`_

.. note::

Expand Down
23 changes: 13 additions & 10 deletions Resources/public/Admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ var Admin = {
shared_setup: function(subject) {
Admin.log("[core|shared_setup] Register services on", subject);
Admin.set_object_field_value(subject);
Admin.add_filters(subject);
Admin.setup_select2(subject);
Admin.setup_icheck(subject);
Admin.add_filters(subject);
Admin.setup_xeditable(subject);
Admin.add_pretty_errors(subject);
Admin.setup_form_tabs_for_errors(subject);
Expand Down Expand Up @@ -517,15 +517,18 @@ var Admin = {

// On form submit, transform value to match what is expected by server
subject.parents('form:first').submit(function (event) {
var values = subject.val().split(',');
var baseName = subject.attr('name');
baseName = baseName.substring(0, baseName.length-1);
for (var i=0; i<values.length; i++) {
jQuery('<input>')
.attr('type', 'hidden')
.attr('name', baseName+i+']')
.val(values[i])
.appendTo(subject.parents('form:first'));
var values = subject.val().trim();
if (values !== '') {
var baseName = subject.attr('name');
values = values.split(',');
baseName = baseName.substring(0, baseName.length-1);
for (var i=0; i<values.length; i++) {
jQuery('<input>')
.attr('type', 'hidden')
.attr('name', baseName+i+']')
.val(values[i])
.appendTo(subject.parents('form:first'));
}
}
subject.remove();
});
Expand Down
6 changes: 3 additions & 3 deletions Resources/translations/SonataAdminBundle.ar.xliff
Original file line number Diff line number Diff line change
Expand Up @@ -452,15 +452,15 @@
</trans-unit>
<trans-unit id="stats_view_more">
<source>stats_view_more</source>
<target>View more</target>
<target>stats_view_more</target>
</trans-unit>
<trans-unit id="title_select_subclass">
<source>title_select_subclass</source>
<target>Select object type</target>
<target>title_select_subclass</target>
</trans-unit>
<trans-unit id="no_subclass_available">
<source>no_subclass_available</source>
<target>No object types available</target>
<target>no_subclass_available</target>
</trans-unit>
</body>
</file>
Expand Down
4 changes: 2 additions & 2 deletions Resources/translations/SonataAdminBundle.bg.xliff
Original file line number Diff line number Diff line change
Expand Up @@ -456,11 +456,11 @@
</trans-unit>
<trans-unit id="title_select_subclass">
<source>title_select_subclass</source>
<target>Select object type</target>
<target>title_select_subclass</target>
</trans-unit>
<trans-unit id="no_subclass_available">
<source>no_subclass_available</source>
<target>No object types available</target>
<target>no_subclass_available</target>
</trans-unit>
</body>
</file>
Expand Down
4 changes: 2 additions & 2 deletions Resources/translations/SonataAdminBundle.ca.xliff
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@
</trans-unit>
<trans-unit id="td_compare">
<source>td_compare</source>
<target>td_compare</target>
<target>Compara</target>
</trans-unit>
<trans-unit id="td_revision">
<source>td_revision</source>
Expand All @@ -340,7 +340,7 @@
</trans-unit>
<trans-unit id="label_compare_revision">
<source>label_compare_revision</source>
<target>label_compare_revision</target>
<target>Compara revisió</target>
</trans-unit>
<trans-unit id="list_results_count_prefix">
<source>list_results_count_prefix</source>
Expand Down
4 changes: 2 additions & 2 deletions Resources/translations/SonataAdminBundle.cs.xliff
Original file line number Diff line number Diff line change
Expand Up @@ -456,11 +456,11 @@
</trans-unit>
<trans-unit id="title_select_subclass">
<source>title_select_subclass</source>
<target>Select object type</target>
<target>title_select_subclass</target>
</trans-unit>
<trans-unit id="no_subclass_available">
<source>no_subclass_available</source>
<target>No object types available</target>
<target>no_subclass_available</target>
</trans-unit>
</body>
</file>
Expand Down
4 changes: 2 additions & 2 deletions Resources/translations/SonataAdminBundle.es.xliff
Original file line number Diff line number Diff line change
Expand Up @@ -456,11 +456,11 @@
</trans-unit>
<trans-unit id="title_select_subclass">
<source>title_select_subclass</source>
<target>Select object type</target>
<target>title_select_subclass</target>
</trans-unit>
<trans-unit id="no_subclass_available">
<source>no_subclass_available</source>
<target>No object types available</target>
<target>no_subclass_available</target>
</trans-unit>
</body>
</file>
Expand Down
4 changes: 2 additions & 2 deletions Resources/translations/SonataAdminBundle.eu.xliff
Original file line number Diff line number Diff line change
Expand Up @@ -456,11 +456,11 @@
</trans-unit>
<trans-unit id="title_select_subclass">
<source>title_select_subclass</source>
<target>Select object type</target>
<target>title_select_subclass</target>
</trans-unit>
<trans-unit id="no_subclass_available">
<source>no_subclass_available</source>
<target>No object types available</target>
<target>no_subclass_available</target>
</trans-unit>
</body>
</file>
Expand Down
4 changes: 2 additions & 2 deletions Resources/translations/SonataAdminBundle.fa.xliff
Original file line number Diff line number Diff line change
Expand Up @@ -456,11 +456,11 @@
</trans-unit>
<trans-unit id="title_select_subclass">
<source>title_select_subclass</source>
<target>Select object type</target>
<target>title_select_subclass</target>
</trans-unit>
<trans-unit id="no_subclass_available">
<source>no_subclass_available</source>
<target>No object types available</target>
<target>no_subclass_available</target>
</trans-unit>
</body>
</file>
Expand Down
4 changes: 2 additions & 2 deletions Resources/translations/SonataAdminBundle.fr.xliff
Original file line number Diff line number Diff line change
Expand Up @@ -456,11 +456,11 @@
</trans-unit>
<trans-unit id="title_select_subclass">
<source>title_select_subclass</source>
<target>Select object type</target>
<target>title_select_subclass</target>
</trans-unit>
<trans-unit id="no_subclass_available">
<source>no_subclass_available</source>
<target>No object types available</target>
<target>no_subclass_available</target>
</trans-unit>
</body>
</file>
Expand Down
4 changes: 2 additions & 2 deletions Resources/translations/SonataAdminBundle.hr.xliff
Original file line number Diff line number Diff line change
Expand Up @@ -456,11 +456,11 @@
</trans-unit>
<trans-unit id="title_select_subclass">
<source>title_select_subclass</source>
<target>Select object type</target>
<target>title_select_subclass</target>
</trans-unit>
<trans-unit id="no_subclass_available">
<source>no_subclass_available</source>
<target>No object types available</target>
<target>no_subclass_available</target>
</trans-unit>
</body>
</file>
Expand Down
4 changes: 2 additions & 2 deletions Resources/translations/SonataAdminBundle.ja.xliff
Original file line number Diff line number Diff line change
Expand Up @@ -456,11 +456,11 @@
</trans-unit>
<trans-unit id="title_select_subclass">
<source>title_select_subclass</source>
<target>Select object type</target>
<target>title_select_subclass</target>
</trans-unit>
<trans-unit id="no_subclass_available">
<source>no_subclass_available</source>
<target>No object types available</target>
<target>no_subclass_available</target>
</trans-unit>
</body>
</file>
Expand Down
4 changes: 2 additions & 2 deletions Resources/translations/SonataAdminBundle.lb.xliff
Original file line number Diff line number Diff line change
Expand Up @@ -456,11 +456,11 @@
</trans-unit>
<trans-unit id="title_select_subclass">
<source>title_select_subclass</source>
<target>Select object type</target>
<target>title_select_subclass</target>
</trans-unit>
<trans-unit id="no_subclass_available">
<source>no_subclass_available</source>
<target>No object types available</target>
<target>no_subclass_available</target>
</trans-unit>
</body>
</file>
Expand Down
4 changes: 2 additions & 2 deletions Resources/translations/SonataAdminBundle.lt.xliff
Original file line number Diff line number Diff line change
Expand Up @@ -456,11 +456,11 @@
</trans-unit>
<trans-unit id="title_select_subclass">
<source>title_select_subclass</source>
<target>Select object type</target>
<target>title_select_subclass</target>
</trans-unit>
<trans-unit id="no_subclass_available">
<source>no_subclass_available</source>
<target>No object types available</target>
<target>no_subclass_available</target>
</trans-unit>
</body>
</file>
Expand Down
4 changes: 2 additions & 2 deletions Resources/translations/SonataAdminBundle.nl.xliff
Original file line number Diff line number Diff line change
Expand Up @@ -456,11 +456,11 @@
</trans-unit>
<trans-unit id="title_select_subclass">
<source>title_select_subclass</source>
<target>Select object type</target>
<target>title_select_subclass</target>
</trans-unit>
<trans-unit id="no_subclass_available">
<source>no_subclass_available</source>
<target>No object types available</target>
<target>no_subclass_available</target>
</trans-unit>
</body>
</file>
Expand Down
2 changes: 1 addition & 1 deletion Resources/translations/SonataAdminBundle.no.xliff
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,7 @@
</trans-unit>
<trans-unit id="stats_view_more">
<source>stats_view_more</source>
<target>View more</target>
<target>stats_view_more</target>
</trans-unit>
<trans-unit id="title_select_subclass">
<source>title_select_subclass</source>
Expand Down
4 changes: 2 additions & 2 deletions Resources/translations/SonataAdminBundle.pl.xliff
Original file line number Diff line number Diff line change
Expand Up @@ -456,11 +456,11 @@
</trans-unit>
<trans-unit id="title_select_subclass">
<source>title_select_subclass</source>
<target>Select object type</target>
<target>title_select_subclass</target>
</trans-unit>
<trans-unit id="no_subclass_available">
<source>no_subclass_available</source>
<target>No object types available</target>
<target>no_subclass_available</target>
</trans-unit>
</body>
</file>
Expand Down
4 changes: 2 additions & 2 deletions Resources/translations/SonataAdminBundle.pt.xliff
Original file line number Diff line number Diff line change
Expand Up @@ -456,11 +456,11 @@
</trans-unit>
<trans-unit id="title_select_subclass">
<source>title_select_subclass</source>
<target>Select object type</target>
<target>title_select_subclass</target>
</trans-unit>
<trans-unit id="no_subclass_available">
<source>no_subclass_available</source>
<target>No object types available</target>
<target>no_subclass_available</target>
</trans-unit>
</body>
</file>
Expand Down
4 changes: 2 additions & 2 deletions Resources/translations/SonataAdminBundle.pt_BR.xliff
Original file line number Diff line number Diff line change
Expand Up @@ -456,11 +456,11 @@
</trans-unit>
<trans-unit id="title_select_subclass">
<source>title_select_subclass</source>
<target>Select object type</target>
<target>title_select_subclass</target>
</trans-unit>
<trans-unit id="no_subclass_available">
<source>no_subclass_available</source>
<target>No object types available</target>
<target>no_subclass_available</target>
</trans-unit>
</body>
</file>
Expand Down
4 changes: 2 additions & 2 deletions Resources/translations/SonataAdminBundle.ro.xliff
Original file line number Diff line number Diff line change
Expand Up @@ -456,11 +456,11 @@
</trans-unit>
<trans-unit id="title_select_subclass">
<source>title_select_subclass</source>
<target>Select object type</target>
<target>title_select_subclass</target>
</trans-unit>
<trans-unit id="no_subclass_available">
<source>no_subclass_available</source>
<target>No object types available</target>
<target>no_subclass_available</target>
</trans-unit>
</body>
</file>
Expand Down
4 changes: 2 additions & 2 deletions Resources/translations/SonataAdminBundle.ru.xliff
Original file line number Diff line number Diff line change
Expand Up @@ -456,11 +456,11 @@
</trans-unit>
<trans-unit id="title_select_subclass">
<source>title_select_subclass</source>
<target>Select object type</target>
<target>title_select_subclass</target>
</trans-unit>
<trans-unit id="no_subclass_available">
<source>no_subclass_available</source>
<target>No object types available</target>
<target>no_subclass_available</target>
</trans-unit>
</body>
</file>
Expand Down
4 changes: 2 additions & 2 deletions Resources/translations/SonataAdminBundle.sk.xliff
Original file line number Diff line number Diff line change
Expand Up @@ -456,11 +456,11 @@
</trans-unit>
<trans-unit id="title_select_subclass">
<source>title_select_subclass</source>
<target>Select object type</target>
<target>title_select_subclass</target>
</trans-unit>
<trans-unit id="no_subclass_available">
<source>no_subclass_available</source>
<target>No object types available</target>
<target>no_subclass_available</target>
</trans-unit>
</body>
</file>
Expand Down
4 changes: 2 additions & 2 deletions Resources/translations/SonataAdminBundle.sl.xliff
Original file line number Diff line number Diff line change
Expand Up @@ -456,11 +456,11 @@
</trans-unit>
<trans-unit id="title_select_subclass">
<source>title_select_subclass</source>
<target>Select object type</target>
<target>title_select_subclass</target>
</trans-unit>
<trans-unit id="no_subclass_available">
<source>no_subclass_available</source>
<target>No object types available</target>
<target>no_subclass_available</target>
</trans-unit>
</body>
</file>
Expand Down
Loading

0 comments on commit b6ff023

Please sign in to comment.