Sha256: 7d8eff42c5f99e25ac4b8ef7ba98e4a491b05d543896424a1f2114c0bc612221
Contents?: true
Size: 1.21 KB
Versions: 4
Compression:
Stored size: 1.21 KB
Contents
module AjaxLoading module ControllerClassMethods def ajax_loading class_eval do include AjaxLoading::ActionControllerExtensions helper_method :container, :ajax_function end end end module ActionControllerExtensions def container @container ||= (params[:container] || choose_container) end def ajax_function @ajax_function ||= (params[:ajax_function] || choose_ajax_function) end def choose_container case params[:action].to_sym when :destroy resource.element_id when :create "main_container" when :new "main_container" when :edit resource.element_id when :index "main_container" when :show "main_container" when :update resource.element_id end end def choose_ajax_function case params[:action].to_sym when :destroy "remove" when :create "append" when :new "append" when :edit "html" when :show "html" when :index "html" when :update "html" end end end end ActionController::Base.extend AjaxLoading::ControllerClassMethods
Version data entries
4 entries across 4 versions & 1 rubygems