FEATURE: show raw email for replies/topics created via email
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
import ModalFunctionality from 'discourse/mixins/modal-functionality';
|
||||
|
||||
import ObjectController from 'discourse/controllers/object';
|
||||
|
||||
/**
|
||||
This controller handles displaying of raw email
|
||||
|
||||
@class RawEmailController
|
||||
@extends ObjectController
|
||||
@namespace Discourse
|
||||
@uses ModalFunctionality
|
||||
@module Discourse
|
||||
**/
|
||||
export default ObjectController.extend(ModalFunctionality, {
|
||||
raw_email: "",
|
||||
|
||||
loadEmail: function(postId) {
|
||||
var self = this;
|
||||
Discourse.Post.load(postId).then(function (result) {
|
||||
self.set("raw_email", result.get('raw_email'));
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
@@ -73,6 +73,11 @@ Discourse.TopicRoute = Discourse.Route.extend({
|
||||
this.controllerFor('modal').set('modalClass', 'history-modal');
|
||||
},
|
||||
|
||||
showRawEmail: function(post) {
|
||||
Discourse.Route.showModal(this, 'raw-email', post);
|
||||
this.controllerFor('raw_email').loadEmail(post.get("id"));
|
||||
},
|
||||
|
||||
mergeTopic: function() {
|
||||
Discourse.Route.showModal(this, 'mergeTopic', this.modelFor('topic'));
|
||||
},
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
<div class="modal-body">
|
||||
{{#if raw_email}}
|
||||
<pre><code>{{raw_email}}</code></pre>
|
||||
{{else}}
|
||||
Not Available!
|
||||
{{/if}}
|
||||
</div>
|
||||
@@ -53,7 +53,7 @@
|
||||
<div class="post-info wiki" title="{{i18n post.wiki.about}}" {{action "editPost" this}}><i class="fa fa-pencil-square-o"></i></div>
|
||||
{{/if}}
|
||||
{{#if via_email}}
|
||||
<div class="post-info via-email" title="{{i18n post.via_email}}"><i class="fa fa-envelope-o"></i></div>
|
||||
<div class="post-info via-email" title="{{i18n post.via_email}}" {{action "showRawEmail" this}}><i class="fa fa-envelope-o"></i></div>
|
||||
{{/if}}
|
||||
<div {{bind-attr class=":read-state read"}} title="{{i18n post.unread}}"><i class='fa fa-circle'></i></div>
|
||||
</div>
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
export default Discourse.ModalBodyView.extend({
|
||||
templateName: 'modal/raw_email',
|
||||
title: I18n.t('raw_email'),
|
||||
|
||||
resizeModal: function(){
|
||||
var viewPortHeight = $(window).height();
|
||||
this.$(".modal-body").css("max-height", Math.floor(0.8 * viewPortHeight) + "px");
|
||||
}.on("didInsertElement")
|
||||
});
|
||||
Reference in New Issue
Block a user