base_history.html.twig 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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 actions %}
  9. <div class="sonata-actions btn-group">
  10. {% include 'SonataAdminBundle:Button:edit_button.html.twig' %}
  11. {% include 'SonataAdminBundle:Button:acl_button.html.twig' %}
  12. {% include 'SonataAdminBundle:Button:show_button.html.twig' %}
  13. {% include 'SonataAdminBundle:Button:list_button.html.twig' %}
  14. </div>
  15. {% endblock %}
  16. {% block content %}
  17. <div class="span5">
  18. <table class="table" id="revisions">
  19. <thead>
  20. <tr>
  21. <th>{{ "td_revision"|trans({}, 'SonataAdminBundle') }}</th>
  22. <th>{{ "td_timestamp"|trans({}, 'SonataAdminBundle') }}</th>
  23. <th>{{ "td_username"|trans({}, 'SonataAdminBundle') }}</th>
  24. <th>{{ "td_action"|trans({}, 'SonataAdminBundle') }}</th>
  25. </tr>
  26. </thead>
  27. <tbody>
  28. {% for revision in revisions %}
  29. <tr>
  30. <td>{{ revision.rev}}</td>
  31. <td>{% include admin.getTemplate('history_revision_timestamp') %}</td>
  32. <td>{{ revision.username}}</td>
  33. <td><a href="{{ admin.generateObjectUrl('history_view_revision', object, {'revision': revision.rev }) }}" class="revision-link" rel="{{ revision.rev }}">{{ "label_view_revision"|trans({}, 'SonataAdminBundle') }}</a></td>
  34. </tr>
  35. {% endfor %}
  36. </tbody>
  37. </table>
  38. </div>
  39. <div id="revision-detail" class="span7 revision-detail">
  40. </div>
  41. <script type="text/javascript">
  42. jQuery(document).ready(function() {
  43. jQuery('a.revision-link').bind('click', function(event) {
  44. event.stopPropagation();
  45. event.preventDefault();
  46. jQuery('#revision-detail').html('');
  47. jQuery('table#revisions tbody tr').removeClass('current');
  48. jQuery(this).parent('').removeClass('current');
  49. jQuery.ajax({
  50. url: jQuery(this).attr('href'),
  51. dataType: 'html',
  52. success: function(data) {
  53. jQuery('#revision-detail').html(data);
  54. }
  55. });
  56. return false;
  57. })
  58. });
  59. </script>
  60. {% endblock %}