1 let XDate = require('xdate')
3 return async (env, head, body) => {
4 let feedback_form = await _require('/feedback_form.jst')
5 let globals = await env.site.get_json('/_config/globals.json')
6 let icon_search = await env.site.get_min_svg('/_svg/icon_search.svg')
7 let logo_large = await env.site.get_min_svg('/_svg/logo_large.svg')
8 let page = await _require('/page.jst')
18 (globals.page_to_title[env.parsed_url.pathname] || env.parsed_url.pathname)
26 div(style="padding-left: calc(100vw - 100%);") {
27 div.container(style="margin-top: 15px; margin-bottom: 15px;") {
29 // div.col-sm-12(style="text-align: right;") {
30 // a(href="/login.html") {'Login'}
34 div.'col-sm-8'.vbottom {
37 div.'col-sm-4'.vbottom(style="padding-bottom: 15px;") {
38 form(action="/search.html") {
40 input.form-control(name="query" type="text" placeholder="Search") {}
41 span.input-group-btn {
42 button.btn.btn-default(type="submit") {
43 _out.push(icon_search)
52 nav.navbar.navbar-default(style="margin-top: 0px; margin-bottom: 0px;") {
53 div(style="padding-left: calc(100vw - 100%);") {
54 div.container { //-fluid") {
55 // Brand and toggle get grouped for better mobile display
57 button.navbar-toggle.collapsed(type="button" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false") {
58 span.sr-only {'Toggle navigation'}
63 //a.navbar-brand(href="#") {'Brand'}
66 // Collect the nav links, forms, and other content for toggling
67 div.collapse.navbar-collapse#bs-example-navbar-collapse-1 {
69 let navigation = globals.navigation
70 for (let i = 0; i < navigation.length; ++i) {
71 let page = navigation[i]
72 let title = globals.page_to_title[page] || page
73 if (page === env.parsed_url.pathname)
77 span.sr-only {'(current)'}
82 a(href=page) {`${title}`}
86 ul.nav.navbar-nav.navbar-right {
88 a#give-feedback {'Give feedback'}
95 div(style="padding-left: calc(100vw - 100%);") {
100 div.footer(style="padding-left: calc(100vw - 100%);") {
101 div.container { //-fluid") {
102 a(rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/") {
103 img(alt="Creative Commons License" style="border-width:0" src="/images/by-sa_3.0_88x31.png") {}
107 a(href="https://git.ndcode.org/public/ndcode_site.git") {
110 ' and licensed under a '
111 a(rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/") {
112 'Creative Commons Attribution-ShareAlike 3.0 Unported License'
117 p {'Example code fragments embedded within the text are placed in the public domain unless otherwise noted.'}
119 p {`Copyright © ${new XDate().getUTCFullYear()} Integration Logic Pty Ltd trading as NDCODE and contributors.`}
124 div#feedback-modal.modal.fade(role="dialog") {
128 button.close(type="button" data-dismiss="modal") {
137 'Did you notice something not quite right, or just want to share your impression of this page?'
139 await feedback_form(env, _out)
142 button.btn.btn-primary(type="submit" form="feedback-form") {
145 button.btn.btn-default(type="button" data-dismiss="modal") {
153 div#message-modal.modal.fade(role="dialog") {
157 button.close(type="button" data-dismiss="modal") {
165 p#message-modal-message {}
168 button.btn.btn-default(type="button" data-dismiss="modal") {
178 // when feedback form is submitted, do not reload the page
180 $(document).ready(function() {
181 $('#give-feedback').click(function() {
182 $('#feedback-modal').modal('show')
183 $('#feedback-form-message').text('')
185 $('#feedback-modal').on('shown.bs.modal', function() {
186 $('#feedback-form-message').focus()
188 $(document).on('submit', '#feedback-form', function(e) {
191 url: '/feedback.html',
194 page: window.location.href,
195 message: $('#feedback-form-message').val()
197 success: function(data, textStatus, jqXHR) {
198 $('#feedback-modal').modal('hide')
199 $('#message-modal-message').text(data)
200 $('#message-modal').modal('show')
202 error: function(jqXHR, textStatus, errorThrown) {
203 $('#feedback-modal').modal('hide')
204 $('#message-modal-message').text(errorThrown)
205 $('#message-modal').modal('show')