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 <<-HTML <ul class="messages"> <li class="error-msg"> We're unable to connect with the Jirafe service for the moment. Please wait a few minutes and refresh this page later. </li> </ul> HTML end |
.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 <<-HTML <script type='text/javascript' defer='defer'> jirafe.jQuery('##{target_id}').jirafe({ api_url: '#{Jirafe.config.url}', api_token: '#{api_token}', app_id: '#{app_id}', version: '#{version}', locale: '#{locale}' }); setTimeout(function() { if ($('mod-jirafe') == undefined) { $('#{error_id}').insert ("#{error_html}"); } }, #{timeout}); </script> HTML end |
.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 |