Module: CustomerFiltersHelper

Defined in:
app/helpers/customer_filters_helper.rb

Overview

== Schema Information

Table name: customer_filters

id :integer not null, primary key
name :string(255) not null
position :integer
store_id :integer
state_codes :string(2) default([]), is an Array
cities :string(255) default([]), is an Array
postal_codes :string(10) default([]), is an Array
report_groupings :string(20) default([]), is an Array
customer_states :string(255) default([]), is an Array
exclude_catalog_ids :boolean default(FALSE)
exclude_profile_ids :boolean default(FALSE)
exclude_state_codes :boolean default(FALSE)
exclude_cities :boolean default(FALSE)
exclude_postal_codes :boolean default(FALSE)
exclude_buying_group_ids :boolean default(FALSE)
exclude_source_ids :boolean default(FALSE)
exclude_report_groupings :boolean default(FALSE)
exclude_customer_states :boolean default(FALSE)
exclude_parties :boolean default(FALSE)
creator_id :integer
updater_id :integer
created_at :datetime not null
updated_at :datetime not null
digest :string(32)
exclude_tier2_program_pricing_ids :boolean default(FALSE)
has_phone :integer default(0), not null
has_email :integer default(0), not null
has_fax :integer default(0), not null

Instance Method Summary collapse

Instance Method Details

#filter_indicator(customer_filter, attribute, exclude_field = nil) ⇒ Object



36
37
38
39
40
41
42
43
44
45
46
47
# File 'app/helpers/customer_filters_helper.rb', line 36

def filter_indicator(customer_filter, attribute, exclude_field = nil)
	present = customer_filter.send(attribute.to_sym).exists?
	exclude_field ||= "exclude_#{attribute.to_s.singularize}_ids" 
	exclude_field = exclude_field.to_sym
	exclude = (customer_filter.respond_to?(exclude_field) and customer_filter.send(exclude_field))
	if present 
		cf_icon = exclude ? 'ban' : 'check' 
		return fa_icon(cf_icon)
	else
		return nil
	end
end