1
0
mirror of https://github.com/schollz/cowyo.git synced 2023-08-10 21:13:00 +03:00
cowyo/templates/list.tmpl
Zack 2174edd471 Works so much better
Former-commit-id: a9b40f31f0753157af8500353395274b474642a2 [formerly 57875519283c5bfbfa6d852a27d72dc091157faa] [formerly bc0dde2306cf0e189d69349f344dffda393de1cc [formerly aecad9ba02f4aa09f9aef5add7df035e91e4b1a3 [formerly 19aaf7bb44]]]
Former-commit-id: eb77f04e333250fef6799da788b460b77468dddf [formerly c3ddbc51302fbb8fc89410f114013b3a19f33cb8]
Former-commit-id: 814d1b257f6529e8ec45ba7acfa7269967900397
Former-commit-id: 6f445a7668
2016-02-07 11:05:38 -05:00

73 lines
1.9 KiB
Cheetah

<!DOCTYPE html>
<html>
<head>
<title>{{ .Title }}</title>
<meta name="viewport" content="width=device-width, initial-scale=1"> {{ template "header" }}
<link rel="stylesheet" type="text/css" href="/static/css/view.css">
</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="/">Cowyo</a>
</div>
<div id="navbar" class="collapse navbar-collapse">
<ul class="nav navbar-nav">
<li><a href="/{{ .Title }}">Edit</a></li>
<li><a href="/{{ .Title }}/view">View</a></li>
<li class="active"><a href="/{{ .Title }}/list">List</a></li>
<li><a href="/about/view">About</a></li>
</ul>
</div>
<!--/.nav-collapse -->
</div>
</nav>
<div class="yue">
<ul>
{{ range $index, $element := .ListItems }}
<a href="#" id="{{ $index }}" class="deletable">{{ $element }}</a>
{{ end }}
</ul>
</div>
<script>
$('.deletable').click(function(event) {
event.preventDefault();
var lineNum = $(this).attr('id')
var href = $(this).attr('href')
if (href == "#") {
console.log(lineNum)
$.ajax({
url: "/listitem" + '?' + $.param({
"lineNum": lineNum,
"title": "{{ .Title }}"
}),
type: 'DELETE',
success: function() {
window.location.reload(true);
}
});
}
});
</script>
</body>
</html>