fixe language bug in dots

This commit is contained in:
Bachir Soussi Chiadmi
2017-07-19 19:34:56 +02:00
parent 9b043383a8
commit 0d98b60d26
4 changed files with 66 additions and 28 deletions
+27 -12
View File
@@ -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))
+1 -1
View File
File diff suppressed because one or more lines are too long
+27 -12
View File
@@ -25,9 +25,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);
@@ -39,6 +39,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;
@@ -61,6 +68,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) {
@@ -71,15 +83,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,
@@ -141,6 +155,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))
+11 -3
View File
@@ -1,5 +1,13 @@
#!/bin/sh
rsync -rvc index.html CT-figli-deb9-lamp:www/ethica-spinoza.net/public_html/
rsync -rvc assets/dist CT-figli-deb9-lamp:www/ethica-spinoza.net/public_html/assets/
rsync -rvc assets/jsondb CT-figli-deb9-lamp:www/ethica-spinoza.net/public_html/assets/
rsync -rvc --delete-before \
index.html \
CT-figli-deb9-lamp:www/ethica-spinoza.net/public_html/
rsync -rvc --delete-before \
assets/dist \
CT-figli-deb9-lamp:www/ethica-spinoza.net/public_html/assets/
rsync -rvc --delete-before \
assets/jsondb \
CT-figli-deb9-lamp:www/ethica-spinoza.net/public_html/assets/