catbase/plugins/fact/webTemplates.go

113 lines
2.7 KiB
Go
Raw Normal View History

2016-01-17 18:00:44 +00:00
// © 2013 the CatBase Authors under the WTFPL. See AUTHORS for the list of authors.
package fact
2013-06-01 17:10:15 +00:00
// I hate this, but I'm creating strings of the templates to avoid having to
// track where templates reside.
// 2016-01-15 Later note, why are these in plugins and the server is in bot?
2013-06-01 17:10:15 +00:00
var factoidIndex string = `
<!DOCTYPE html>
<html>
<head>
2013-06-01 17:29:12 +00:00
<title>Factoids</title>
<link rel="stylesheet" href="http://yui.yahooapis.com/pure/0.1.0/pure-min.css">
2013-06-17 03:23:58 +00:00
<!-- DataTables CSS -->
<link rel="stylesheet" type="text/css" href="http://ajax.aspnetcdn.com/ajax/jquery.dataTables/1.9.4/css/jquery.dataTables.css">
<!-- jQuery -->
<script type="text/javascript" charset="utf8" src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.8.2.min.js"></script>
<!-- DataTables -->
<script type="text/javascript" charset="utf8" src="http://ajax.aspnetcdn.com/ajax/jquery.dataTables/1.9.4/jquery.dataTables.min.js"></script>
2013-06-01 17:10:15 +00:00
</head>
<div>
2013-06-01 20:20:45 +00:00
<form action="/factoid" method="GET" class="pure-form">
2013-06-01 17:29:12 +00:00
<fieldset>
<legend>Search for a factoid</legend>
<input type="text" name="entry" placeholder="trigger" value="{{.Search}}" />
<button type="submit" class="pure-button notice">Find</button>
</fieldset>
2013-06-01 17:10:15 +00:00
</form>
</div>
2013-06-01 17:29:12 +00:00
<div>
<style scoped>
.pure-button-success,
.pure-button-error,
.pure-button-warning,
.pure-button-secondary {
color: white;
border-radius: 4px;
text-shadow: 0 1px 1px rgba(0, 0, 0, 0.2);
padding: 2px;
}
2013-06-01 17:10:15 +00:00
2013-06-01 17:29:12 +00:00
.pure-button-success {
background: rgb(76, 201, 71); /* this is a green */
}
.pure-button-error {
background: rgb(202, 60, 60); /* this is a maroon */
}
.pure-button-warning {
background: orange;
}
2013-06-01 17:10:15 +00:00
2013-06-01 17:29:12 +00:00
.pure-button-secondary {
background: rgb(95, 198, 218); /* this is a light blue */
}
</style>
{{if .Error}}
<span id="error" class="pure-button-error">{{.Error}}</span>
{{end}}
{{if .Count}}
<span id="count" class="pure-button-success">Found {{.Count}} entries.</span>
{{end}}
</div>
{{if .Entries}}
<div style="padding-top: 1em;">
2013-06-17 03:23:58 +00:00
<table class="pure-table" id="factTable">
2013-06-01 17:29:12 +00:00
<thead>
<tr>
<th>Trigger</th>
<th>Full Text</th>
<th>Author</th>
<th># Hits</th>
</tr>
</thead>
<tbody>
{{range .Entries}}
<tr>
<td>{{.Trigger}}</td>
2013-06-01 21:24:05 +00:00
<td>{{linkify .FullText}}</td>
2013-06-01 17:29:12 +00:00
<td>{{.CreatedBy}}</td>
<td>{{.AccessCount}}</td>
</tr>
{{end}}
</tbody>
</table>
</div>
2013-06-01 17:10:15 +00:00
{{end}}
2013-06-17 03:23:58 +00:00
<script>
$(document).ready(function(){
$('#factTable').dataTable({
"bPaginate": false
});
});
</script>
2013-06-01 17:10:15 +00:00
</html>
`