Sha256: 72e17271ec134a3b9326aa749f46b93c18715750637232276abebd3aa4723a9d

Contents?: true

Size: 1.01 KB

Versions: 15

Compression:

Stored size: 1.01 KB

Contents

module Bhf
  module PagesHelper

    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

    def current_order_path(order_by, platform_name)
      params_platfrom = params[platform_name] ? params[platform_name].clone : ActionController::Parameters.new({})
      params_platfrom.permit! 

      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

15 entries across 15 versions & 1 rubygems

Version Path
bhf-1.0.0.beta16 app/helpers/bhf/pages_helper.rb
bhf-1.0.0.beta15 app/helpers/bhf/pages_helper.rb
bhf-1.0.0.beta14 app/helpers/bhf/pages_helper.rb
bhf-1.0.0.beta13 app/helpers/bhf/pages_helper.rb
bhf-1.0.0.beta12 app/helpers/bhf/pages_helper.rb
bhf-1.0.0.beta11 app/helpers/bhf/pages_helper.rb
bhf-1.0.0.beta10 app/helpers/bhf/pages_helper.rb
bhf-1.0.0.beta9 app/helpers/bhf/pages_helper.rb
bhf-1.0.0.beta8 app/helpers/bhf/pages_helper.rb
bhf-1.0.0.beta7 app/helpers/bhf/pages_helper.rb
bhf-1.0.0.beta6 app/helpers/bhf/pages_helper.rb
bhf-1.0.0.beta5 app/helpers/bhf/pages_helper.rb
bhf-1.0.0.beta4 app/helpers/bhf/pages_helper.rb
bhf-1.0.0.beta3 app/helpers/bhf/pages_helper.rb
bhf-1.0.0.beta2 app/helpers/bhf/pages_helper.rb