Commit 0e5dbd1caf10baf7e812ad2eccbadce2f05a3f13

Authored by Dmitriy Zaporozhets
2 parents 07fe78b3 0b7e67ad

Merge pull request #1231 from NARKOZ/preview_notes

Preview window is not closed after post
app/assets/javascripts/application.js
... ... @@ -72,7 +72,7 @@ $(document).ready(function(){
72 72 * Note markdown preview
73 73 *
74 74 */
75   - $('#preview-link').on('click', function(e) {
  75 + $(document).on('click', '#preview-link', function(e) {
76 76 $('#preview-note').text('Loading...');
77 77  
78 78 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
... ...