Commit 0b7e67ad12dff04da6d7825a6125099ef0d21174

Authored by Nihad Abbasov
1 parent 6ebd360c

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

app/assets/javascripts/application.js
... ... @@ -74,7 +74,7 @@ $(document).ready(function(){
74 74 * Note markdown preview
75 75 *
76 76 */
77   - $('#preview-link').on('click', function(e) {
  77 + $(document).on('click', '#preview-link', function(e) {
78 78 $('#preview-note').text('Loading...');
79 79  
80 80 var previewLinkText = ($(this).text() == 'Preview' ? 'Edit' : 'Preview');
... ...
app/views/notes/_create_common.js.haml
1 1 - if note.valid?
2 2 :plain
3   - $("#new_note .errors").remove();
  3 + $("#new_note .error").remove();
4 4 $('#new_note textarea').val("");
  5 + $('#preview-link').text('Preview');
  6 + $('#preview-note').hide(); $('#note_note').show();
5 7 NoteList.prepend(#{note.id}, "#{escape_javascript(render partial: "notes/show", locals: {note: note})}");
6 8 - else
7 9 :plain
... ...