summaryrefslogtreecommitdiffhomepage
path: root/resources/pug/include/layout-sidebar.pug
blob: e53476bde73e23f4494d7b138d64e52d4a33c833 (plain) (blame)
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
extends layout.pug

block prepend js
	script(src='/assets/js/jquery.slim.min.js')
	script(src='/assets/js/transition.min.js')
	script(src='/assets/js/collapse.min.js')

block content
	div.row
		div.col-lg-3.col-md-4
			ul.nav.nav-pills.nav-stacked
				block menu
					mixin menu(...items)
						-
							function pad_zero (n) {
								return n < 10 ? '0' + n : n;
							}

							function item_link (item) {
								if (!('link' in item)) {
									item.link = new String(item.name).toLowerCase().replace(/\W/g, '-');

									if ('year' in item && 'month' in item && 'day' in item)
										item.link = item.year + '-' + pad_zero(item.month) + '-' + pad_zero(item.day) + '-' + item.link;
								}

								return item.link;
							}

							function item_is_active (item) {
								return item_link(item) == page;
							}

						each item in items
							if 'menu' in item
								- const active = item.menu.some(item_is_active)
								li(role='presentation')
									- const id = 'menu-' + item_link(item);
									a(href='#' + id, data-toggle='collapse', role='button', aria-expanded=active.toString(), aria-controls=id)= item.name
									div.collapse(id=id, class=active ? 'in' : '')
											ul.nav.nav-pills.nav-stacked.col-xs-12.col-md-10.pull-right
												+menu(...item.menu)
											br(style='clear:both;')

							else
								- var link = item_link(item)
								li(role='presentation', class=item_is_active(item) ? 'active' : '')
									a(href=base_url + (link == '' ? '' : link + '.html'))= item.name

		div.col-lg-7.col-md-6
			h3
				block subtitle
				block subtitleExtra
					small
						| &ensp;by 
						block subtitleAuthor
							| Camil Staps
						| , 
						block subtitleDate
		div.col-lg-2.col-md-2.text-right
			block subtitle-right

		div.col-lg-9.col-md-8.text-justify.markdown
			block page