Commit 0e5dbd1c authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Merge pull request #1231 from NARKOZ/preview_notes

Preview window is not closed after post
parents 07fe78b3 0b7e67ad
...@@ -72,7 +72,7 @@ $(document).ready(function(){ ...@@ -72,7 +72,7 @@ $(document).ready(function(){
* Note markdown preview * Note markdown preview
* *
*/ */
$('#preview-link').on('click', function(e) { $(document).on('click', '#preview-link', function(e) {
$('#preview-note').text('Loading...'); $('#preview-note').text('Loading...');
var previewLinkText = ($(this).text() == 'Preview' ? 'Edit' : 'Preview'); var previewLinkText = ($(this).text() == 'Preview' ? 'Edit' : 'Preview');
......
- if note.valid? - if note.valid?
:plain :plain
$("#new_note .errors").remove(); $("#new_note .error").remove();
$('#new_note textarea').val(""); $('#new_note textarea').val("");
$('#preview-link').text('Preview');
$('#preview-note').hide(); $('#note_note').show();
NoteList.prepend(#{note.id}, "#{escape_javascript(render partial: "notes/show", locals: {note: note})}"); NoteList.prepend(#{note.id}, "#{escape_javascript(render partial: "notes/show", locals: {note: note})}");
- else - else
:plain :plain
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment