Class: Jirafe::Dashboard

Inherits:
Object
  • Object
show all
Defined in:
lib/jirafe/dashboard.rb

Class Method Summary collapse

Class Method Details

.css_url(platform) ⇒ Object



9
10
11
# File 'lib/jirafe/dashboard.rb', line 9

def css_url(platform)
  Jirafe::Asset.css_url_for(:dashboard, platform)
end

.default_error_htmlObject



37
38
39
40
41
42
43
44
45
46
# File 'lib/jirafe/dashboard.rb', line 37

def default_error_html
  "  <ul class=\"messages\">\n    <li class=\"error-msg\">\n      We're unable to connect with the Jirafe service for the moment.\n      Please wait a few minutes and refresh this page later.\n    </li>\n  </ul>\n  HTML\nend\n"

.js_tag(api_token, app_id, version, locale, options = {}) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/jirafe/dashboard.rb', line 13

def js_tag(api_token, app_id, version, locale, options = {})
  target_id = options[:target_id] || "jirafe"
  error_id = options[:error_id] || "messages"
  error_html = options[:error_html] || default_error_html
  error_html = error_html.gsub(/"/, "\\\"").split("\n").join("")
  timeout = options[:timeout] || 10000

  "<script type='text/javascript' defer='defer'>\n  jirafe.jQuery('#\#{target_id}').jirafe({\n    api_url: '\#{Jirafe.config.url}',\n    api_token: '\#{api_token}',\n    app_id: '\#{app_id}',\n    version: '\#{version}',\n    locale: '\#{locale}' });\n  setTimeout(function() {\n    if ($('mod-jirafe') == undefined) {\n$('\#{error_id}').insert (\"\#{error_html}\");\n    }\n  }, \#{timeout});\n</script>\n  HTML\nend\n"

.js_url(platform) ⇒ Object



5
6
7
# File 'lib/jirafe/dashboard.rb', line 5

def js_url(platform)
  Jirafe::Asset.js_url_for(:dashboard, platform)
end