1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980 |
- {#
- This file is part of the Sonata package.
- (c) Thomas Rabaix <thomas.rabaix@sonata-project.org>
- For the full copyright and license information, please view the LICENSE
- file that was distributed with this source code.
- #}
- {#
- This template is not used at all, it is just a template that you can use to create
- your own custom tree view.
- #}
- {% extends 'SonataAdminBundle:CRUD:base_list.html.twig' %}
- {% import _self as tree %}
- {% macro navigate_child(collection, admin, root) %}
- <ul{% if root %} class="sonata-tree"{% endif %}>
- {% for element in collection if not root %}
- <li>
- <div class="sonata-tree__item">
- {% if element.parent %}<i class="fa fa-caret-right" aria-hidden="true"></i>{% endif %}
- <i class="fa fa-code" aria-hidden="true"></i>
- <a class="sonata-tree__item__edit" href="{{ admin.generateObjectUrl('edit', element) }}">{{ element.name }}</a>
- <i class="text-muted">{{ element.description }}</i>
- <a class="label label-default pull-right" href="{{ admin.generateObjectUrl('edit', element) }}">edit <i class="fa fa-magic" aria-hidden="true"></i></a>
- {% if true %}<span class="label label-warning pull-right">true</span>{% endif %}
- </div>
- {% if element.children|length %}
- {{ _self.navigate_child(element.children, admin, false) }}
- {% endif %}
- </li>
- {% endfor %}
- </ul>
- {% endmacro %}
- {% block tab_menu %}
- {% include 'SonataAdminBundle:CRUD:list_tab_menu.html.twig' with {
- 'mode': 'tree',
- 'action': action,
- 'admin': admin,
- } only %}
- {% endblock %}
- {% block list_table %}
- <div class="col-xs-12 col-md-12">
- <div class="box box-primary">
- <div class="box-header">
- <h1 class="box-title">
- {{ 'element.tree_site_label'|trans({}, admin.translationdomain) }}
- <div class="btn-group">
- <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
- <strong class="text-info">{{ currentSite.name }}</strong> <span class="caret"></span>
- </button>
- <ul class="dropdown-menu" role="menu">
- {% for context in contexts %}
- <li>
- <a href="{{ admin.generateUrl('tree', { 'context': context.id }) }}">
- {% if currentContext and context.id == currentContext.id %}
- <span class="pull-right">
- <i class="fa fa-check" aria-hidden="true"></i>
- </span>
- {% endif %}
- {{ site.name }}
- </a>
- </li>
- {% endfor%}
- </ul>
- </div>
- </h1>
- </div>
- <div class="box-content">
- {{ tree.navigate_child(collection, admin, true) }}
- </div>
- </div>
- </div>
- {% endblock %}
|