Class: AdminAssistant::Request::Index

Inherits:
Base
  • Object
show all
Defined in:
lib/admin_assistant/request/index.rb

Instance Method Summary collapse

Methods inherited from Base

#action, #after_template_file, #before_template_file, #initialize, #model_class, #model_class_symbol, #origin, #render_multi_form, #render_single_form, #render_template_file, #render_to_string, #render_to_string_if_exists

Constructor Details

This class inherits a constructor from AdminAssistant::Request::Base

Instance Method Details

#callObject



4
5
6
7
8
9
10
11
12
13
# File 'lib/admin_assistant/request/index.rb', line 4

def call
  index = AdminAssistant::Index.new(
    @admin_assistant, @controller.params, controller_methods
  )
  @controller.instance_variable_set :@index, index
  if @controller.respond_to?(:before_render_for_index)
    @controller.send :before_render_for_index
  end
  render_template_file
end

#columnsObject



15
16
17
# File 'lib/admin_assistant/request/index.rb', line 15

def columns
  @admin_assistant.index_settings.columns
end

#controller_methodsObject



19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/admin_assistant/request/index.rb', line 19

def controller_methods
  c_methods = {}
  possible_methods = [
    :conditions_for_index, :extra_right_column_links_for_index
  ]
  possible_methods.each do |mname|
    if @controller.respond_to?(mname)
      c_methods[mname] = @controller.method mname
    end
  end
  c_methods
end