main.js 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. /**
  2. * @Author: Bachir Soussi Chiadmi <bach>
  3. * @Date: 16-04-2017
  4. * @Email: bachir@figureslibres.io
  5. * @Last modified by: bach
  6. * @Last modified time: 18-04-2017
  7. * @License: GPL-V3
  8. */
  9. require('normalize.css/normalize.css');
  10. require('./fonts/amiri/amiri.css');
  11. require('./fonts/dejavu/dejavu.css');
  12. require('./fonts/opensans/opensans.css');
  13. const m = require('mithril');
  14. // var marked = require('marked');
  15. // var _helpers = require('modules/helpers');
  16. const _dbs = require('./modules/dbs');
  17. const _i18n = require('./modules/i18n');
  18. const _Header = require('./modules/header');
  19. const _Footer = require('./modules/footer');
  20. const _ModeText = require('./modules/ModeText');
  21. const _ModeConnections = require('./modules/ModeConnections');
  22. var Layout = {
  23. view(vn){
  24. // console.log('Layout view : lang', vn.attrs.lang);
  25. _i18n.setLang(vn.attrs.lang);
  26. return [
  27. m(_Header, vn.attrs),
  28. vn.children,
  29. m(_Footer, vn.attrs)
  30. ]
  31. }
  32. }
  33. function init(){
  34. _dbs.load(function(){
  35. console.log('init dbs callback');
  36. console.log("Init _dbs.data", _dbs.data);
  37. console.log("Init _dbs.data_byid", _dbs.data_byid);
  38. console.log("Init _dbs.data_strct", _dbs.data_strct);
  39. console.log("Init _dbs.types", _dbs.types);
  40. console.log("Init _dbs.data_bytype", _dbs.data_bytype);
  41. m.route.prefix("");
  42. m.route(document.body, "/fr/connections", {
  43. "/:lang/text": {
  44. render(vn){
  45. // console.log('Routing render : vn', vn);
  46. return m(Layout, vn.attrs, m(_ModeText, vn.attrs));
  47. }
  48. },
  49. "/:lang/connections": {
  50. render(vn){
  51. return m(Layout, vn.attrs, m(_ModeConnections, vn.attrs));
  52. }
  53. }
  54. });
  55. });
  56. };
  57. // ___
  58. // / | ____ ____
  59. // / /| | / __ \/ __ \
  60. // / ___ |/ /_/ / /_/ /
  61. // /_/ |_/ .___/ .___/
  62. // /_/ /_/
  63. // var _App = {
  64. // view(){
  65. // console.log('_App view', _lang);
  66. // return [
  67. // m('header', [
  68. // m('h1', 'Ethica'),
  69. // m('aside', {'id':"menus"}, m(_LangMenu) )
  70. // ]),
  71. // m(_Tree),
  72. // m('footer', [
  73. // m('p', m.trust('© 2017 <a href="./">Ethica Spinoza</a>'))
  74. // ])
  75. // ]
  76. // }
  77. // }
  78. // _ _ __
  79. // (_)___ (_) /_
  80. // / / __ \/ / __/
  81. // / / / / / / /_
  82. // /_/_/ /_/_/\__/
  83. init()