Skip to content

Commit

Permalink
comment-error-msg (#8456)
Browse files Browse the repository at this point in the history
  • Loading branch information
urvashigupta7 authored Oct 6, 2020
1 parent 72b2f69 commit 484bf69
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion app/assets/javascripts/comment.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@

if(!$(this).hasClass('bound-error')) {
$(this).addClass('bound-error').bind('ajax:error', function(e,response){
notyNotification('mint', 3000, 'success', 'topRight', 'Some error occured while adding comment');
notyNotification('mint', 3000, 'error', 'topRight', 'Some error occured while adding comment');
$(this).find('#text-input').prop('disabled',false);
$(this).find('.control-group').addClass('has-error')
$(this).find('.control-group .help-block ').remove()
$(this).find('#text-input').val('');
Expand Down
4 changes: 2 additions & 2 deletions app/controllers/comment_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ def create
end
end
rescue CommentError
flash[:error] = 'The comment could not be saved.'
render plain: 'failure'
flash.now[:error] = 'The comment could not be saved.'
render plain: 'failure', status: :bad_request
end
end

Expand Down

0 comments on commit 484bf69

Please sign in to comment.