summaryrefslogtreecommitdiff
path: root/dashboards/layout.erb
blob: 5c8dfb8b7e449af1ac32a9d63ec78d1a89a4eb22 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8"/>
  <meta name="description" content="">
  <meta name="viewport" content="width=device-width">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">

  <title><%= yield_content(:title) %></title>

  <!-- The javascript and css are managed by sprockets. The files can be found in the /assets folder-->
  <script type="text/javascript" src="/assets/application.js"></script>
  <link rel="stylesheet" href="/assets/application.css">

  <link href='//fonts.googleapis.com/css?family=Open+Sans:300,400,600,700' rel='stylesheet' type='text/css'>
  <link rel="icon" href="/assets/favicon.ico">


</head>
  <body>
  <script>
    // Redirect handler
    (function() {
      var delayInSeconds = 5;
      var pageLoaded = Date.now();
      var source = new EventSource('events')
      source.addEventListener('message', function(e) {
        var data = JSON.parse(e.data);
        if (data.id === 'redirect' && typeof data.location != 'undefined') {
          if (data.updatedAt - pageLoaded/1000 > delayInSeconds) {
            window.location = data.location;
          } else {
            console.log('Refresh was too fast (or initial page load).');
          }
        }
      });
    })();
  </script>
    <div id="container">
      <%= yield %>
    </div>
  
    <% if development? %>
      <div id="saving-instructions">
        <p>Paste the following at the top of <i><%= params[:dashboard] %>.erb</i></p>
        <textarea id="gridster-code"></textarea>
      </div>
      <a href="#saving-instructions" id="save-gridster">Save this layout</a>
    <% end %>
  </body>
</html>