Sha256: 6fc058a8cbe1bc3228c9e44526e48df3985924c6519ede688f699f40a89369a8

Contents?: true

Size: 887 Bytes

Versions: 7

Compression:

Stored size: 887 Bytes

Contents

module Bhf
  module PagesHelper
    
    def get_value(key, platform_name)
      params[platform_name][key] if params[platform_name] && params[platform_name][key]
    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

7 entries across 7 versions & 1 rubygems

Version Path
bhf-0.1.6 app/helpers/bhf/pages_helper.rb
bhf-0.1.5 app/helpers/bhf/pages_helper.rb
bhf-0.1.4 app/helpers/bhf/pages_helper.rb
bhf-0.1.3 app/helpers/bhf/pages_helper.rb
bhf-0.1.2 app/helpers/bhf/pages_helper.rb
bhf-0.1.1 app/helpers/bhf/pages_helper.rb
bhf-0.1.0 app/helpers/bhf/pages_helper.rb