Sha256: bde68221bcc89d25b1b96cddb6512b137e1b6101a14459958bb5bbe71c6f06e8
Contents?: true
Size: 953 Bytes
Versions: 4
Compression:
Stored size: 953 Bytes
Contents
module Headmin module RequestHelper def current_url?(url) uri = URI(url) path = uri.path query_string = uri.query matches_path = request.path.include?(path) matches_query = uri.query ? request.query_string.include?(query_string) : true is_root = request.fullpath == url if url == admin_root_path is_root else matches_path && matches_query end end def default_params params.select { |key, value| is_default_param?(key) } end def add_default_param_key(key) keys = default_param_keys || [] keys.push(key) @default_param_keys = keys end def default_param_keys @default_param_keys ||= [:page, :start, :length, :per_page] end def is_default_param?(key) default_param_keys.include?(key.to_sym) || is_sort_param_key?(key) end def is_sort_param_key?(key) key.to_s.include?('sort_') end end end
Version data entries
4 entries across 4 versions & 1 rubygems