MailHog/mailhog/templates/index.go

154 lines
4.4 KiB
Go
Raw Normal View History

2014-04-20 14:35:59 +00:00
package templates
func Index() string {
return `
<style>
.messages {
2014-04-23 22:01:48 +00:00
padding-top: 51px;
2014-04-20 14:35:59 +00:00
height: 30%;
2014-04-23 22:01:48 +00:00
min-height: 280px;
border-bottom: 1px solid #CCCCCC;
2014-04-20 14:35:59 +00:00
}
2014-04-23 22:01:48 +00:00
#messages-container {
height: 100%;
overflow-y: scroll;
2014-04-20 14:35:59 +00:00
}
.preview #headers {
border-bottom: 1px solid #DDDDDD;
}
.selected {
background: #DADAFA;
}
2014-04-20 19:03:53 +00:00
table td, table th {
2014-04-20 14:35:59 +00:00
padding: 2px 4px 2px 4px !important;
}
2014-04-23 22:01:48 +00:00
table thead {
background: #eee;
}
2014-04-20 19:13:39 +00:00
table#headers {
margin-bottom: 2px;
2014-04-23 22:01:48 +00:00
background: #eee;
2014-04-20 19:13:39 +00:00
}
#content .nav>li>a {
padding: 5px 8px;
}
#content {
padding: 0px 2px;
}
2014-04-23 22:01:48 +00:00
.preview #headers tbody td {
width: 100%;
}
.preview #headers tbody th {
white-space: nowrap;
padding-right: 10px !important;
padding-left: 10px !important;
text-align: right;
color: #666;
font-weight: normal;
}
#preview-plain, #preview-source {
white-space: pre;
font-family: Courier New, Courier, System, fixed-width;
}
.tab-content {
padding: 3px;
}
2014-04-20 14:35:59 +00:00
</style>
<div class="modal fade" id="confirm-delete-all">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
<h4 class="modal-title">Delete all messages?</h4>
</div>
<div class="modal-body">
<p>Are you sure you want to delete all messages?</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
<button type="button" class="btn btn-danger" ng-click="deleteAllConfirm()">Delete all messages</button>
</div>
</div>
</div>
</div>
<div class="messages">
2014-04-23 22:01:48 +00:00
<div id="messages-container">
<table class="table">
<tr>
<th>From</th>
<th>To</th>
<th>Subject</th>
<th>Received</th>
<th>Actions</th>
</tr>
<tbody>
<tr ng-repeat="message in messages" ng-click="selectMessage(message)" ng-class="{ selected: message.Id == preview.Id }">
<td>
{{ message.From.Mailbox }}@{{ message.From.Domain }}
</td>
<td>
<span ng-repeat="to in message.To">
{{ to.Mailbox }}@{{ to.Domain }}
</span>
</td>
<td>
{{ message.Content.Headers.Subject.0 }}
</td>
<td>
{{ date(message.Created) }}
</td>
<td>
<button class="btn btn-xs btn-default" title="Delete" ng-click="deleteOne(message)"><span class="glyphicon glyphicon-remove"></span></button>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="preview" ng-if="preview">
<table class="table" id="headers">
<tbody ng-if="!previewAllHeaders">
<tr>
<th>From</th>
<td>{{ preview.Content.Headers["From"][0] }}</td>
</tr>
<tr>
<th>Subject</th>
<td><strong>{{ preview.Content.Headers["Subject"][0] }}</strong></td>
</tr>
<tr>
<th>To</th>
2014-04-20 14:35:59 +00:00
<td>
<button ng-click="$parent.previewAllHeaders = true" type="button" class="btn btn-default pull-right btn-xs">Show headers <span class="glyphicon glyphicon-chevron-down"></span></button>
2014-04-23 22:01:48 +00:00
{{ preview.Content.Headers["To"].join(', ') }}
2014-04-20 14:35:59 +00:00
</td>
2014-04-23 22:01:48 +00:00
</tr>
</tbody>
<tbody ng-if="previewAllHeaders">
<tr ng-repeat="(header, value) in preview.Content.Headers">
<th>
{{ header }}
</th>
2014-04-20 14:35:59 +00:00
<td>
<button ng-if="$last" ng-click="$parent.$parent.$parent.previewAllHeaders = false" type="button" class="btn btn-default pull-right btn-xs">Hide headers <span class="glyphicon glyphicon-chevron-up"></span></button>
2014-04-23 22:01:48 +00:00
<div ng-repeat="v in value">{{ v }}</div>
2014-04-20 14:35:59 +00:00
</td>
</tr>
</tbody>
</table>
2014-04-20 19:13:39 +00:00
<div id="content">
<ul class="nav nav-tabs">
<li class="active"><a href="#preview-html" data-toggle="tab">HTML</a></li>
<li><a href="#preview-plain" data-toggle="tab">Plain text</a></li>
<li><a href="#preview-source" data-toggle="tab">Source</a></li>
</ul>
<div class="tab-content">
<div class="tab-pane active" id="preview-html" ng-bind-html="preview.previewHTML"></div>
2014-04-23 22:01:48 +00:00
<div class="tab-pane" id="preview-plain">{{ getMessagePlain(preview) }}</div>
<div class="tab-pane" id="preview-source">{{ getSource(preview) }}</div>
2014-04-20 19:13:39 +00:00
</div>
</div>
2014-04-20 14:35:59 +00:00
</div>
`;
}