fix tranlsation in mode connection

This commit is contained in:
2018-06-19 14:07:59 +02:00
parent 25f1c1a497
commit dcdd8e0011
4 changed files with 70 additions and 176 deletions
+35 -88
View File
@@ -1648,7 +1648,6 @@ module.exports = g;
// /___/
module.exports = {
lang:'fr',
langs:[
{
'lc':'lat',
@@ -11360,7 +11359,7 @@ var _Link = {
vn.state.opened = false;
// return false;
}
}, m('span', m.trust("🗙"))),
}),//, m('span', m.trust("🗙"))),
typeof _dbs.data_byid[_dbs.lang][this.tid].childs != "undefined"
? m(_Enonce, this.tob)
: m(_Item, this.tob)
@@ -11725,7 +11724,7 @@ var _Dot = {
nested:false,
links:null,
parents:[],
lang:_dbs.lang,
lang:null,
setupTitle(vn){
this.title = vn.attrs.title;
if(!this.title) this.title = this.type;
@@ -11761,6 +11760,7 @@ var _Dot = {
oninit(vn){
this.id = vn.attrs.id;
this.type = vn.attrs.type;
this.level = vn.attrs.level;
this.dottype = vn.attrs.dottype;
this.breadcrumb = vn.attrs.breadcrumb;
// console.log(`${this.id} -> ${this.dottype}`);
@@ -11777,9 +11777,10 @@ var _Dot = {
// console.log('_Dot init '+this.id+' parents :',this.parents);
}
this.nested = this.parents.length ? true : false;
// if(this.nested) console.log(`oninit ${this.id}`);
this.lang = vn.attrs.lang;
this.setupTitle(vn);
this.setuptext(vn);
},
@@ -11791,14 +11792,13 @@ var _Dot = {
}
},
onbeforeupdate(vn){
// if(this.opened) console.log(`onbeforeupdate ${this.id} : vn`,vn);
if(this.lang != _dbs.lang){
this.lang = _dbs.lang;
if(this.lang != vn.attrs.lang){
this.lang = vn.attrs.lang;
this.breadcrumb = vn.attrs.breadcrumb;
this.type = vn.attrs.type;
this.setuptext(vn);
this.setupTitle(vn);
}
// this.opened = 0;
},
onupdate(vn){
// if(this.nested) console.log(`onupdate ${this.id}`);
@@ -11817,12 +11817,13 @@ var _Dot = {
setupLinks(vn, c, links){
return m('nav', {'class':`links ${c}`}, links.map(id => {
// console.log(id);
if(typeof _dbs.data_byid[_dbs.lang][id] !== 'undefined'){
var obj = _dbs.data_byid[_dbs.lang][id];
if(typeof _dbs.data_byid[this.lang][id] !== 'undefined'){
var obj = _dbs.data_byid[this.lang][id];
// console.log('link to : obj', obj);
return m(_Dot, {
"id":id,
'title':obj.title,
// TODO: translate breadcrumb
'breadcrumb':obj.breadcrumb,
'text':obj.text,
'dottype':obj.dottype,
@@ -11832,14 +11833,13 @@ var _Dot = {
// activate link only if not in parents (already went through it)
'active':vn.state.parents.indexOf(id) == -1 ? true:false,
// 'nested':true,
'lang':this.lang,
});
}
})
);
},
viewOpenedContent(vn){
// if(this.nested) console.log(`viewOpenedContent ${this.id} : vn`, vn);
// if(this.nested) console.log(`viewOpenedContent ${this.id} : this`, this);
return m('div', {
'uid':this.id,
'class':`dot ${this.dottype}${this.nested ? ' nested':''}`},
@@ -11854,7 +11854,7 @@ var _Dot = {
onclick(e){
vn.state.opened = 0;
}
}, m('span', m.trust("🗙"))
}//, m('span') // , m.trust("🗙")
),
// Title
m('span', {'class':'title'}, m.trust(this.nested ? this.breadcrumb : this.title)),
@@ -11891,8 +11891,6 @@ var _Dot = {
);
},
viewPreviewContent(vn){
// if(this.nested) console.log(`viewPreviewContent ${this.id} : vn`, vn);
// if(this.nested) console.log(`viewPreviewContent ${this.id} : this`, this);
return m('div', {
'uid':this.id,
'class':`dot ${this.dottype}${this.nested ? ' nested':''}`
@@ -11911,10 +11909,6 @@ var _Dot = {
);
},
view(vn){
// if (this.nested) console.log(`view ${this.id}`);
// if (this.opened) console.log(`view ${this.id} : vn`,vn);
// if (this.nested) console.log(`view ${this.id} : this`,this);
return this.active && vn.state.opened
? this.viewOpenedContent(vn) // full view of dot with linked dots
: this.viewPreviewContent(vn); // preview dot
@@ -11940,38 +11934,18 @@ full list of black dotlikes from unicode
// / /__/ _ \/ / / _ /
// \___/_//_/_/_/\_,_/
var _Child = {
// id:null,
// part:null,
// type:null,
// dottype:null,
// // nested:false,
// text:'',
childs:[],
oninit(vn){
// // console.log('vn.attrs', vn.attrs);
// this.id = vn.attrs.id;
// this.type = vn.attrs.type;
// // vn.state.part = vn.state.slug.match(/^(\d)(.+)/)[1];
// this.text = vn.attrs.text;
// // this.nested = vn.attrs.nested || false;
// this.dottype = vn.attrs.dottype;
},
onbeforeupdate(vn, old){
// // this.nested = vn.attrs.nested || false;
// this.type = vn.attrs.type;
// this.text = vn.attrs.text;
},
// oninit(vn){},
// onbeforeupdate(vn, old){},
view(vn){
// return m(_Dot, {"id":this.id, 'text':this.text, 'type':this.type, 'dottype':this.dottype});
// if (typeof vn.attrs.childs === 'undefined'){
// debugger;
// }
return [
m(_Dot, vn.attrs),
// add children
typeof vn.attrs.childs !== 'undefined'
? vn.attrs.childs.map(c => { return m(_Child, c); })
? vn.attrs.childs.map(c => {
c.lang = vn.attrs.lang;
c.level = vn.attrs.level + 1;
return m(_Child, c);
})
: null
];
}
@@ -11983,45 +11957,19 @@ var _Child = {
// / /___/ / / / /_/ / / / / /__/ __/
// /_____/_/ /_/\____/_/ /_/\___/\___/
var _Enonce = {
partid:null,
id:null,
title:null,
text:null,
dottype:null,
// nested:false,
childs:[],
oninit(vn){
// // // console.log('Enonce on init', vn);
// this.partid = vn.attrs.partid;
// this.id = vn.attrs.id;
// this.title = vn.attrs.title || "";
// this.text = vn.attrs.text;
// this.childs = vn.attrs.childs || [];
// // this.nested = vn.attrs.nested || false;
// this.dottype = vn.attrs.dottype;
},
onbeforeupdate(vn, old) {
// // console.log(vn.attrs.childs);
// this.title = vn.attrs.title || "";
// this.text = vn.attrs.text;
// this.childs = vn.attrs.childs || [];
// // this.nested = vn.attrs.nested || false;
// // if(vn.attrs.id == '1d1') console.log('_Enonce UPDATE, text :', vn.attrs.text);
// this.dottype = vn.attrs.dottype;
},
// oninit(vn){},
// onbeforeupdate(vn, old) {},
view(vn){
// if(vn.attrs.id == '1d1') console.log('_Enonce VIEW, text :', vn.attrs.text);
vn.attrs.level = 0;
return [
// create dot
// m(_Dot, {
// 'id':this.id
// 'text':this.text
// 'type':this.title
// 'dottype':this.dottype
// }),
m(_Dot, vn.attrs),
// addd children
vn.attrs.childs.map(c => { return m(_Child, c); })
vn.attrs.childs.map(c => {
c.lang = vn.attrs.lang;
c.level = 1;
return m(_Child, c);
})
]
}
}
@@ -12036,15 +11984,11 @@ var _Part = {
oninit(vn){
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;
},
view(vn){
// console.log(vn.attrs.enonces);
return m("section", {
'id' :this.id,
'class' :'part'
@@ -12053,9 +11997,9 @@ var _Part = {
// create title node
m("h1", {'class':'part-title', 'part':this.id}, m.trust(markdown.renderInline(this.title))),
// create text node
this.enonces.map(e => {
vn.attrs.enonces.map(e => {
// console.log(e.text);
// return m(_Enonce, Object.assign({"partid":this.id},e))
e.lang = vn.attrs.lang;
switch (e.type) {
case "title":
// handle titles
@@ -12095,7 +12039,6 @@ var _Intro = {
}
}
// ______ __ _
// / ____/___ ____ ____ ___ _____/ /_(_)___ ____ _____
// / / / __ \/ __ \/ __ \/ _ \/ ___/ __/ / __ \/ __ \/ ___/
@@ -12106,9 +12049,13 @@ module.exports = {
document.body.classList.add('mode-connections');
_Ui.init();
},
onbeforeupdate(vn, old){
console.log('Connection, onbeforeupdate old',old, 'vn',vn);
},
view(vn){
// console.log('_ModeConnections view', vn.attrs.lang);
console.log('_ModeConnections view', vn.attrs.lang);
return m('main', {id:"content", 'class':'mode-connections'}, _dbs.data[vn.attrs.lang].map(p => {
p.lang = vn.attrs.lang;
if(p.id == 'intro'){
return m(_Intro,p);
}else{
+1 -1
View File
File diff suppressed because one or more lines are too long
+34 -86
View File
@@ -28,7 +28,7 @@ var _Dot = {
nested:false,
links:null,
parents:[],
lang:_dbs.lang,
lang:null,
setupTitle(vn){
this.title = vn.attrs.title;
if(!this.title) this.title = this.type;
@@ -64,6 +64,7 @@ var _Dot = {
oninit(vn){
this.id = vn.attrs.id;
this.type = vn.attrs.type;
this.level = vn.attrs.level;
this.dottype = vn.attrs.dottype;
this.breadcrumb = vn.attrs.breadcrumb;
// console.log(`${this.id} -> ${this.dottype}`);
@@ -80,9 +81,10 @@ var _Dot = {
// console.log('_Dot init '+this.id+' parents :',this.parents);
}
this.nested = this.parents.length ? true : false;
// if(this.nested) console.log(`oninit ${this.id}`);
this.lang = vn.attrs.lang;
this.setupTitle(vn);
this.setuptext(vn);
},
@@ -94,14 +96,13 @@ var _Dot = {
}
},
onbeforeupdate(vn){
// if(this.opened) console.log(`onbeforeupdate ${this.id} : vn`,vn);
if(this.lang != _dbs.lang){
this.lang = _dbs.lang;
if(this.lang != vn.attrs.lang){
this.lang = vn.attrs.lang;
this.breadcrumb = vn.attrs.breadcrumb;
this.type = vn.attrs.type;
this.setuptext(vn);
this.setupTitle(vn);
}
// this.opened = 0;
},
onupdate(vn){
// if(this.nested) console.log(`onupdate ${this.id}`);
@@ -120,12 +121,13 @@ var _Dot = {
setupLinks(vn, c, links){
return m('nav', {'class':`links ${c}`}, links.map(id => {
// console.log(id);
if(typeof _dbs.data_byid[_dbs.lang][id] !== 'undefined'){
var obj = _dbs.data_byid[_dbs.lang][id];
if(typeof _dbs.data_byid[this.lang][id] !== 'undefined'){
var obj = _dbs.data_byid[this.lang][id];
// console.log('link to : obj', obj);
return m(_Dot, {
"id":id,
'title':obj.title,
// TODO: translate breadcrumb
'breadcrumb':obj.breadcrumb,
'text':obj.text,
'dottype':obj.dottype,
@@ -135,14 +137,13 @@ var _Dot = {
// activate link only if not in parents (already went through it)
'active':vn.state.parents.indexOf(id) == -1 ? true:false,
// 'nested':true,
'lang':this.lang,
});
}
})
);
},
viewOpenedContent(vn){
// if(this.nested) console.log(`viewOpenedContent ${this.id} : vn`, vn);
// if(this.nested) console.log(`viewOpenedContent ${this.id} : this`, this);
return m('div', {
'uid':this.id,
'class':`dot ${this.dottype}${this.nested ? ' nested':''}`},
@@ -157,7 +158,7 @@ var _Dot = {
onclick(e){
vn.state.opened = 0;
}
}, m('span', m.trust("🗙"))
}//, m('span') // , m.trust("🗙")
),
// Title
m('span', {'class':'title'}, m.trust(this.nested ? this.breadcrumb : this.title)),
@@ -194,8 +195,6 @@ var _Dot = {
);
},
viewPreviewContent(vn){
// if(this.nested) console.log(`viewPreviewContent ${this.id} : vn`, vn);
// if(this.nested) console.log(`viewPreviewContent ${this.id} : this`, this);
return m('div', {
'uid':this.id,
'class':`dot ${this.dottype}${this.nested ? ' nested':''}`
@@ -214,10 +213,6 @@ var _Dot = {
);
},
view(vn){
// if (this.nested) console.log(`view ${this.id}`);
// if (this.opened) console.log(`view ${this.id} : vn`,vn);
// if (this.nested) console.log(`view ${this.id} : this`,this);
return this.active && vn.state.opened
? this.viewOpenedContent(vn) // full view of dot with linked dots
: this.viewPreviewContent(vn); // preview dot
@@ -243,38 +238,18 @@ full list of black dotlikes from unicode
// / /__/ _ \/ / / _ /
// \___/_//_/_/_/\_,_/
var _Child = {
// id:null,
// part:null,
// type:null,
// dottype:null,
// // nested:false,
// text:'',
childs:[],
oninit(vn){
// // console.log('vn.attrs', vn.attrs);
// this.id = vn.attrs.id;
// this.type = vn.attrs.type;
// // vn.state.part = vn.state.slug.match(/^(\d)(.+)/)[1];
// this.text = vn.attrs.text;
// // this.nested = vn.attrs.nested || false;
// this.dottype = vn.attrs.dottype;
},
onbeforeupdate(vn, old){
// // this.nested = vn.attrs.nested || false;
// this.type = vn.attrs.type;
// this.text = vn.attrs.text;
},
// oninit(vn){},
// onbeforeupdate(vn, old){},
view(vn){
// return m(_Dot, {"id":this.id, 'text':this.text, 'type':this.type, 'dottype':this.dottype});
// if (typeof vn.attrs.childs === 'undefined'){
// debugger;
// }
return [
m(_Dot, vn.attrs),
// add children
typeof vn.attrs.childs !== 'undefined'
? vn.attrs.childs.map(c => { return m(_Child, c); })
? vn.attrs.childs.map(c => {
c.lang = vn.attrs.lang;
c.level = vn.attrs.level + 1;
return m(_Child, c);
})
: null
];
}
@@ -286,45 +261,19 @@ var _Child = {
// / /___/ / / / /_/ / / / / /__/ __/
// /_____/_/ /_/\____/_/ /_/\___/\___/
var _Enonce = {
partid:null,
id:null,
title:null,
text:null,
dottype:null,
// nested:false,
childs:[],
oninit(vn){
// // // console.log('Enonce on init', vn);
// this.partid = vn.attrs.partid;
// this.id = vn.attrs.id;
// this.title = vn.attrs.title || "";
// this.text = vn.attrs.text;
// this.childs = vn.attrs.childs || [];
// // this.nested = vn.attrs.nested || false;
// this.dottype = vn.attrs.dottype;
},
onbeforeupdate(vn, old) {
// // console.log(vn.attrs.childs);
// this.title = vn.attrs.title || "";
// this.text = vn.attrs.text;
// this.childs = vn.attrs.childs || [];
// // this.nested = vn.attrs.nested || false;
// // if(vn.attrs.id == '1d1') console.log('_Enonce UPDATE, text :', vn.attrs.text);
// this.dottype = vn.attrs.dottype;
},
// oninit(vn){},
// onbeforeupdate(vn, old) {},
view(vn){
// if(vn.attrs.id == '1d1') console.log('_Enonce VIEW, text :', vn.attrs.text);
vn.attrs.level = 0;
return [
// create dot
// m(_Dot, {
// 'id':this.id
// 'text':this.text
// 'type':this.title
// 'dottype':this.dottype
// }),
m(_Dot, vn.attrs),
// addd children
vn.attrs.childs.map(c => { return m(_Child, c); })
vn.attrs.childs.map(c => {
c.lang = vn.attrs.lang;
c.level = 1;
return m(_Child, c);
})
]
}
}
@@ -339,15 +288,11 @@ var _Part = {
oninit(vn){
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;
},
view(vn){
// console.log(vn.attrs.enonces);
return m("section", {
'id' :this.id,
'class' :'part'
@@ -356,9 +301,9 @@ var _Part = {
// create title node
m("h1", {'class':'part-title', 'part':this.id}, m.trust(markdown.renderInline(this.title))),
// create text node
this.enonces.map(e => {
vn.attrs.enonces.map(e => {
// console.log(e.text);
// return m(_Enonce, Object.assign({"partid":this.id},e))
e.lang = vn.attrs.lang;
switch (e.type) {
case "title":
// handle titles
@@ -398,7 +343,6 @@ var _Intro = {
}
}
// ______ __ _
// / ____/___ ____ ____ ___ _____/ /_(_)___ ____ _____
// / / / __ \/ __ \/ __ \/ _ \/ ___/ __/ / __ \/ __ \/ ___/
@@ -409,9 +353,13 @@ module.exports = {
document.body.classList.add('mode-connections');
_Ui.init();
},
onbeforeupdate(vn, old){
console.log('Connection, onbeforeupdate old',old, 'vn',vn);
},
view(vn){
// console.log('_ModeConnections view', vn.attrs.lang);
console.log('_ModeConnections view', vn.attrs.lang);
return m('main', {id:"content", 'class':'mode-connections'}, _dbs.data[vn.attrs.lang].map(p => {
p.lang = vn.attrs.lang;
if(p.id == 'intro'){
return m(_Intro,p);
}else{
-1
View File
@@ -7,7 +7,6 @@
// /___/
module.exports = {
lang:'fr',
langs:[
{
'lc':'lat',