mirror of
https://github.com/jhillyerd/inbucket.git
synced 2026-01-06 11:27:18 +00:00
109 lines
2.5 KiB
HTML
109 lines
2.5 KiB
HTML
{{define "title"}}{{printf "Inbucket for %v" .name}}{{end}}
|
|
{{define "navMail"}}true{{end}}
|
|
{{$name := .name}}
|
|
|
|
{{define "script"}}
|
|
<script>
|
|
var selected = "{{.selected}}";
|
|
function messageLoaded(responseText, textStatus, XMLHttpRequest) {
|
|
if (textStatus == "error") {
|
|
alert("Failed to load message, server said:\n" + responseText);
|
|
} else {
|
|
window.scrollTo(0,0);
|
|
}
|
|
}
|
|
|
|
function listLoaded() {
|
|
$('.listEntry').click(
|
|
function() {
|
|
$('.listEntry').removeClass("disabled");
|
|
$(this).addClass("disabled");
|
|
$('#emailContent').load('/mailbox/{{.name}}/' + this.id, messageLoaded);
|
|
selected = this.id;
|
|
}
|
|
)
|
|
$("#messageList").slideDown();
|
|
if (selected != "") {
|
|
$("#" + selected).click();
|
|
selected = "";
|
|
}
|
|
}
|
|
|
|
function loadList() {
|
|
$('#messageList').load("/mailbox/{{.name}}", listLoaded);
|
|
}
|
|
|
|
function reloadList() {
|
|
$('#messageList').hide();
|
|
loadList();
|
|
}
|
|
|
|
function listInit() {
|
|
$("#messageList").hide();
|
|
loadList();
|
|
}
|
|
|
|
function deleteMessage(id) {
|
|
$('#emailContent').empty();
|
|
$.ajax({
|
|
type: 'DELETE',
|
|
url: '/mailbox/{{.name}}/' + id,
|
|
success: reloadList
|
|
})
|
|
}
|
|
|
|
function htmlView(id) {
|
|
window.open('/mailbox/{{.name}}/' + id + "/html", '_blank',
|
|
'width=800,height=600,' +
|
|
'menubar=yes,resizable=yes,scrollbars=yes,status=yes,toolbar=yes');
|
|
}
|
|
|
|
function messageSource(id) {
|
|
window.open('/mailbox/{{.name}}/' + id + "/source", '_blank',
|
|
'width=800,height=600,' +
|
|
'menubar=no,resizable=yes,scrollbars=yes,status=no,toolbar=no');
|
|
}
|
|
|
|
function docReady() {
|
|
$('#nav-mail').addClass("active");
|
|
listInit();
|
|
}
|
|
|
|
$(document).ready(docReady)
|
|
</script>
|
|
{{end}}
|
|
|
|
{{define "content"}}
|
|
<div class="panel panel-info">
|
|
<div class="panel-heading mailbox-header">
|
|
<span class="glyphicon glyphicon-inbox" aria-hidden="true"></span>
|
|
{{.name}}
|
|
</div>
|
|
</div>
|
|
<div class="col-md-3">
|
|
<div class="text-center">
|
|
<a href="javascript:reloadList()">
|
|
<span class="glyphicon glyphicon-refresh" aria-hidden="true"></span>
|
|
Refresh
|
|
</a>
|
|
</div>
|
|
<div id="messageList" class="list-group"></div>
|
|
</div>
|
|
<div class="col-md-9">
|
|
{{with .ctx.Session.Flashes "errors"}}
|
|
<div class="errors">
|
|
<p>Please fix the following errors and resubmit:<p>
|
|
<ul>
|
|
{{range .}}
|
|
<li>{{.}}</li>
|
|
{{end}}
|
|
</ul>
|
|
</div>
|
|
{{end}}
|
|
<div id="emailContent">
|
|
<p>Select a message at left, or enter a different username into the box on upper right.</p>
|
|
</div>
|
|
</div>
|
|
{{end}}
|
|
|