-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.js
65 lines (57 loc) · 1.52 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
const utils = new Utils();
/**
* Internal function use to hydrate and render the home template.
*/
function _hydrateAndRenderHomeTemplate() {
const home = new Home();
const template = new Template(
home.templateName,
home.parentBlock,
home.data,
);
const render = new RenderLocalTemplate();
render.render(template);
};
/**
* Function use to render all externals templates.
*/
function _hydrateAndRenderExternalTemplates() {
const header = new Header(
'./templates/includes/header.jsr'
);
const footer = new Footer(
'./templates/includes/footer.jsr'
);
const breadcrumb = new BreadCrumb(
['Hub'],
['index.html'],
['before-icon-hub'],
'./templates/includes/breadcrumb.jsr',
);
const headerTemplate = new Template(
header.templateName,
header.parentBlock,
header.data
);
const footerTemplate = new Template(
footer.templateName,
footer.parentBlock,
footer.data
);
const breadcrumbTemplate = new Template(
breadcrumb.templateName,
breadcrumb.parentBlock,
breadcrumb.data
);
const render = new RenderExternalTemplate();
render.render(headerTemplate);
render.render(footerTemplate);
render.render(breadcrumbTemplate);
}
/**
* Execute the method to hydrate and render all templates.
*/
$(document).ready(function() {
_hydrateAndRenderHomeTemplate();
_hydrateAndRenderExternalTemplates();
}); // document.ready