Commit 1f083636 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Merge branch 'comment-error' into 'master'

Add error for ajax:error when submitting comments

Fixes #13814
![Screen_Shot_2016-02-25_at_1.54.56_PM](/uploads/d70d706d306079df1b00d70f09affb63/Screen_Shot_2016-02-25_at_1.54.56_PM.png)
cc @dblessing 

See merge request !2976
parents 1cdc355a 136ba502
...@@ -30,6 +30,9 @@ class @Notes ...@@ -30,6 +30,9 @@ class @Notes
$(document).on "ajax:success", ".js-main-target-form", @addNote $(document).on "ajax:success", ".js-main-target-form", @addNote
$(document).on "ajax:success", ".js-discussion-note-form", @addDiscussionNote $(document).on "ajax:success", ".js-discussion-note-form", @addDiscussionNote
# catch note ajax errors
$(document).on "ajax:error", ".js-main-target-form", @addNoteError
# change note in UI after update # change note in UI after update
$(document).on "ajax:success", "form.edit-note", @updateNote $(document).on "ajax:success", "form.edit-note", @updateNote
...@@ -309,6 +312,10 @@ class @Notes ...@@ -309,6 +312,10 @@ class @Notes
addNote: (xhr, note, status) => addNote: (xhr, note, status) =>
@renderNote(note) @renderNote(note)
addNoteError: (xhr, note, status) =>
flash = new Flash('Your comment could not be submitted! Please check your network connection and try again.', 'alert')
flash.pinTo('.md-area')
### ###
Called in response to the new note form being submitted Called in response to the new note form being submitted
......
...@@ -361,7 +361,7 @@ class Spinach::Features::ProjectSourceBrowseFiles < Spinach::FeatureSteps ...@@ -361,7 +361,7 @@ class Spinach::Features::ProjectSourceBrowseFiles < Spinach::FeatureSteps
end end
step 'I can see the new rendered SVG image' do step 'I can see the new rendered SVG image' do
expect(find('.file-content')).to have_css('img') expect(page).to have_css('.file-content img')
end end
private private
......
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