{% load mptt_tags fiber_tags %}
{% if user.is_staff %}
	{% if fiber_menu_parent_page %}
	<ul data-fiber-data='{"type": "page", "add_url": "{{ Page.get_add_url }}", "parent_id": {{ fiber_menu_parent_page.id }}}'>
	{% else %}
	<ul>
	{% endif %}
	{% recursetree fiber_menu_pages %}
		<li class="{{ node.title|slugify }}{% if node in fiber_current_pages %} current{% endif %}{% if node.is_first_child %} first{% endif %}{% if node.is_last_child %} last{% endif %}">
			<a href="{{ node.get_absolute_url }}" data-fiber-data='{"type": "page", "id": {{ node.id }}, "parent_id": {{ node.parent.id }}, "url": "{{ node.get_change_url }}", "add_url": "{{ Page.get_add_url }}", "base_url": "{{ node.get_absolute_url }}"}'>{{ node.title }}</a>
			{% if children %}
				<ul data-fiber-data='{"type": "page", "add_url": "{{ Page.get_add_url }}", "parent_id": {{ node.id }}}'>
					{{ children }}
				</ul>
			{% endif %}
		</li>
	{% endrecursetree %}
	</ul>
{% else %}
	<ul>
	{% recursetree fiber_menu_pages %}
		<li class="{{ node.title|slugify }}{% if node in fiber_current_pages %} current{% endif %}{% if node.is_first_child %} first{% endif %}{% if node.is_last_child %} last{% endif %}">
			<a href="{{ node.get_absolute_url }}">{{ node.title }}</a>
			{% if children %}
				<ul>
					{{ children }}
				</ul>
			{% endif %}
		</li>
	{% endrecursetree %}
	</ul>
{% endif %}
