|
@@ -3232,9 +3232,9 @@ var _Dot = {
|
|
|
opened:false,
|
|
|
links:null,
|
|
|
parents:[],
|
|
|
- oninit: function(vn){
|
|
|
- this.id = vn.attrs.id;
|
|
|
- this.type = vn.attrs.type;
|
|
|
+ lang:_dbs.lang,
|
|
|
+ setuptext:function(vn){
|
|
|
+ // console.log('setuptext', vn);
|
|
|
|
|
|
// construct text
|
|
|
this.text = markdown.render(vn.attrs.text);
|
|
@@ -3246,6 +3246,13 @@ var _Dot = {
|
|
|
this.summary = this.summary.replace(/\[([^\]]+)$/g, "$1");
|
|
|
this.summary = markdown.renderInline(this.summary) + " …";
|
|
|
|
|
|
+ },
|
|
|
+ oninit: function(vn){
|
|
|
+ this.id = vn.attrs.id;
|
|
|
+ this.type = vn.attrs.type;
|
|
|
+
|
|
|
+ this.setuptext(vn);
|
|
|
+
|
|
|
if(typeof vn.attrs.active !== 'undefined')
|
|
|
this.active = vn.attrs.active;
|
|
|
|
|
@@ -3268,6 +3275,11 @@ var _Dot = {
|
|
|
}
|
|
|
},
|
|
|
onbeforeupdate: function(vn){
|
|
|
+ // console.log('onbeforeupdate');
|
|
|
+ if(this.lang != _dbs.lang){
|
|
|
+ this.lang = _dbs.lang;
|
|
|
+ this.setuptext(vn);
|
|
|
+ }
|
|
|
},
|
|
|
view: function(vn){
|
|
|
if (this.active && this.opened) {
|
|
@@ -3278,15 +3290,17 @@ var _Dot = {
|
|
|
this.links.to.length
|
|
|
? m('nav', {'class':'links to'}, this.links.to.map(function(id){
|
|
|
// console.log(id);
|
|
|
- return m(_Dot, {
|
|
|
- "id":id,
|
|
|
- 'text':_dbs.data_byid[_dbs.lang][id].text,
|
|
|
- 'type':'',
|
|
|
- // passe the memory of crossed dots plus the current one
|
|
|
- 'parents':vn.state.parents.concat([vn.state.id]),
|
|
|
- // activate link only if not in parents (already went through it)
|
|
|
- 'active':vn.state.parents.indexOf(id) == -1 ? true:false
|
|
|
- });
|
|
|
+ if(typeof _dbs.data_byid[_dbs.lang][id] !== 'undefined'){
|
|
|
+ return m(_Dot, {
|
|
|
+ "id":id,
|
|
|
+ 'text':_dbs.data_byid[_dbs.lang][id].text,
|
|
|
+ 'type':'',
|
|
|
+ // passe the memory of crossed dots plus the current one
|
|
|
+ 'parents':vn.state.parents.concat([vn.state.id]),
|
|
|
+ // activate link only if not in parents (already went through it)
|
|
|
+ 'active':vn.state.parents.indexOf(id) == -1 ? true:false
|
|
|
+ });
|
|
|
+ }
|
|
|
})
|
|
|
)
|
|
|
: null,
|
|
@@ -3348,6 +3362,7 @@ var _Dot = {
|
|
|
m('p', {
|
|
|
'class':'summary',
|
|
|
onclick:function(e){
|
|
|
+ // TODO: animate openening (text and links separatly)
|
|
|
vn.state.opened = true;
|
|
|
}
|
|
|
}, m.trust(this.summary))
|