Skip to content

Commit

Permalink
Download link
Browse files Browse the repository at this point in the history
  • Loading branch information
nandangrover committed May 30, 2020
1 parent c6bbd1a commit ce7cbdf
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
6 changes: 6 additions & 0 deletions client/core/defaultCV.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,10 @@ import gateway from '../utility/gateways.js';
let iFrame = document.getElementById("template");
iFrame.src = `../themes/themeElon_1/index.html`;
iFrame.style.display = 'block';
console.log(window.location.pathname)
if (window.location.pathname === '/download') {
iFrame.onload = function () {
window.document.getElementById("print").click()
}
}
})();
12 changes: 9 additions & 3 deletions client/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ template('defaultCV', () => {
template('editorResume', () => {
scriptLoader('core/resumeEditor.js');
});

// Register the templates.
template('download', () => {
scriptLoader('core/defaultCV.js');
});
// Define the routes. Each route is described with a route path & a template to render
// when entering that path. A template can be a string (file name), or a function that
// will directly create the DOM objects.
Expand All @@ -35,14 +40,15 @@ let route = (path, template) => {
// Define the mappings route->template.
route('/', 'defaultCV');
route('/secretEditor', 'editorResume');
route('/download', 'download');


// Give the correspondent route (template) or fail
let resolveRoute = (route) => {
try {
return routes[route];
return routes[route];
} catch (error) {
throw new Error("The route is not defined");
throw new Error("The route is not defined");
}
};

Expand All @@ -59,7 +65,7 @@ const scriptLoader = path => {
let router = (evt) => {
const url = window.location.pathname || "/";
const routeResolved = resolveRoute(url);

routeResolved();
};
// For first load or when routes are changed in browser url box.
Expand Down

0 comments on commit ce7cbdf

Please sign in to comment.