diff options
Diffstat (limited to 'view')
-rw-r--r-- | view/js/main.js | 19 | ||||
-rwxr-xr-x | view/tpl/prv_message.tpl | 11 |
2 files changed, 29 insertions, 1 deletions
diff --git a/view/js/main.js b/view/js/main.js index 3981d4266..1d6eca91d 100644 --- a/view/js/main.js +++ b/view/js/main.js @@ -1146,6 +1146,25 @@ function preview_post() { return true; } +function preview_mail() { + $("#mail-preview").val("1"); + $("#mail-preview-content").show(); + $.post( + "mail", + $("#prvmail-form").serialize(), + function(data) { + if(data.preview) { + $("#mail-preview-content").html(data.preview); + $("#mail-preview-content" + " a").click(function() { return false; }); + } + }, + "json" + ); + $("#mail-preview").val("0"); + return true; +} + + function unpause() { // unpause auto reloads if they are currently stopped totStopped = false; diff --git a/view/tpl/prv_message.tpl b/view/tpl/prv_message.tpl index 0c9b9ba1d..67588f717 100755 --- a/view/tpl/prv_message.tpl +++ b/view/tpl/prv_message.tpl @@ -10,6 +10,7 @@ <input type="hidden" id="inp-prvmail-expires" name="expires" value="{{$defexpire}}" /> <input type="hidden" name="media_str" id="jot-media" value="" /> + <input type="hidden" name="preview" id="mail-preview" value="0" /> {{if $new}} <div class="form-group"> @@ -35,9 +36,16 @@ </div> <div id="prvmail-submit-wrapper" class="form-group"> - <div id="prvmail-submit" class="pull-right"> + <div id="prvmail-submit-div" class="pull-right"> <button class="btn btn-primary btn-sm" type="submit" id="prvmail-submit" name="submit" value="{{$submit}}">{{$submit}}</button> </div> + + <div id="prvmail-preview-div" class="pull-right"> + <button class="btn btn-default btn-sm" id="prvmail-preview" title="{{$preview}}" onclick="preview_mail(); return false;"><i class="fa fa-eye"></i></button> + </div> + + + <div id="prvmail-tools" class="btn-toolbar pull-left"> <div class="btn-group"> <button id="main-editor-bold" class="btn btn-default btn-sm" title="{{$bold}}" onclick="inserteditortag('b', 'prvmail-text'); return false;"> @@ -101,6 +109,7 @@ </div> <div class="clear"></div> </div> + <div id="mail-preview-content" style="display: none;"></div> </form> </div> {{if $new}} |