Skip to content

Commit

Permalink
Merge pull request #7 from php-nik/master
Browse files Browse the repository at this point in the history
add option rootItemShow in admin class
  • Loading branch information
vitiko committed Apr 3, 2015
2 parents 83eb773 + 5d28af2 commit 2b18189
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 16 deletions.
7 changes: 6 additions & 1 deletion Admin/TreeAdmin.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
class TreeAdmin extends Admin
{


protected $rootItemShow=true;

function getListTemplate()
{
$container = $this->getConfigurationPool()->getContainer();
Expand Down Expand Up @@ -95,6 +96,10 @@ public function getCurrentRoot()

return null;
}

public function isRootItemShow(){
return $this->rootItemShow;
}


}
20 changes: 12 additions & 8 deletions Resources/views/CRUD/tree.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,18 @@


{% set rootWrappedNode = treeIterator.current%}

<!-- root node -->
<table class="trtable" id="rootnodetable" nodeId="{{ rootWrappedNode.id }}"><tr>
{% for field_description in admin.list.elements %}
{{ rootWrappedNode.node|render_list_element(field_description) }}
{% endfor %}
</tr></table>


{% set rootItemShow = admin.rootItemShow is defined and admin.rootItemShow==false ? false : true %}

{% if rootItemShow %}
<!-- root node -->
<table class="trtable" id="rootnodetable" nodeId="{{ rootWrappedNode.id }}"><tr>
{% for field_description in admin.list.elements %}
{{ rootWrappedNode.node|render_list_element(field_description) }}
{% endfor %}
</tr></table>
{% endif %}

<ol class="sortable">
{% for wrappedNode in rootWrappedNode.children %}
{{ _self.nodeOutput(wrappedNode,admin)}}
Expand Down
18 changes: 11 additions & 7 deletions Resources/views/CRUD/treeCollapsible.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -92,13 +92,17 @@


{% set rootWrappedNode = treeIterator.current%}

<!-- root node -->
<table class="trtable" id="rootnodetable" nodeId="{{ rootWrappedNode.id }}"><tr>
{% for field_description in admin.list.elements %}
{{ rootWrappedNode.node|render_list_element(field_description) }}
{% endfor %}
</tr></table>

{% set rootItemShow = admin.rootItemShow is defined and admin.rootItemShow==false ? false : true %}

{% if rootItemShow %}
<!-- root node -->
<table class="trtable" id="rootnodetable" nodeId="{{ rootWrappedNode.id }}"><tr>
{% for field_description in admin.list.elements %}
{{ rootWrappedNode.node|render_list_element(field_description) }}
{% endfor %}
</tr></table>
{% endif %}

<ol class="sortable">
{% for wrappedNode in rootWrappedNode.children %}
Expand Down

0 comments on commit 2b18189

Please sign in to comment.