Module: FilestackRails::ApplicationHelper
- Included in:
- FormHelper
- Defined in:
- app/helpers/filestack_rails/application_helper.rb
Instance Method Summary collapse
- #filestack_image(url, options = {}) ⇒ Object
- #filestack_image_url(url, transform_object = nil) ⇒ Object
- #filestack_js_include_tag ⇒ Object
- #filestack_js_init_tag ⇒ Object
- #filestack_picker_element(content, callback, options = {}) ⇒ Object
- #filestack_transform ⇒ Object
Instance Method Details
#filestack_image(url, options = {}) ⇒ Object
44 45 46 47 48 |
# File 'app/helpers/filestack_rails/application_helper.rb', line 44 def filestack_image(url, = {}) transform_object = .delete(:transform) image_tag(filestack_image_url(url, transform_object), ) end |
#filestack_image_url(url, transform_object = nil) ⇒ Object
50 51 52 53 54 |
# File 'app/helpers/filestack_rails/application_helper.rb', line 50 def filestack_image_url(url, transform_object = nil) return url unless transform_object transform_object.add_external_url(url) transform_object.fs_url end |
#filestack_js_include_tag ⇒ Object
7 8 9 |
# File 'app/helpers/filestack_rails/application_helper.rb', line 7 def filestack_js_include_tag javascript_include_tag(get_filestack_js.url, type: 'text/javascript') end |
#filestack_js_init_tag ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'app/helpers/filestack_rails/application_helper.rb', line 11 def filestack_js_init_tag client_name, apikey = get_client_and_api_key javascript_string = if filestack_js_v3? = { cname: cname } policy, signature = get_policy_and_signature if policy && signature [:security] = { policy: policy, signature: signature } end "var #{client_name} = filestack.init('#{apikey}', #{.to_json});" else signature_and_policy = get_policy_and_signature_string "var #{client_name} = filestack.init('#{apikey}', #{signature_and_policy}, '#{cname}');" end javascript_tag javascript_string end |
#filestack_picker_element(content, callback, options = {}) ⇒ Object
31 32 33 34 35 36 37 |
# File 'app/helpers/filestack_rails/application_helper.rb', line 31 def filestack_picker_element(content, callback, = {}) = [:pickerOptions] .delete(:pickerOptions) [:onclick] = create_javascript_for_picker(callback, ) [:type] = 'button' content, end |
#filestack_transform ⇒ Object
39 40 41 42 |
# File 'app/helpers/filestack_rails/application_helper.rb', line 39 def filestack_transform _, apikey = get_client_and_api_key get_transform(apikey) end |