1
0
mirror of https://github.com/schollz/cowyo.git synced 2023-08-10 21:13:00 +03:00
cowyo/templates/view.tmpl
Zack Scholl 3cd7f84e1b Added total time to pages Issue #22
Former-commit-id: cafa73d9ad79299f3bb0049679d400479d655503 [formerly a49c91b6ed2187d40bba323e98b3f40373ecb855] [formerly 30ed4b6aedb03cff094e9a6ccd90f4e55ca8bff5 [formerly 71165300922812d6eb98203774d9bddcf119978e [formerly e6e5d701e6]]]
Former-commit-id: 9d4d1b049f4c253868704a377d7e813f0bff4adb [formerly 13817559a3e0c4e156cd85916d77d993ba61eda6]
Former-commit-id: 15d127b0267745ebcbcc4fd2a15abdba78d8efb9
Former-commit-id: 45977e42ff
2016-02-11 09:26:02 -05:00

112 lines
3.5 KiB
Cheetah

<!DOCTYPE html>
<html>
<head>
<title>{{ .Title }}</title>
{{ template "header" }}
<link rel="stylesheet" type="text/css" href="/static/css/view.css">
<link rel="stylesheet" type="text/css" href="/static/css/katex.min.css">
<script src="/static/js/katex.min.js"></script>
<style>
a.deleteable {
cursor: pointer;
}
</style>
</head>
<body>
<!-- Fixed navbar -->
<nav class="navbar navbar-default navbar-fixed-bottom">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="/">{{ .WikiName }}</a>
</div>
<div id="navbar" class="collapse navbar-collapse">
<ul class="nav navbar-nav">
<li><a href="/{{ .Title }}"><span class="glyphicon glyphicon-pencil" aria-hidden="true"></span> Edit</a></li>
<li class="dropdown active">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false" class="active"><span class="glyphicon glyphicon-sunglasses" aria-hidden="true"></span> View <span class="caret"></span></a>
<ul class="dropdown-menu">
<li class="dropdown-header">Total time: {{ .TotalTime }}</li>
<li><a href="/{{ .Title }}/view?version=0">First</a></li>
{{ range .Versions }}
<li><a href="/{{ $.Title }}/view?version={{ .VersionNum }}">{{ .VersionDate }}</a></li>
{{ end }}
<li><a href="/{{ .Title }}/view">Current</a></li>
</ul>
</li>
<li><a href="/{{ .Title }}/list"><span class="glyphicon glyphicon-align-left" aria-hidden="true"></span> List</a></li>
<li><a href="/about/view"><span class="glyphicon glyphicon-question-sign" aria-hidden="true"></span> About</a></li>
</ul>
</div>
<!--/.nav-collapse -->
</div>
</nav>
<div class="yue">
{{ .Body }}
</div>
<script>
$( document ).ready(function() {
var texi = document.getElementsByClassName("texi");
Array.prototype.forEach.call(texi, function(el) {
katex.render(el.getAttribute("data-expr"), el, { displayMode: false });
});
var texp = document.getElementsByClassName("texp");
Array.prototype.forEach.call(texp, function(el) {
katex.render(el.getAttribute("data-expr"), el, { displayMode: true });
});
});
$(document).keydown(function(e){
if( e.which === 69 && e.ctrlKey && e.shiftKey ){
console.log('control + shift + e');
window.location = "/{{ .Title }}";
}
});
$(document).keydown(function(e){
if( e.which === 76 && e.ctrlKey && e.shiftKey ){
console.log('control + shift + l');
window.location = "/{{ .Title }}/list";
}
});
{{ if .AdminKey }}
$('.deleteable').click(function(event) {
event.preventDefault();
var deleteName = $(this).attr('id')
var href = $(this).attr('href')
console.log(deleteName)
$.ajax({
url: "/deletepage" + '?' + $.param({
"DeleteName": deleteName,
"AdminKey": "{{ .AdminKey }}"
}),
type: 'DELETE',
success: function() {
window.location.reload(true);
}
});
});
{{ end }}
</script>
</body>
</html>