Class: MagLoft::TypeloftTheme
Instance Attribute Summary collapse
#destroyed, #id
Instance Method Summary
collapse
all, #changed?, #changed_data, #clear_changed_data!, create, #destroy, #destroyed?, endpoint, find, find_one, #initialize, method_missing, remote_attribute, remote_attributes, respond_to_missing?, #save, #update_data, where
Instance Attribute Details
#javascript_policy ⇒ Object
Returns the value of attribute javascript_policy.
5
6
7
|
# File 'lib/magloft/typeloft_theme.rb', line 5
def javascript_policy
@javascript_policy
end
|
#stylesheet_policy ⇒ Object
Returns the value of attribute stylesheet_policy.
5
6
7
|
# File 'lib/magloft/typeloft_theme.rb', line 5
def stylesheet_policy
@stylesheet_policy
end
|
Instance Method Details
#typeloft_blocks ⇒ Object
#typeloft_images ⇒ Object
#typeloft_templates ⇒ Object
#upload_javascript(file_path) ⇒ Object
19
20
21
22
23
24
25
26
27
28
|
# File 'lib/magloft/typeloft_theme.rb', line 19
def upload_javascript(file_path)
return false if javascript_policy.nil?
conn = Faraday.new(url: javascript_policy["url"]) do |f|
f.ssl.verify = false
f. = javascript_policy["headers"]
f.adapter :net_http
end
response = conn.put(nil, File.read(file_path))
return (response.status == 200)
end
|
#upload_stylesheet(file_path) ⇒ Object
30
31
32
33
34
35
36
37
38
39
|
# File 'lib/magloft/typeloft_theme.rb', line 30
def upload_stylesheet(file_path)
return false if stylesheet_policy.nil?
conn = Faraday.new(url: stylesheet_policy["url"]) do |f|
f.ssl.verify = false
f. = stylesheet_policy["headers"]
f.adapter :net_http
end
response = conn.put(nil, File.read(file_path))
return (response.status == 200)
end
|