Skip to content

Commit

Permalink
Fix(Notifications): Better flash messages
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisma committed Mar 25, 2019
1 parent 2f4bd89 commit 71fd00f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
6 changes: 3 additions & 3 deletions app/controllers/notifications_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ def index
# DELETE /notifications/1
def destroy
if @notification.destroy
notice = 'Notification was successfully deleted.'
notice = "Notification '#{@notification.title}' was successfully deleted."
else
alert = 'Error while deleting notification.'
alert = "Error while deleting notification '#{@notification.title}'."
end
redirect_back fallback_location: notifications_path, notice: notice, alert: alert
end
Expand All @@ -34,7 +34,7 @@ def mark_as_read
if @notification.save
redirect_back fallback_location: notifications_path
else
redirect_back fallback_location: notifications_path, alert: 'Something went wrong.'
redirect_back fallback_location: notifications_path, alert: 'Error while marking notifcation as read.'
end
end

Expand Down
2 changes: 0 additions & 2 deletions app/views/notifications/index.html.erb
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
<p id="notice"><%= notice %></p>

<h1>Notifications</h1>

<%= render 'list' %>

0 comments on commit 71fd00f

Please sign in to comment.