Class: Admin::Responder

Inherits:
ActionController::Responder
  • Object
show all
Defined in:
app/controllers/admin/responder.rb

Instance Method Summary collapse

Instance Method Details



3
4
5
6
7
8
9
10
11
12
13
14
15
# File 'app/controllers/admin/responder.rb', line 3

def navigation_location
  follow = options.delete(:action) || (controller.respond_to?(:show) ? :show : :edit)
     
  default_location = if delete?
    {:action => :index}
  elsif (follow.to_sym == :show)
    [:admin, resource]
  else
     [follow, :admin, resource]
  end
     
  l = options[:location] || default_location
end

#to_htmlObject



17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'app/controllers/admin/responder.rb', line 17

def to_html
  unless get?
    default_success_message = delete? ? I18n.t("fullstack.admin.flash.success.delete") : I18n.t("fullstack.admin.flash.success.update")
    default_error_message   = delete? ? I18n.t("fullstack.admin.flash.error.delete")   : I18n.t("fullstack.admin.flash.error.update")
    
    if has_errors?
      controller.flash[:error] = options.delete(:error)  || default_error_message 
    else
      controller.flash[:notice] = options.delete(:success) || default_success_message 
    end      
  end
  super
end