list_outer_rows_mosaic.html.twig 4.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  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. <!--
  8. This template can be customized to match your needs. You should only extends the template and used the differents block to customize the view:
  9. - sonata_mosaic_default_view
  10. - sonata_mosaic_hover_view
  11. - sonata_mosaic_description
  12. -->
  13. <tr>
  14. <td colspan="{{ admin.list.elements|length - (app.request.isXmlHttpRequest ? (admin.list.has('_action') + admin.list.has('batch')) : 0) }}">
  15. <div class="row">
  16. {% for object in admin.datagrid.results %}
  17. {% set meta = admin.getObjectMetadata(object) %}
  18. <div class="col-xs-6 col-sm-3 mosaic-box sonata-ba-list-field-batch sonata-ba-list-field" objectId="{{ admin.id(object) }}">
  19. <div class="mosaic-box-outter">
  20. <div class="mosaic-inner-box">
  21. {#
  22. This box will be display when the mouse is not on the box
  23. #}
  24. <div class="mosaic-inner-box-default">
  25. {% block sonata_mosaic_background %}
  26. <img src="{{ meta.image }}" alt="" />
  27. {% endblock %}
  28. {% block sonata_mosaic_default_view %}
  29. <span class="mosaic-box-label label label-primary pull-right">#{{ admin.id(object) }}</span>
  30. {% endblock %}
  31. </div>
  32. {#
  33. This box will be display when the mouse is on the box
  34. You can add more description
  35. #}
  36. <div class="mosaic-inner-box-hover">
  37. {% block sonata_mosaic_hover_view %}
  38. <span class="mosaic-box-label label label-primary pull-right">#{{ admin.id(object) }}</span>
  39. {{ meta.description }}
  40. {% endblock %}
  41. </div>
  42. </div>
  43. <div class="mosaic-inner-text">
  44. {% if (admin.hasRoute('batch') and batchactions|length > 0) or (admin.hasRoute('export') and admin.isGranted("EXPORT") and admin.getExportFormats()|length) %}
  45. <input type="checkbox" name="idx[]" value="{{ admin.id(object) }}">
  46. {% else %}
  47. &nbsp;
  48. {% endif %}
  49. {% block sonata_mosaic_description %}
  50. {% if admin.isGranted('EDIT', object) and admin.hasRoute('edit') %}
  51. <a class="mosaic-inner-link" href="{{ admin.generateUrl('edit', {'id' : object|sonata_urlsafeid(admin) }) }}">{{ meta.title|truncate(40) }}</a>
  52. {% elseif admin.isGranted('VIEW', object) and admin.hasRoute('show') %}
  53. <a class="mosaic-inner-link" href="{{ admin.generateUrl('show', {'id' : object|sonata_urlsafeid(admin) }) }}">{{ meta.title|truncate(40) }}</a>
  54. {% else %}
  55. {{ meta.title|truncate(40) }}
  56. {% endif %}
  57. {% endblock %}
  58. </div>
  59. </div>
  60. </div>
  61. {% if loop.index % 4 == 0 %}
  62. <div class="clearfix hidden-xs"></div>
  63. {% endif %}
  64. {% if loop.index % 2 == 0 %}
  65. <div class="clearfix visible-xs"></div>
  66. {% endif %}
  67. {% endfor %}
  68. </div>
  69. </td>
  70. </tr>