showoff 0.7.0 → 0.9.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (48) hide show
  1. checksums.yaml +7 -0
  2. data/README.rdoc +53 -475
  3. data/Rakefile +17 -18
  4. data/bin/showoff +29 -7
  5. data/lib/commandline_parser.rb +1 -1
  6. data/lib/showoff/version.rb +3 -0
  7. data/lib/showoff.rb +600 -91
  8. data/lib/showoff_utils.rb +110 -4
  9. data/public/css/disconnected-large.png +0 -0
  10. data/public/css/disconnected.png +0 -0
  11. data/public/css/fast.png +0 -0
  12. data/public/css/grippy-close.png +0 -0
  13. data/public/css/grippy.png +0 -0
  14. data/public/css/onepage.css +6 -0
  15. data/public/css/pace.png +0 -0
  16. data/public/css/paceMarker.png +0 -0
  17. data/public/css/presenter.css +333 -43
  18. data/public/css/sh_style.css +15 -0
  19. data/public/css/showoff.css +373 -48
  20. data/public/css/slow.png +0 -0
  21. data/public/css/spinner.gif +0 -0
  22. data/public/css/tipsy.css +26 -0
  23. data/public/favicon.ico +0 -0
  24. data/public/js/jquery.parsequery.min.js +2 -0
  25. data/public/js/jquery.tipsy.js +260 -0
  26. data/public/js/onepage.js +2 -3
  27. data/public/js/presenter.js +384 -33
  28. data/public/js/sh_lang/sh_gherkin.js +112 -0
  29. data/public/js/sh_lang/sh_gherkin.min.js +1 -0
  30. data/public/js/sh_lang/sh_ini.js +87 -0
  31. data/public/js/sh_lang/sh_ini.min.js +87 -0
  32. data/public/js/sh_lang/sh_puppet.js +182 -0
  33. data/public/js/sh_lang/sh_puppet.min.js +182 -0
  34. data/public/js/sh_lang/sh_puppet_output.js +22 -0
  35. data/public/js/sh_lang/sh_puppet_output.min.js +22 -0
  36. data/public/js/sh_lang/sh_shell.min.js +1 -0
  37. data/public/js/showoff.js +423 -51
  38. data/views/404.erb +19 -0
  39. data/views/download.erb +36 -0
  40. data/views/header.erb +35 -25
  41. data/views/header_mini.erb +22 -0
  42. data/views/index.erb +46 -1
  43. data/views/onepage.erb +35 -14
  44. data/views/presenter.erb +63 -21
  45. data/views/stats.erb +73 -0
  46. metadata +170 -131
  47. data/public/css/960.css +0 -653
  48. data/public/css/pdf.css +0 -12
@@ -0,0 +1,36 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
2
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
3
+
4
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
5
+ <head>
6
+ <%= erb :header_mini %>
7
+ </head>
8
+
9
+ <body id="download">
10
+
11
+ <div id="preso">
12
+ <div id="wrapper">
13
+ <h1>File Downloads</h1>
14
+
15
+ <ul id="downloads">
16
+ <% if @downloads %>
17
+ <%# [ enabled, slide name, [array, of, files] ] %>
18
+ <% @downloads.sort.map do |key, value| %>
19
+ <% enabled, title, files = value %>
20
+ <% if enabled %>
21
+ <% files.each do |file| %>
22
+ <% if key == -999 %>
23
+ <li><a href="/file/_files/share/<%= file %>"><%= title %>/<%= file %></a></li>
24
+ <% else %>
25
+ <li><a href="/file/_files/<%= file %>">Slide <%= key %>: <%= title %>/<%= file %></a></li>
26
+ <% end %>
27
+ <% end %>
28
+ <% end %>
29
+ <% end %>
30
+ <% end %>
31
+
32
+ </ul>
33
+ </div>
34
+ </div>
35
+ </body>
36
+ </html>
data/views/header.erb CHANGED
@@ -1,36 +1,46 @@
1
1
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
2
2
  <title><%= @title %></title>
3
3
 
4
- <meta name="viewport" content="width=device-width"/>
5
-
6
- <link rel="stylesheet" href="<%= @asset_path %>css/reset.css" type="text/css"/>
7
- <link rel="stylesheet" href="<%= @asset_path %>css/showoff.css" type="text/css"/>
8
-
9
- <script type="text/javascript" src="<%= @asset_path %>js/jquery-1.4.2.min.js"></script>
10
- <script type="text/javascript" src="<%= @asset_path %>js/jquery.cycle.all.js"></script>
11
- <script type="text/javascript" src="<%= @asset_path %>js/jquery-print.js"></script>
12
- <script type="text/javascript" src="<%= @asset_path %>js/jquery.batchImageLoad.js"></script>
13
-
14
- <script type="text/javascript" src="<%= @asset_path %>js/jquery.doubletap-0.1.js"></script>
15
-
16
- <script type="text/javascript" src="<%= @asset_path %>js/fg.menu.js"></script>
17
- <script type="text/javascript" src="<%= @asset_path %>js/showoff.js"></script>
18
- <script type="text/javascript" src="<%= @asset_path %>js/jTypeWriter.js"> </script>
19
- <script type="text/javascript" src="<%= @asset_path %>js/sh_main.min.js"></script>
20
- <script type="text/javascript" src="<%= @asset_path %>js/core.js"></script>
21
- <script type="text/javascript" src="<%= @asset_path %>js/showoffcore.js"></script>
22
- <script type="text/javascript" src="<%= @asset_path %>js/coffee-script.js"></script>
23
-
24
- <link type="text/css" href="<%= @asset_path %>css/fg.menu.css" media="screen" rel="stylesheet" />
25
- <link type="text/css" href="<%= @asset_path %>css/theme/ui.all.css" media="screen" rel="stylesheet" />
26
- <link type="text/css" href="<%= @asset_path %>css/sh_style.css" rel="stylesheet" >
4
+ <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0"/>
5
+
6
+ <link rel="stylesheet" href="<%= @asset_path %>/css/reset.css" type="text/css"/>
7
+
8
+ <link type="text/css" href="<%= @asset_path %>/css/fg.menu.css" media="screen" rel="stylesheet" />
9
+ <link type="text/css" href="<%= @asset_path %>/css/theme/ui.all.css" media="screen" rel="stylesheet" />
10
+ <link type="text/css" href="<%= @asset_path %>/css/sh_style.css" rel="stylesheet" />
11
+ <link type="text/css" href="<%= @asset_path %>/css/tipsy.css" rel="stylesheet" />
12
+
13
+ <link rel="stylesheet" href="<%= @asset_path %>/css/showoff.css" type="text/css"/>
14
+
15
+ <script type="text/javascript" src="<%= @asset_path %>/js/jquery-1.4.2.min.js"></script>
16
+ <script type="text/javascript" src="<%= @asset_path %>/js/jquery.cycle.all.js"></script>
17
+ <script type="text/javascript" src="<%= @asset_path %>/js/jquery-print.js"></script>
18
+ <script type="text/javascript" src="<%= @asset_path %>/js/jquery.batchImageLoad.js"></script>
19
+ <script type="text/javascript" src="<%= @asset_path %>/js/jquery.parsequery.min.js"></script>
20
+ <script type="text/javascript" src="<%= @asset_path %>/js/jquery.doubletap-0.1.js"></script>
21
+ <script type="text/javascript" src="<%= @asset_path %>/js/jquery.tipsy.js"></script>
22
+
23
+ <script type="text/javascript" src="<%= @asset_path %>/js/fg.menu.js"></script>
24
+ <script type="text/javascript" src="<%= @asset_path %>/js/showoff.js"></script>
25
+ <script type="text/javascript" src="<%= @asset_path %>/js/jTypeWriter.js"> </script>
26
+ <script type="text/javascript" src="<%= @asset_path %>/js/sh_main.min.js"></script>
27
+ <script type="text/javascript" src="<%= @asset_path %>/js/core.js"></script>
28
+ <script type="text/javascript" src="<%= @asset_path %>/js/showoffcore.js"></script>
29
+ <script type="text/javascript" src="<%= @asset_path %>/js/coffee-script.js"></script>
30
+
31
+ <% if @languages %>
32
+ <% @languages.each do |l| %>
33
+ <script type="text/javascript" src="<%= @asset_path %>/js/<%= l %>"></script>
34
+ <% end %>
35
+ <% end %>
27
36
 
28
37
  <% css_files.each do |css_file| %>
29
- <link rel="stylesheet" href="file/<%= css_file %>" type="text/css"/>
38
+ <% alternate = ShowOffUtils.default_style?(css_file) ? '' : 'alternate ' %>
39
+ <link rel="stylesheet" href="<%= @asset_path %>/file/<%= css_file %>" type="text/css"/>
30
40
  <% end %>
31
41
 
32
42
  <% js_files.each do |js_file| %>
33
- <script type="text/javascript" src="file/<%= js_file %>"></script>
43
+ <script type="text/javascript" src="<%= @asset_path %>/file/<%= js_file %>"></script>
34
44
  <% end %>
35
45
 
36
46
  <script type="text/javascript">
@@ -0,0 +1,22 @@
1
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
2
+ <title><%= @title %></title>
3
+
4
+ <meta name="viewport" content="width=device-width"/>
5
+
6
+ <link rel="stylesheet" href="<%= @asset_path %>/css/reset.css" type="text/css"/>
7
+ <link rel="stylesheet" href="<%= @asset_path %>/css/showoff.css" type="text/css"/>
8
+
9
+ <link type="text/css" href="<%= @asset_path %>/css/fg.menu.css" media="screen" rel="stylesheet" />
10
+ <link type="text/css" href="<%= @asset_path %>/css/theme/ui.all.css" media="screen" rel="stylesheet" />
11
+
12
+ <script type="text/javascript" src="<%= @asset_path %>/js/jquery-1.4.2.min.js"></script>
13
+ <script type="text/javascript" src="<%= @asset_path %>/js/showoff.js"></script>
14
+
15
+ <% css_files.each do |css_file| %>
16
+ <% alternate = ShowOffUtils.default_style?(css_file) ? '' : 'alternate ' %>
17
+ <link rel="stylesheet" href="<%= @asset_path %>/file/<%= css_file %>" type="text/css"/>
18
+ <% end %>
19
+
20
+ <% js_files.each do |js_file| %>
21
+ <script type="text/javascript" src="<%= @asset_path %>/file/<%= js_file %>"></script>
22
+ <% end %>
data/views/index.erb CHANGED
@@ -10,6 +10,42 @@
10
10
 
11
11
  <a tabindex="0" href="#search-engines" class="fg-button fg-button-icon-right ui-widget ui-state-default ui-corner-all" id="navmenu"><span class="ui-icon ui-icon-triangle-1-s"></span>slides</a>
12
12
  <div id="navigation" class="hidden"></div>
13
+ <a tabindex="1" href="#search-engines" class="fg-button fg-button-icon-right ui-widget ui-state-default ui-corner-all" id="stylemenu"><span class="ui-icon ui-icon-triangle-1-s"></span>styles</a>
14
+ <div id="stylepicker" class="hidden"></div>
15
+
16
+ <% if @feedback then %>
17
+ <div id="feedbackWrapper">
18
+ <div id="feedbackSidebar">
19
+ <img id="feedbackActivity" src="css/spinner.gif" />
20
+ <h3>Live Interaction</h3>
21
+ <div class="row">
22
+ <h4>The presenter should...</h4>
23
+ <span class="buttonWrapper slower"><button id="paceSlower">Slow Down</button></span>
24
+ <span class="buttonWrapper faster"><button id="paceFaster">Speed Up</button></span>
25
+ </div>
26
+ <div class="row">
27
+ <textarea id="question"></textarea>
28
+ <button id="askQuestion">Ask a Question</button>
29
+ </div>
30
+ <hr />
31
+ <h3>Material Feedback</h3>
32
+ <div class="row">
33
+ <h4>This slide is...</h4>
34
+ Terrible
35
+ <input type="radio" name="rating" value="1"></input>
36
+ <input type="radio" name="rating" value="2"></input>
37
+ <input type="radio" name="rating" value="3"></input>
38
+ <input type="radio" name="rating" value="4"></input>
39
+ <input type="radio" name="rating" value="5"></input>
40
+ Awesome
41
+ <textarea id="feedback"></textarea>
42
+ <button id="sendFeedback">Send Feedback</button>
43
+ </div>
44
+ <div id="disclaimer">All features are anonymous</div>
45
+ </div>
46
+ <div id="feedbackHandle"></div>
47
+ </div>
48
+ <% end %>
13
49
 
14
50
  <div id="help">
15
51
  <table>
@@ -20,9 +56,12 @@
20
56
  <tr><td class="key">## &lt;ret&gt;</td><td>go to slide #</td></tr>
21
57
  <tr><td class="key">c, t</td><td>table of contents (vi)</td></tr>
22
58
  <tr><td class="key">f</td><td>toggle footer</td></tr>
59
+ <tr><td class="key">g</td><td>toggle follow</td></tr>
23
60
  <tr><td class="key">r</td><td>reload slides</td></tr>
24
61
  <tr><td class="key">n</td><td>toggle notes</td></tr>
25
62
  <tr><td class="key">p</td><td>run preshow</td></tr>
63
+ <tr><td class="key">P</td><td>toggle pause</td></tr>
64
+ <tr><td class="key">s</td><td>choose style</td></tr>
26
65
  </table>
27
66
  </div>
28
67
 
@@ -31,16 +70,22 @@
31
70
  <input type="submit" onClick="nextStep();" value="next"/>
32
71
  </div>
33
72
 
34
- <div id="preso">loading presentation...</div>
73
+ <div id="preso"><center>loading presentation...</center></div>
35
74
  <div id="footer">
75
+ <span id="followMode"></span>
36
76
  <span id="slideInfo"></span>
37
77
  <span id="debugInfo"></span>
38
78
  <span id="notesInfo"></span>
79
+ <span id="slideFilename"></span>
80
+ <img id="disconnected" src="/css/disconnected.png" />
39
81
  </div>
40
82
 
41
83
  <div id="slides" class="offscreen" <%= 'style="display:none;"' if @slides %>>
42
84
  <%= @slides %>
43
85
  </div>
86
+ <div id="pauseScreen">
87
+ <%= @pause_msg %>
88
+ </div>
44
89
 
45
90
  </body>
46
91
  </html>
data/views/onepage.erb CHANGED
@@ -1,34 +1,55 @@
1
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
2
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
1
+ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
3
2
 
4
3
  <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
5
4
  <head>
6
5
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
7
- <title>Presentation</title>
6
+ <title><%= @title %></title>
8
7
 
9
- <% if @no_js %>
10
- <%= inline_css(['pdf.css'], 'public/css') %>
11
- <% else %>
12
- <%= inline_css(['onepage.css'], 'public/css') %>
13
- <% end %>
14
- <%= inline_css(['reset.css', 'showoff.css', 'theme/ui.all.css', 'sh_style.css'], 'public/css') %>
15
- <%= inline_css(css_files) %>
8
+ <% if @inline %>
9
+
10
+ <%= inline_css(['reset.css', 'showoff.css', 'theme/ui.all.css', 'sh_style.css', 'onepage.css'], 'public/css') %>
11
+ <%= inline_css(css_files) %>
16
12
 
17
- <% if !@no_js %>
18
13
  <%= inline_js(['jquery-1.4.2.min.js', 'jquery-print.js', 'showoff.js', 'onepage.js', 'sh_main.min.js', 'core.js', 'showoffcore.js'], 'public/js') %>
14
+ <%= inline_js(@languages, 'public/js') if @languages %>
15
+ <%= inline_js(js_files) %>
19
16
  <script type="text/javascript">
20
17
  $(document).ready(function() {
21
18
  setupOnePage()
22
19
  });
23
20
  </script>
21
+
22
+ <% else %>
23
+ <% ['reset.css', 'showoff.css', 'theme/ui.all.css', 'sh_style.css', 'onepage.css'].each do |css_file| %>
24
+ <link rel="stylesheet" href="<%= @asset_path %>/css/<%= css_file %>" type="text/css"/>
25
+ <% end %>
26
+ <% css_files.each do |css_file| %>
27
+ <link rel="stylesheet" href="<%= @asset_path %>/file/<%= css_file %>" type="text/css"/>
28
+ <% end %>
29
+
30
+ <% ['jquery-1.4.2.min.js', 'jquery-print.js', 'showoff.js', 'onepage.js', 'sh_main.min.js', 'core.js', 'showoffcore.js'].each do |js_file| %>
31
+ <script type="text/javascript" src="<%= @asset_path %>/js/<%= js_file %>"></script>
32
+ <% end %>
33
+ <% js_files.each do |js_file| %>
34
+ <script type="text/javascript" src="<%= @asset_path %>/file/<%= js_file %>"></script>
35
+ <% end %>
36
+ <% if @languages %>
37
+ <% @languages.each do |l| %>
38
+ <script type="text/javascript" src="<%= @asset_path %>/js<%= l %>"></script>
39
+ <% end %>
40
+ <% end %>
41
+ <script type="text/javascript">
42
+ $(document).ready(function() {
43
+ setupOnePage()
44
+ });
45
+ </script>
46
+
24
47
  <% end %>
25
48
  </head>
26
49
 
27
50
  <body>
28
-
29
- <div id="slides">
51
+ <div id="slides"<% if @wrapper_classes then %>class="<%= @wrapper_classes.join(' ') %>"<% end %> >
30
52
  <%= @slides %>
31
53
  </div>
32
-
33
54
  </body>
34
55
  </html>
data/views/presenter.erb CHANGED
@@ -4,14 +4,13 @@
4
4
  <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
5
5
  <head>
6
6
  <%= erb :header %>
7
- <link rel="stylesheet" href="<%= @asset_path %>css/960.css" type="text/css"/>
8
- <link rel="stylesheet" href="<%= @asset_path %>css/presenter.css" type="text/css"/>
9
- <script type="text/javascript" src="<%= @asset_path %>js/presenter.js"></script>
7
+ <link rel="stylesheet" href="<%= @asset_path %>/css/presenter.css" type="text/css"/>
8
+ <script type="text/javascript" src="<%= @asset_path %>/js/presenter.js"></script>
10
9
  </head>
11
10
 
12
11
  <body>
13
12
 
14
- <a tabindex="0" href="#search-engines" class="fg-button fg-button-icon-right ui-widget ui-state-default ui-corner-all" id="navmenu"><span class="ui-icon ui-icon-triangle-1-s"></span>slides</a>
13
+ <span id="issueUrl"><%= @issues %></span>
15
14
 
16
15
  <div id="help">
17
16
  <table>
@@ -23,35 +22,78 @@
23
22
  <tr><td class="key">c, t</td><td>table of contents (vi)</td></tr>
24
23
  <tr><td class="key">r</td><td>reload slides</td></tr>
25
24
  <tr><td class="key">p</td><td>run preshow</td></tr>
25
+ <tr><td class="key">s</td><td>choose style</td></tr>
26
26
  </table>
27
27
  </div>
28
28
 
29
29
  <div id="main" class="container_12">
30
30
  <div id="topbar" class="grid_12">
31
- <div id="links">
32
- <a href="/pdf">Generate PDF</a>
33
- &nbsp; &nbsp;
34
- <a href="/onepage">Single Page</a>
31
+ <div id="slideSource">
32
+ Source: <span id="slideFile"></span>
35
33
  </div>
34
+ <span id="links">
35
+ <span class="desktop">
36
+ <% if @issues %>
37
+ <a id="report" href="javascript:reportIssue();" title="Report an issue with the current slide.">Report Issue With Slide</a>
38
+ <% end %>
39
+ <a id="stats" href="/stats" target="_showoffchild">Viewing Statistics</a>
40
+ <a id="downloads" href="/download" target="_showoffchild">Downloads</a>
41
+ <a id="slaveWindow" href="javascript:openSlave();" title="Open a slave window if your popup blocker prevented it.">Open Slave Window</a>
42
+ <a id="generatePDF" href="/pdf" title="Call out to wkhtmltopdf to generate a PDF.">Generate PDF</a>
43
+ <a id="onePage" href="/onepage" title="Load the single page view. Useful for printing.">Single Page</a>
44
+ </span>
45
+ <span class="mobile">
46
+ <a id="update" href="">Update</a>
47
+ </span>
48
+ </span>
36
49
  </div>
37
- <div class="clear"></div>
38
- <div id="sidebar" class="grid_4">
39
- <div id="progress">
40
- Slide: <span id="slideInfo"></span>
50
+
51
+ <div id="center">
52
+ <div id="sidebar" class="grid_4">
53
+ <div id="timerSection">
54
+ Timer:
55
+ <span id="minStart">
56
+ <input type="text" size="8" id="timerMinutes"/> min
57
+ <input type="button" id="startTimer" value="Start">
58
+ </span>
59
+ <span id="timerInfo"></span>
60
+ <span id="minStop"><input type="button" id="stopTimer" value="Stop"></span>
61
+ </div>
62
+ <div id="feedbackPace">
63
+ <span id="paceSlow">Speed Up!</span>
64
+ <span id="paceFast">Slow Down!</span>
65
+ <img id="paceMarker" src="css/paceMarker.png" />
66
+ </div>
67
+ <div id="slidemenu">
68
+ <div id="navigation" class="menu"></div>
69
+ </div>
41
70
  </div>
42
- <div id="slideSource">
43
- Source: <span id="slideFile"></span>
71
+ <div id="preview" class="grid_8">
72
+ <img id="disconnected" src="/css/disconnected-large.png" />
73
+ <div id="preso" class="zoomed">loading presentation...</div>
44
74
  </div>
45
- <div id="debugInfo"></div>
46
- <div id="slidemenu">
47
- <div id="navigation" class="menu"></div>
75
+ <div id="statusbar">
76
+ <span id="progress">
77
+ Slide: <span id="slideInfo"></span>
78
+ </span>
79
+ <div id="debugInfo"></div>
80
+ <input id="zoomer" type="range" min="0.5" max="1.5" step="0.01" onchange="javascript:zoom();" title="Alter the zoom level of the slide preview." />
81
+ <span id="enableRemote" title="Enables tracking of other presenters.">
82
+ <label for="remoteToggle">Enable Remote</label><input type="checkbox" id="remoteToggle" checked />
83
+ </span>
84
+ <span id="enableFollower" title="Send slide change notifications.">
85
+ <label for="followerToggle">Update Follower</label><input type="checkbox" id="followerToggle" checked />
86
+ </span>
48
87
  </div>
49
88
  </div>
50
- <div id="preview" class="grid_8">
51
- <div id="preso" class="zoomed">loading presentation...</div>
52
- </div>
53
- <div class="clear"></div>
89
+
90
+ <div id="separator"></div>
91
+
54
92
  <div id="bottom" class="grid_12">
93
+ <div id="questions">
94
+ <h3>Audience Questions</h3>
95
+ <ul></ul>
96
+ </div>
55
97
  <div id="notes"></div>
56
98
  </div>
57
99
  </div>
data/views/stats.erb ADDED
@@ -0,0 +1,73 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
2
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
3
+
4
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
5
+ <head>
6
+ <%= erb :header_mini %>
7
+
8
+ <script type="text/javascript">
9
+ $(document).ready(function(){ setupStats(); });
10
+ </script>
11
+ </head>
12
+
13
+ <body id="stats">
14
+ <div id="preso">
15
+ <div id="wrapper">
16
+ <h1>Viewing Statistics</h1>
17
+
18
+ <div id="least">
19
+ <h3>Least viewed slides</h3>
20
+ <% if @least.size > 0 %>
21
+ <% max = @least.sort_by {|slide, time| -time}[0][1].to_f %>
22
+ <% timestr = (max > 3599) ? '%H:%M:%S' : '%M:%S' %>
23
+ <% @least.each do |slide, time| %>
24
+ <div class="row">
25
+ <span class="label">Slide <%= slide %>:</span>
26
+ <div class="bar" style="width: <%= (time/max)*100 %>%;"> </div>
27
+ <div class="time"><%= Time.at(time).gmtime.strftime(timestr) %></div>
28
+ </div>
29
+ <% end %>
30
+ <% end %>
31
+ </div>
32
+
33
+ <div id="most">
34
+ <h3>Most viewed slides</h3>
35
+ <% if @least.size > 0 %>
36
+ <% max = @most[0][1].to_f %>
37
+ <% timestr = (max > 3599) ? '%H:%M:%S' : '%M:%S' %>
38
+ <% @most.each do |slide, time| %>
39
+ <div class="row">
40
+ <span class="label">Slide <%= slide %>:</span>
41
+ <div class="bar" style="width: <%= (time/max)*100 %>%;"> :</div>
42
+ <div class="time"><%= Time.at(time).gmtime.strftime(timestr) %></div>
43
+ </div>
44
+ <% end %>
45
+ <% end %>
46
+ </div>
47
+
48
+ <div id="all">
49
+ <h3>All slides</h3>
50
+ <%# We reuse the max value calculated from the above step. %>
51
+ <% @all.sort.map do |slide, time| %>
52
+ <div class="row">
53
+ <span class="label">Slide <%= slide %>:</span>
54
+ <div class="bar" style="width: <%= (time/max)*100 %>%;"> </div>
55
+ <div class="time"><%= Time.at(time).gmtime.strftime(timestr) %></div>
56
+ <% if @counter %>
57
+ <div class="detail">
58
+ <% @counter[slide].each do |host, count| %>
59
+ <div class="row">
60
+ <span class="label"><%= host %>:</span>
61
+ <div class="bar" style="width: <%= (count/max)*100 %>%;"> </div>
62
+ <div class="time"><%= Time.at(count).gmtime.strftime(timestr) %></div>
63
+ </div>
64
+ <% end %>
65
+ </div>
66
+ <% end %>
67
+ </div>
68
+ <% end %>
69
+ </div>
70
+ </div>
71
+ </div>
72
+ </body>
73
+ </html>