diff options
author | Nihad Abbasov <narkoz.2008@gmail.com> | 2012-08-08 02:25:24 -0700 |
---|---|---|
committer | Nihad Abbasov <narkoz.2008@gmail.com> | 2012-08-09 23:47:48 -0700 |
commit | 9639780359f16d784f22af2a1dbbcd8322ffd6c3 (patch) | |
tree | f8c56161b0d6561568f088df9961362eb1ece88b /app/assets/javascripts | |
parent | 1ec3bd3f8d237c1afb73d4ad1b7a0c24f9a6887c (diff) | |
download | gitlab-ce-9639780359f16d784f22af2a1dbbcd8322ffd6c3.tar.gz |
render notes preview on server-side
Diffstat (limited to 'app/assets/javascripts')
-rw-r--r-- | app/assets/javascripts/application.js | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index be6eb922f53..25732ae5289 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -18,7 +18,6 @@ //= require chosen-jquery //= require raphael //= require branch-graph -//= require Markdown.Converter //= require_tree . $(document).ready(function(){ @@ -76,15 +75,17 @@ $(document).ready(function(){ * */ $('#preview-link').on('click', function(e) { - var note = $('#note_note').val(); - if (note.trim().length === 0) { note = 'Nothing to preview'; } - var converter = new Markdown.Converter(); - var md_preview = converter.makeHtml(note); - $('#preview-note').html(md_preview); + $('#preview-note').text('Loading...'); var previewLinkText = ($(this).text() == 'Preview' ? 'Edit' : 'Preview'); $(this).text(previewLinkText); + var note = $('#note_note').val(); + if (note.trim().length === 0) { note = 'Nothing to preview'; } + $.post($(this).attr('href'), {note: note}, function(data) { + $('#preview-note').html(data); + }); + $('#preview-note, #note_note').toggle(); e.preventDefault(); }); |