Module: FilestackRails::ApplicationHelper

Included in:
FormHelper
Defined in:
app/helpers/filestack_rails/application_helper.rb

Instance Method Summary collapse

Instance Method Details

#filestack_image(url, options = {}) ⇒ Object


31
32
33
34
35
36
37
38
39
40
# File 'app/helpers/filestack_rails/application_helper.rb', line 31

def filestack_image(url, options = {})
  transform_object = options[:transform]
  options.delete(:transform)
  if transform_object
    transform_object.add_external_url url
    image_tag transform_object.fs_url, options
  else
    image_tag url, options
  end
end

#filestack_js_include_tagObject


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_tagObject


11
12
13
14
15
16
# File 'app/helpers/filestack_rails/application_helper.rb', line 11

def filestack_js_init_tag
  client_name, apikey = get_client_and_api_key
  signature_and_policy = get_policy_and_signature_string
  javascript_string = "var #{client_name} = filestack.init('#{apikey}', #{signature_and_policy}, '#{cname}');"
  javascript_tag javascript_string
end

#filestack_picker_element(content, callback, options = {}) ⇒ Object


18
19
20
21
22
23
24
# File 'app/helpers/filestack_rails/application_helper.rb', line 18

def filestack_picker_element(content, callback, options = {})
  picker_options = options[:pickerOptions]
  options.delete(:pickerOptions)
  options[:onclick] = create_javascript_for_picker(callback, picker_options)
  options[:type] = 'button'
  button_tag content, options
end

#filestack_transformObject


26
27
28
29
# File 'app/helpers/filestack_rails/application_helper.rb', line 26

def filestack_transform
  _, apikey = get_client_and_api_key
  get_transform(apikey)
end