block_search_result.html.twig 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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 sonata_block.templates.block_base %}
  8. {% block block %}
  9. <div class="span3">
  10. <div>
  11. <h4>
  12. {% if admin.hasRoute('list') %}
  13. <a href="{{ admin.generateUrl('list') }}">{{ admin.label|trans({}, admin.translationdomain) }}</a>
  14. {% else %}
  15. {{ admin.label|trans({}, admin.translationdomain) }}
  16. {% endif %}
  17. {% if pager and pager.getNbResults() > 0 %}
  18. <span class="label label-info">{{ pager.getNbResults() }}</span>
  19. {% endif %}
  20. </h4>
  21. </div>
  22. <ul>
  23. {% if pager %}
  24. {% for result in pager.getResults() %}
  25. {% if admin.hasRoute('edit') %}
  26. <li><a href="{{ admin.generateObjectUrl('edit', result) }}">{{ admin.toString(result) }}</a></li>
  27. {% else %}
  28. <li><i>{{ admin.toString(result) }}</i></li>
  29. {% endif %}
  30. {% else %}
  31. {% if admin.hasRoute('create') %}
  32. <li><i>{{ 'no_results_found'|trans({}, 'SonataAdminBundle') }} ~ <a href="{{ admin.generateUrl('create') }}">{{ 'add_new_entry'|trans({}, 'SonataAdminBundle') }}</a></i></li>
  33. {% else %}
  34. <li><i>{{ 'no_results_found'|trans({}, 'SonataAdminBundle') }}</i></li>
  35. {% endif %}
  36. {% endfor %}
  37. {% else %}
  38. {% if admin.hasRoute('create') %}
  39. <li><i>{{ 'no_results_found'|trans({}, 'SonataAdminBundle') }} ~ <a href="{{ admin.generateUrl('create') }}">{{ 'add_new_entry'|trans({}, 'SonataAdminBundle') }}</a></i></li>
  40. {% else %}
  41. <li><i>{{ 'no_results_found'|trans({}, 'SonataAdminBundle') }}</i></li>
  42. {% endif %}
  43. {% endif %}
  44. </ul>
  45. </div>
  46. {% endblock %}