Sha256: 06e3b6fbeef5ef8881579a2c423d5e19cce910fba6be104eb98198ab29c8bb1a
Contents?: true
Size: 1.14 KB
Versions: 1
Compression:
Stored size: 1.14 KB
Contents
module Uploadcare::Rails::ActionView module Helpers def uploadcare_include_tag(options = {}) version = options[:version] || Rails.application.config.uploadcare.widget_version min = options[:min].nil? || options[:min] url = "https://ucarecdn.com/widget/#{version}/uploadcare/uploadcare-#{version}#{'.min' if min}.js" javascript_include_tag(url) end def uploadcare_uploader_tag(name) hidden_field_tag name, nil, role: 'uploadcare-uploader' end def uploadcare_uploader_field(object_name, method, options = {}) options.symbolize_keys! role = "#{options[:role]} uploadcare-uploader" options.update(role: "#{options[:role]} uploadcare-uploader") hidden_field(object_name, method, options) end def self.included(arg) ActionView::Helpers::FormBuilder.send(:include, Uploadcare::Rails::ActionView::FormBuilder) end end module FormBuilder def uploadcare_uploader_field(method, options = {}) @template.uploadcare_uploader_field(@object_name, method, objectify_options(options)) end end end ActionView::Base.send :include, Uploadcare::Rails::ActionView::Helpers
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
uploadcare-rails-0.3 | lib/uploadcare/rails/action_view.rb |