mirror of
https://gitlab.com/ric_harvey/MailHog.git
synced 2024-11-27 16:24:04 +00:00
Add message source preview
This commit is contained in:
parent
37f916f5eb
commit
24ff88c151
2 changed files with 32 additions and 2 deletions
|
@ -23,6 +23,15 @@ func Index() string {
|
||||||
table td, table th {
|
table td, table th {
|
||||||
padding: 2px 4px 2px 4px !important;
|
padding: 2px 4px 2px 4px !important;
|
||||||
}
|
}
|
||||||
|
table#headers {
|
||||||
|
margin-bottom: 2px;
|
||||||
|
}
|
||||||
|
#content .nav>li>a {
|
||||||
|
padding: 5px 8px;
|
||||||
|
}
|
||||||
|
#content {
|
||||||
|
padding: 0px 2px;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
<div class="modal fade" id="confirm-delete-all">
|
<div class="modal fade" id="confirm-delete-all">
|
||||||
<div class="modal-dialog">
|
<div class="modal-dialog">
|
||||||
|
@ -74,7 +83,7 @@ func Index() string {
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
<div class="preview">
|
<div class="preview" ng-if="preview">
|
||||||
<table class="table" id="headers">
|
<table class="table" id="headers">
|
||||||
<tr ng-repeat="(header, value) in preview.Content.Headers">
|
<tr ng-repeat="(header, value) in preview.Content.Headers">
|
||||||
<th>
|
<th>
|
||||||
|
@ -85,7 +94,18 @@ func Index() string {
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
{{ preview.Content.Body }}
|
<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">{{ preview.Content.Body }}</div>
|
||||||
|
<div class="tab-pane" id="preview-plain"><pre>{{ preview.Content.Body }}</pre></div>
|
||||||
|
<div class="tab-pane" id="preview-source"><pre>{{ getSource(preview) }}</pre></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
`;
|
`;
|
||||||
}
|
}
|
|
@ -24,6 +24,16 @@ mailhogApp.controller('MailCtrl', function ($scope, $http) {
|
||||||
$('#confirm-delete-all').modal('show');
|
$('#confirm-delete-all').modal('show');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$scope.getSource = function(message) {
|
||||||
|
var source = "";
|
||||||
|
$.each(message.Content.Headers, function(k, v) {
|
||||||
|
source += k + ": " + v + "\n";
|
||||||
|
});
|
||||||
|
source += "\n";
|
||||||
|
source += message.Content.Body;
|
||||||
|
return source;
|
||||||
|
}
|
||||||
|
|
||||||
$scope.deleteAllConfirm = function() {
|
$scope.deleteAllConfirm = function() {
|
||||||
$('#confirm-delete-all').modal('hide');
|
$('#confirm-delete-all').modal('hide');
|
||||||
$http.post('/api/v1/messages/delete').success(function() {
|
$http.post('/api/v1/messages/delete').success(function() {
|
||||||
|
|
Loading…
Reference in a new issue