Module: Fg::H5Uploader
- Defined in:
- lib/h5_uploader.rb,
lib/h5_uploader/railtie.rb
Defined Under Namespace
Classes: Railtie
Class Method Summary collapse
- .parse_uploader_options(options, name) ⇒ Object
- .uploader_field_id(label) ⇒ Object
- .uploader_js_content(name, options) ⇒ Object
Class Method Details
.parse_uploader_options(options, name) ⇒ Object
27 28 29 30 31 32 |
# File 'lib/h5_uploader.rb', line 27 def self. ,name [:id] = uploader_field_id(name) [:action] ||= '/public/system/' [:allowedExtensions] ||= [] [:params] ||= {} end |
.uploader_field_id(label) ⇒ Object
23 24 25 |
# File 'lib/h5_uploader.rb', line 23 def self.uploader_field_id(label) "field_uploader_#{label}" end |
.uploader_js_content(name, options) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/h5_uploader.rb', line 8 def self.uploader_js_content name, jss = "var uploader_#{[:id]} = new qq.FileUploader({" jss = jss << "element: document.getElementById('#{[:id]}')," jss = jss << "allowedExtensions: #{[:allowedExtensions].to_s}" jss = jss << ",params: #{[:params].to_json}" unless [:params].nil? .each do |key,value| next if [:id,:allowedExtensions,:params].include?(key) val = (key =~ /[^(on|show|mess)]/) > 0 ? "#{value}" : "'#{value}'" jss = jss << ",#{key}: #{val}" end jss = jss << "});" end |