Module: WillFilter::ActionViewExtension

Extended by:
ActiveSupport::Concern
Defined in:
lib/will_filter/extensions/action_view_extension.rb

Instance Method Summary collapse

Instance Method Details

#will_filter_actions_bar_tag(results, actions, opts = {}) ⇒ Object



55
56
57
58
59
60
# File 'lib/will_filter/extensions/action_view_extension.rb', line 55

def will_filter_actions_bar_tag(results, actions, opts = {})
 filter = results.wf_filter
 opts[:class] ||= "wf_actions_bar_blue"
 opts[:style] ||= ""
 render(:partial => "/will_filter/common/actions_bar", :locals => {:results => results, :filter => filter, :actions => actions, :opts => opts})
end

#will_filter_details_tag(obj, opts = {}) ⇒ Object



62
63
64
65
66
67
68
69
# File 'lib/will_filter/extensions/action_view_extension.rb', line 62

def will_filter_details_tag(obj, opts = {})
  opts[:columns]      ||= obj.attribute_names.sort
  opts[:table_class]  ||= "wf_details_table"
  opts[:table_style]  ||= ""
  opts[:key_style]    ||= "width:200px;"
  opts[:value_style]  ||= "text-align:left"
  render(:partial => "/will_filter/common/details_table", :locals => {:object => obj, :opts => opts})
end

#will_filter_scripts_tag(opts = {}) ⇒ Object



41
42
43
# File 'lib/will_filter/extensions/action_view_extension.rb', line 41

def will_filter_scripts_tag(opts = {})
 render(:partial => '/will_filter/common/scripts', :locals => {:opts => opts})
end

#will_filter_table_tag(results, opts = {}) ⇒ Object



45
46
47
48
49
50
51
52
53
# File 'lib/will_filter/extensions/action_view_extension.rb', line 45

def will_filter_table_tag(results, opts = {})
 filter = results.wf_filter
 if results.size > 0
    opts[:columns] ||= (filter ? filter.model_column_keys : results.first.class.columns.collect{|col| col.name.to_sym})
 else
    opts[:columns] = []
 end
 render(:partial => "/will_filter/common/results_table", :locals => {:results => results, :filter => filter, :opts => opts})
end

#will_filter_tag(results, opts = {}) ⇒ Object



37
38
39
# File 'lib/will_filter/extensions/action_view_extension.rb', line 37

def will_filter_tag(results, opts = {})
 render(:partial => '/will_filter/filter/container', :locals => {:wf_filter => results.wf_filter, :opts => opts})
end