Class: Jirafe::Dashboard
- Inherits:
-
Object
- Object
- Jirafe::Dashboard
- Defined in:
- lib/jirafe/dashboard.rb
Class Method Summary collapse
- .css_url(platform) ⇒ Object
- .default_error_html ⇒ Object
- .js_tag(api_token, app_id, version, locale, options = {}) ⇒ Object
- .js_url(platform) ⇒ Object
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_html ⇒ Object
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, = {}) target_id = [:target_id] || "jirafe" error_id = [:error_id] || "messages" error_html = [:error_html] || default_error_html error_html = error_html.gsub(/"/, "\\\"").split("\n").join("") timeout = [: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 |