Commit 0b7e67ad authored by Nihad Abbasov's avatar Nihad Abbasov

fix note preview link, and hide preview and errors after posting a comment

parent 6ebd360c
...@@ -74,7 +74,7 @@ $(document).ready(function(){ ...@@ -74,7 +74,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