This PR introduces vue.js routing for better page and state management. src/templates/views/Index.pug has been changed to reflect the new routing paradigm. All other pug template files should be the same (please see 2 for new page view trigger format).
Please note in order to link to a page you need to:
Add a route in src/routes.ts. Please make sure the template points to the pug templates path as such:
{ path: '/about', component: { template: window.puglatizer.pages.about()}},
For any a element, in order to trigger a page view you should place the following:
router-link(to='/individual') Individual,
this will automatically be treated as an a element by the vue router.
Known issues:
Sometimes if you edit routes.ts or any .ts file, and refresh the page the build step might get out of sync. When you refresh the page it may produce a illegal return error in the browser console please ignore this and simply restart the dev server. I will try to resolve this soon.
Will need some time to completely decouple DOM manipulations from api. For now it is advisable not to touch any /templates/modals/ pug templates that are responsible for actual api logic.
Also working to place all scanning related code in /src/scanning.ts according to YUI patterns. This will happen tomorrow, but should not affect routing or templates. All apis are now located in /src/controller.ts
This PR introduces vue.js routing for better page and state management.
src/templates/views/Index.pug
has been changed to reflect the new routing paradigm. All other pug template files should be the same (please see 2 for new page view trigger format).Please note in order to link to a page you need to:
Add a route in src/routes.ts. Please make sure the template points to the pug templates path as such:
{ path: '/about', component: { template: window.puglatizer.pages.about()}},
For any a element, in order to trigger a page view you should place the following:
router-link(to='/individual') Individual,
this will automatically be treated as an a element by the vue router.Known issues:
Sometimes if you edit routes.ts or any .ts file, and refresh the page the build step might get out of sync. When you refresh the page it may produce a
illegal return error
in the browser console please ignore this and simply restart the dev server. I will try to resolve this soon.Will need some time to completely decouple DOM manipulations from api. For now it is advisable not to touch any /templates/modals/ pug templates that are responsible for actual api logic.
Also working to place all scanning related code in /src/scanning.ts according to YUI patterns. This will happen tomorrow, but should not affect routing or templates. All apis are now located in /src/controller.ts