summaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorAzul <azul@leap.se>2014-05-20 09:13:25 +0200
committerAzul <azul@leap.se>2014-05-26 12:59:26 +0200
commit730e31017109994c24db431fde12f575ed5c1467 (patch)
tree027f9878e38ba339ad20f565278e1e9143a98b52 /engines
parente7d6bcce2a04a049926e75074605a2e7f91ede1a (diff)
FlashResponder will automagically add flash messages
Diffstat (limited to 'engines')
-rw-r--r--engines/support/app/controllers/tickets_controller.rb13
1 files changed, 6 insertions, 7 deletions
diff --git a/engines/support/app/controllers/tickets_controller.rb b/engines/support/app/controllers/tickets_controller.rb
index 99357ab..19663c3 100644
--- a/engines/support/app/controllers/tickets_controller.rb
+++ b/engines/support/app/controllers/tickets_controller.rb
@@ -23,11 +23,8 @@ class TicketsController < ApplicationController
@ticket.comments.last.posted_by = current_user.id
@ticket.comments.last.private = false unless admin?
@ticket.created_by = current_user.id
- if @ticket.save
- flash[:notice] = t(:thing_was_successfully_created, :thing => t(:ticket))
- if !logged_in?
- flash[:notice] += " " + t(:access_ticket_text, :full_url => ticket_url(@ticket.id))
- end
+ if @ticket.save && !logged_in?
+ flash[:success] = t(:access_ticket_text, :full_url => ticket_url(@ticket.id))
end
respond_with(@ticket, :location => auto_ticket_path(@ticket))
end
@@ -62,10 +59,8 @@ class TicketsController < ApplicationController
end
if @ticket.changed? and @ticket.save
- flash[:notice] = t(:changes_saved)
redirect_to_tickets
else
- flash[:error] = @ticket.errors.full_messages.join(". ") if @ticket.changed?
redirect_to auto_ticket_path(@ticket)
end
end
@@ -88,6 +83,10 @@ class TicketsController < ApplicationController
@title = t(:tickets)
end
+ def self.responder
+ Responders::FlashResponder
+ end
+
private
#