added navigation editor template and methods, moved markdown converstion to DocTools class
parent
594df048cf
commit
39809a60ec
@ -0,0 +1,35 @@
|
|||||||
|
{% extends "dash/_frame.twig" %}
|
||||||
|
|
||||||
|
{% block title %}
|
||||||
|
{{ title }}
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block stylesheets %}
|
||||||
|
<link rel="stylesheet" type="text/css" href="/assets/css/dash.css?=adfafd">
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block mainContent %}
|
||||||
|
<div id="nav-index">
|
||||||
|
<div id="nav-index-wrapper">
|
||||||
|
<div id="nav-pages">
|
||||||
|
{% for item in menu %}
|
||||||
|
<div id="{{item.id}}" class="nav-item" data-slug="{{item.slug}}" data-uuid="{{item.uuid}}" data-path="{{item.path}}">
|
||||||
|
<svg id="item-arrows" viewbox="0 0 20 20" class="icons">
|
||||||
|
<use xlink:href="/assets/images/global/sprite.svg#entypo-select-arrows"/>
|
||||||
|
</svg>
|
||||||
|
<label>{{item.title}}</label>
|
||||||
|
<div id="nav-btns">
|
||||||
|
<button id="edit-item" class="nav-btn" data-id="{{item.uuid}}">EDIT</button>
|
||||||
|
<button id="remove-item" class="nav-btn" data-uuid="{{item.uuid}}" data-id="{{item.id}}">REMOVE</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
{% endfor %}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block javascripts %}
|
||||||
|
<script src="/assets/scripts/dash.min.js" type="text/javascript"></script>
|
||||||
|
{% endblock %}
|
@ -1,35 +1,37 @@
|
|||||||
export default class NavActions {
|
export default class NavActions {
|
||||||
//--------------------------
|
//--------------------------
|
||||||
// constructor
|
// constructor
|
||||||
//--------------------------
|
//--------------------------
|
||||||
constructor() {}
|
constructor() {}
|
||||||
//--------------------------
|
//--------------------------
|
||||||
// methods
|
// methods
|
||||||
//--------------------------
|
//--------------------------
|
||||||
syncMenu() {
|
syncMenu() {
|
||||||
let navData = [];
|
let navData = [];
|
||||||
let items = document.getElementById('nav-pages').children;
|
let items = document.getElementById("nav-pages").children;
|
||||||
for (let index = 0; index < items.length; index++) {
|
for (let index = 0; index < items.length; index++) {
|
||||||
navData.push({
|
navData.push({
|
||||||
title: items[index].getElementsByTagName('label')[0].innerHTML,
|
title: items[index].getElementsByTagName("label")[0].innerHTML,
|
||||||
id: items[index].id,
|
id: items[index].id,
|
||||||
slug: items[index].getAttribute('data-slug'),
|
slug: items[index].getAttribute("data-slug"),
|
||||||
uuid: items[index].getAttribute('data-uuid'),
|
uuid: items[index].getAttribute("data-uuid"),
|
||||||
path: items[index].getAttribute('data-path')
|
path: items[index].getAttribute("data-path"),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
let data = { nav: navData, remove: null };
|
let data = { menu: navData, remove: null };
|
||||||
return new Promise(function (resolve) {
|
return new Promise(function (resolve) {
|
||||||
resolve(data);
|
resolve(data);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
removeItem(id) {
|
removeItem(id) {
|
||||||
document.getElementById('nav-pages').removeChild(document.getElementById(id));
|
document
|
||||||
}
|
.getElementById("nav-pages")
|
||||||
|
.removeChild(document.getElementById(id));
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------
|
//--------------------------
|
||||||
// event handlers
|
// event handlers
|
||||||
//--------------------------
|
//--------------------------
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue