mirror of
https://github.com/jhillyerd/inbucket.git
synced 2026-01-08 04:01:55 +00:00
Added partial templates
mailbox/list now renders
This commit is contained in:
12
themes/integral/templates/mailbox/_list.html
Normal file
12
themes/integral/templates/mailbox/_list.html
Normal file
@@ -0,0 +1,12 @@
|
||||
{{$name := .name}}
|
||||
{{range .messages}}
|
||||
<div class="box listEntry" id="{{.Id}}">
|
||||
<div class="subject">{{.Subject}}</div>
|
||||
<div class="from">{{.From}}</div>
|
||||
<div class="date">{{friendlyTime .Date}}</div>
|
||||
</div>
|
||||
{{else}}
|
||||
<div class="box">
|
||||
<p style="height: 30px; padding-left: 10px;">No messages!</p>
|
||||
</div>
|
||||
{{end}}
|
||||
1
themes/integral/templates/mailbox/html.html
Normal file
1
themes/integral/templates/mailbox/html.html
Normal file
@@ -0,0 +1 @@
|
||||
{{.body}}
|
||||
79
themes/integral/templates/mailbox/index.html
Normal file
79
themes/integral/templates/mailbox/index.html
Normal file
@@ -0,0 +1,79 @@
|
||||
{{define "title"}}{{printf "Inbucket for %v" .name}}{{end}}
|
||||
{{$name := .name}}
|
||||
|
||||
{{define "script"}}
|
||||
<script>
|
||||
function listLoaded() {
|
||||
$('.listEntry').hover(
|
||||
function() {
|
||||
$(this).addClass("listEntryHover")
|
||||
},
|
||||
function() {
|
||||
$(this).removeClass("listEntryHover")
|
||||
}
|
||||
).click(
|
||||
function() {
|
||||
$('.listEntry').removeClass("listEntrySelected")
|
||||
$(this).addClass("listEntrySelected")
|
||||
$('#emailContent').load('/mailbox/show/{{.name}}/' + this.id)
|
||||
}
|
||||
)
|
||||
$("#messageList").slideDown()
|
||||
}
|
||||
|
||||
function loadList() {
|
||||
$('#messageList').load("/mailbox/list/{{.name}}", listLoaded)
|
||||
}
|
||||
|
||||
function reloadList() {
|
||||
$('#messageList').hide()
|
||||
loadList()
|
||||
}
|
||||
|
||||
function listInit() {
|
||||
$("#messageList").hide()
|
||||
loadList()
|
||||
}
|
||||
|
||||
function deleteMessage(id) {
|
||||
$('#emailContent').empty()
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: '/mailbox/delete/{{.name}}/' + id,
|
||||
success: reloadList
|
||||
})
|
||||
}
|
||||
|
||||
function htmlView(id) {
|
||||
window.open('/mailbox/html/{{.name}}/' + id, '_blank',
|
||||
'width=800,height=600,' +
|
||||
'menubar=yes,resizable=yes,scrollbars=yes,status=yes,toolbar=yes')
|
||||
}
|
||||
|
||||
function messageSource(id) {
|
||||
window.open('/mailbox/source/{{.name}}/' + id, '_blank',
|
||||
'width=800,height=600,' +
|
||||
'menubar=no,resizable=yes,scrollbars=yes,status=no,toolbar=no')
|
||||
}
|
||||
|
||||
$(document).ready(listInit)
|
||||
</script>
|
||||
{{end}}
|
||||
|
||||
{{define "menu"}}
|
||||
<div id="logo">
|
||||
<h1><a href="#">inbucket</a></h1>
|
||||
<h2>mail for {{.name}}</h2>
|
||||
</div>
|
||||
<div class="box" style="text-align:center; padding-bottom:10px;">
|
||||
<a href="javascript:reloadList()">Refresh List</a>
|
||||
</div>
|
||||
<div id="messageList"></div>
|
||||
{{end}}
|
||||
|
||||
{{define "content"}}
|
||||
<div id="emailContent">
|
||||
<p>Select a message at left, or enter a different username into the box on upper right.</p>
|
||||
</div>
|
||||
{{end}}
|
||||
|
||||
21
themes/integral/templates/mailbox/show.html
Normal file
21
themes/integral/templates/mailbox/show.html
Normal file
@@ -0,0 +1,21 @@
|
||||
<div id="emailActions">
|
||||
<a href="javascript:deleteMessage('{{.message.Id}}');">Delete</a>
|
||||
<a href="javascript:messageSource('{{.message.Id}}');">Source</a>
|
||||
{{if .htmlAvailable}}
|
||||
<a href="javascript:htmlView('{{.message.Id}}');">HTML</a>
|
||||
{{end}}
|
||||
</div>
|
||||
<table id="emailHeader">
|
||||
<tr>
|
||||
<th>From:</th>
|
||||
<td>{{.message.From}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Date:</th>
|
||||
<td>{{.message.Date}}</td>
|
||||
</tr>
|
||||
<table>
|
||||
<div id="emailSubject"><h3>{{.message.Subject}}</h3></div>
|
||||
|
||||
<div id="emailBody">{{.body}}</div>
|
||||
|
||||
Reference in New Issue
Block a user