Sha256: cb9489118aa9dbd12c95fa195f087921ea93ec1d34b9ba160d6be7e58f890053

Contents?: true

Size: 1003 Bytes

Versions: 48

Compression:

Stored size: 1003 Bytes

Contents

class Admin::Responder < ActionController::Responder
  
   def navigation_location
     follow = options.delete(:action) || (controller.respond_to?(:show) ? :show : :edit)
        
     default_location = if delete?
       {:action => :index}
     elsif (follow.to_sym == :show)
       [:dealers, resource]
     else
        [follow, :admin, resource]
     end
        
     l = options[:location] || default_location
   end
   
   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

end

Version data entries

48 entries across 48 versions & 1 rubygems

Version Path
fullstack-admin-0.1.19 app/controllers/admin/responder.rb
fullstack-admin-0.1.18 app/controllers/admin/responder.rb
fullstack-admin-0.1.17 app/controllers/admin/responder.rb
fullstack-admin-0.1.16 app/controllers/admin/responder.rb
fullstack-admin-0.1.15 app/controllers/admin/responder.rb
fullstack-admin-0.1.14 app/controllers/admin/responder.rb
fullstack-admin-0.1.12 app/controllers/admin/responder.rb
fullstack-admin-0.1.11 app/controllers/admin/responder.rb