1
0
mirror of https://github.com/schollz/cowyo.git synced 2023-08-10 21:13:00 +03:00
cowyo/templates/list.tmpl
Zack Scholl 2862d8c593 No li square
Former-commit-id: 83850548184d2bdb0daf7cf6bb1d1f8be4d26070 [formerly 28fe1e665a903eeee646bcd75d83c648b7d7d8ad] [formerly 9eeb86679c3e6cf05e751da4d19ba519907c975f [formerly 3ab7e5d4ff]]
Former-commit-id: be13cb11bd5670109d08d894cacfdfb850001ab3 [formerly b04318812bf9cf8291f49dcdea8e44578b2deffa]
Former-commit-id: 62ff39990e4df53e3e401455d8efc0d9ecd7e068
2016-02-09 06:53:03 -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>