Sha256: ae4b15f9d0dd2f6f3957f86aeecc8541aed4dbbab325efcc9980a148e5a460c8

Contents?: true

Size: 559 Bytes

Versions: 2

Compression:

Stored size: 559 Bytes

Contents

module BrowseEverythingHelper

  def array_to_hidden_fields(array,key)
    fields = array.to_query(key).split(Rack::Utils::DEFAULT_SEP).collect do |pair|
      key,value=pair.split('=', 2).map { |str| Rack::Utils.unescape(str) }
      hidden_field_tag(key,value)
    end
    fields.join("\n").html_safe
  end

  def is_acceptable?(file)
    acceptable = params[:accept] || '*/*'
    acceptable_types = acceptable.split(/,\s*/)
    acceptable_types << 'application/x-directory'
    acceptable_types.any? { |type| Rack::Mime.match?(file.type, type) }
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
browse-everything-0.5.1 app/helpers/browse_everything_helper.rb
browse-everything-0.5.0 app/helpers/browse_everything_helper.rb