Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[NodeBundle] StructureNode now have a folder icon in the pages tree #830

Merged
merged 1 commit into from
Nov 30, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions src/Kunstmaan/AdminBundle/Helper/Menu/MenuItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -396,6 +396,30 @@ public function setOffline($offline)
return $this;
}

/**
* Get menu item folder state
*
* @return bool
*/
public function getFolder()
{
return $this->folder;
}

/**
* Set menu item folder state
*
* @param bool $folder
*
* @return MenuItem
*/
public function setFolder($folder)
{
$this->folder = $folder;

return $this;
}

/**
* Get appearInNavigation flag
*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
{% set nodeId = menuitem.uniqueId %}

<li id="{{ nodeId }}"{% if menuitem.offline %} data-jstree='{"type":"offline"}'{% endif %}
{% if menuitem.attributes.page is defined %}
{% if menuitem.attributes.page.icon is defined %}
data-jstree='{{ {"icon": menuitem.attributes.page.icon}|json_encode }}'
{% endif %}
data-page="{{ menuitem.attributes.page|json_encode }}"
<li id="{{ nodeId }}"
{% if menuitem.folder %}
data-jstree='{"type":"folder"}'
{% elseif menuitem.offline %}
data-jstree='{"type":"offline"}'
{% endif %}
{% if menuitem.attributes.page is defined %}
{% if menuitem.attributes.page.icon is defined %}
data-jstree='{{ {"icon": menuitem.attributes.page.icon}|json_encode }}'
{% endif %}
data-page="{{ menuitem.attributes.page|json_encode }}"
{% endif %}
class="{% if menuitem.active or treeLevel == 1 %}jstree-open{% endif %}{% if menuitem.offline %} jstree-node--offline{% endif %}"{% if menuitem.role %} rel="{{menuitem.role}}"{% endif %}>
{% if menuitem.route %}
<a href="{{ path(menuitem.route, menuitem.routeparams) }}" class="{% if currentMenuItem is not null and currentMenuItem.uniqueId == menuitem.uniqueId %}active{% endif %}">
Expand Down
1 change: 1 addition & 0 deletions src/Kunstmaan/NodeBundle/Helper/Menu/PageMenuAdaptor.php
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@ private function processNodes(
->setLabel($child['title'])
->setParent($parent)
->setOffline(!$child['online'] && !$this->pagesConfiguration->isStructureNode($refName))
->setFolder($this->pagesConfiguration->isStructureNode($refName))
->setRole('page')
->setWeight($child['weight'])
->addAttributes(
Expand Down