Module: Bhf::PagesHelper
- Defined in:
- app/helpers/bhf/pages_helper.rb
Instance Method Summary collapse
- #current_order_path(order_by, platform_name) ⇒ Object
- #get_value(key, p) ⇒ Object
- #has_link?(display_type) ⇒ Boolean
- #order_class(order_by, platform_name) ⇒ Object
Instance Method Details
#current_order_path(order_by, platform_name) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'app/helpers/bhf/pages_helper.rb', line 12 def current_order_path(order_by, platform_name) params_platfrom = params[platform_name] ? params[platform_name].clone : {} if params_platfrom['order'] == order_by && params_platfrom['direction'] != 'desc' params_platfrom['direction'] = 'desc' else params_platfrom['direction'] = 'asc' end params_platfrom['order'] = order_by url_for platform_name => params_platfrom end |
#get_value(key, p) ⇒ Object
4 5 6 7 8 9 10 |
# File 'app/helpers/bhf/pages_helper.rb', line 4 def get_value(key, p) return unless p.is_a?(Hash) return p[key[0]][key[1]] if key.is_a?(Array) && p[key[0]].is_a?(Hash) && p[key[0]][key[1]].is_a?(String) #omg p[key] if p[key] && p[key].is_a?(String) end |
#has_link?(display_type) ⇒ Boolean
33 34 35 |
# File 'app/helpers/bhf/pages_helper.rb', line 33 def has_link?(display_type) display_type.to_s.include? '_link' end |
#order_class(order_by, platform_name) ⇒ Object
26 27 28 29 30 31 |
# File 'app/helpers/bhf/pages_helper.rb', line 26 def order_class(order_by, platform_name) params_platfrom = params[platform_name] ? params[platform_name] : {} return unless params_platfrom['order'] == order_by params_platfrom['direction'] == 'desc' ? 'sorted desc' : 'sorted asc' end |