Sha256: 63a9687ec5445679db29ec1f1748c8a41048d6e659c37c82297c1b5b4d5783fa

Contents?: true

Size: 928 Bytes

Versions: 4

Compression:

Stored size: 928 Bytes

Contents

module Bhf
  module PagesHelper
    
    def get_value(key, platform_name)
      params[platform_name][key] if params[platform_name] && params[platform_name][key] && params[platform_name][key].is_a?(String)
    end

    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

    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

  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
bhf-0.2.3 app/helpers/bhf/pages_helper.rb
bhf-0.2.2 app/helpers/bhf/pages_helper.rb
bhf-0.2.1 app/helpers/bhf/pages_helper.rb
bhf-0.2.0 app/helpers/bhf/pages_helper.rb