Module: Fg::H5Uploader
- Defined in:
- lib/h5_uploader.rb,
lib/h5_uploader/railtie.rb
Defined Under Namespace
Classes: Railtie
Instance Method Summary collapse
- #parse_uploader_options(options, name) ⇒ Object
- #uploader_field_id(label) ⇒ Object
- #uploader_js_content(name, options) ⇒ Object
Instance Method Details
#parse_uploader_options(options, name) ⇒ Object
25 26 27 28 29 |
# File 'lib/h5_uploader.rb', line 25 def ,name [:id] = uploader_field_id(name) [:action] ||= '/public/system/' [:allowedExtensions] ||= [] end |
#uploader_field_id(label) ⇒ Object
21 22 23 |
# File 'lib/h5_uploader.rb', line 21 def 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 |
# File 'lib/h5_uploader.rb', line 8 def uploader_js_content name, jss = "var uploader = new qq.FileUploader({" jss = jss << "element: document.getElementById('#{[:id]}')," jss = jss << "allowedExtensions: #{[:allowedExtensions].to_s}" .each do |key,value| next if [:id,:allowedExtensions].include?(key) jss = jss << ",#{key} : '#{value}'" end jss = jss << "});" end |