refactoring, fix reverse breadcrumb
This commit is contained in:
+25
-17
@@ -205,14 +205,20 @@ var _Item = {
|
||||
},
|
||||
[
|
||||
// create title node (only if not nested)
|
||||
!this.nested ? m("h3", {
|
||||
// 'ref':vn.attrs.href,
|
||||
// onclick(e){ WHAT IS THIS STATE ACTIVE ???
|
||||
// vn.state.active = vn.state.active ? 0 : 1;
|
||||
// }
|
||||
}, m.trust(markdown.renderInline(this.type))) : null,
|
||||
!this.nested
|
||||
? m("h3", {
|
||||
// 'ref':vn.attrs.href,
|
||||
// onclick(e){ WHAT IS THIS STATE ACTIVE ???
|
||||
// vn.state.active = vn.state.active ? 0 : 1;
|
||||
// }
|
||||
}, m.trust(markdown.renderInline(this.type)))
|
||||
: null,
|
||||
// create text node
|
||||
m(_Text, {'text':this.text, 'id':this.id})
|
||||
m(_Text, {'text':this.text, 'id':this.id}),
|
||||
// add children (only if not nested)
|
||||
// typeof vn.attrs.childs !== 'undefined' && !this.nested
|
||||
// ? vn.attrs.childs.map(c => { return m(_Item, c); })
|
||||
// : null
|
||||
]
|
||||
)
|
||||
}
|
||||
@@ -260,7 +266,9 @@ var _Enonce = {
|
||||
// create text node
|
||||
m(_Text, {'text':this.text, 'id':this.id}),
|
||||
// add children (only if not nested)
|
||||
!this.nested ? this.childs.map(c => { return m(_Item, c); }) : null
|
||||
typeof this.childs !== 'undefined' && !this.nested
|
||||
? this.childs.map(c => { return m(_Item, c); })
|
||||
: null
|
||||
])
|
||||
}
|
||||
}
|
||||
@@ -272,26 +280,26 @@ var _Enonce = {
|
||||
// /_/ \__,_/_/ \__/
|
||||
var _Part = {
|
||||
oninit(vn){
|
||||
this.id = vn.attrs.id;
|
||||
this.title = vn.attrs.title || '';
|
||||
this.enonces = vn.attrs.enonces;
|
||||
// this.id = vn.attrs.id;
|
||||
// this.title = vn.attrs.title || '';
|
||||
// this.enonces = vn.attrs.enonces;
|
||||
},
|
||||
onbeforeupdate(vn, old){
|
||||
// console.log('_Part, onbeforeupdate old',old);
|
||||
this.title = vn.attrs.title || '';
|
||||
this.enonces = vn.attrs.enonces;
|
||||
// this.title = vn.attrs.title || '';
|
||||
// this.enonces = vn.attrs.enonces;
|
||||
},
|
||||
view(vn){
|
||||
// console.log("part enonces", vn.attrs.enonces);
|
||||
return m("section", {
|
||||
'id' :this.id,
|
||||
'id' :vn.attrs.id,
|
||||
'class' :'part'
|
||||
},
|
||||
[
|
||||
// create title node
|
||||
m("h1", {'class':'part-title', 'part':this.id}, m.trust(markdown.renderInline(this.title))),
|
||||
m("h1", {'class':'part-title', 'part':vn.attrs.id}, m.trust(markdown.renderInline(vn.attrs.title))),
|
||||
// create text node
|
||||
this.enonces.map(e => {
|
||||
vn.attrs.enonces.map(e => {
|
||||
// console.log(e.title +" - "+ e.type);
|
||||
// var title = e.title || '';
|
||||
switch (e.type) {
|
||||
@@ -307,7 +315,7 @@ var _Part = {
|
||||
break;
|
||||
default:
|
||||
// or build structure
|
||||
return m(_Enonce, Object.assign({"partid":this.id},e));
|
||||
return m(_Enonce, Object.assign({"partid":vn.attrs.id},e));
|
||||
}
|
||||
})
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user