deckrb 0.4.2 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (69) hide show
  1. data/README.md +38 -10
  2. data/bin/deck +11 -4
  3. data/lib/deck/rack_app.rb +42 -22
  4. data/lib/deck/slide.rb +5 -4
  5. data/lib/deck/slide_deck.rb +142 -135
  6. data/lib/deck/version.rb +1 -1
  7. data/public/deck.js/GPL-license.txt +0 -0
  8. data/public/deck.js/MIT-license.txt +0 -0
  9. data/public/deck.js/README.md +10 -4
  10. data/public/deck.js/boilerplate.html +96 -0
  11. data/public/deck.js/core/deck.core.css +10 -7
  12. data/public/deck.js/core/deck.core.js +5 -5
  13. data/public/deck.js/core/deck.core.scss +10 -7
  14. data/public/deck.js/extensions/goto/deck.goto.css +0 -0
  15. data/public/deck.js/extensions/goto/deck.goto.html +0 -0
  16. data/public/deck.js/extensions/goto/deck.goto.js +0 -0
  17. data/public/deck.js/extensions/hash/deck.hash.css +0 -0
  18. data/public/deck.js/extensions/hash/deck.hash.html +0 -0
  19. data/public/deck.js/extensions/hash/deck.hash.js +16 -3
  20. data/public/deck.js/extensions/hash/deck.hash.scss +0 -0
  21. data/public/deck.js/extensions/menu/deck.menu.css +0 -0
  22. data/public/deck.js/extensions/menu/deck.menu.js +0 -0
  23. data/public/deck.js/extensions/navigation/deck.navigation.css +0 -0
  24. data/public/deck.js/extensions/navigation/deck.navigation.html +0 -0
  25. data/public/deck.js/extensions/navigation/deck.navigation.js +4 -3
  26. data/public/deck.js/extensions/scale/deck.scale.css +4 -1
  27. data/public/deck.js/extensions/scale/deck.scale.js +0 -0
  28. data/public/deck.js/extensions/scale/deck.scale.scss +5 -1
  29. data/public/deck.js/extensions/status/deck.status.css +0 -0
  30. data/public/deck.js/extensions/status/deck.status.html +0 -0
  31. data/public/deck.js/extensions/status/deck.status.js +0 -0
  32. data/public/deck.js/introduction/index.html +8 -2
  33. data/public/deck.js/jquery-1.7.2.min.js +4 -0
  34. data/public/deck.js/modernizr.custom.js +0 -0
  35. data/public/deck.js/test/fixtures/complex.html +0 -0
  36. data/public/deck.js/test/fixtures/empty.html +0 -0
  37. data/public/deck.js/test/fixtures/iframe_simple.html +0 -0
  38. data/public/deck.js/test/fixtures/iframes.html +0 -0
  39. data/public/deck.js/test/fixtures/nesteds.html +0 -0
  40. data/public/deck.js/test/fixtures/standard.html +0 -0
  41. data/public/deck.js/test/index.html +1 -1
  42. data/public/deck.js/test/spec.core.js +3 -1
  43. data/public/deck.js/test/spec.goto.js +0 -0
  44. data/public/deck.js/test/spec.hash.js +2 -2
  45. data/public/deck.js/test/spec.menu.js +0 -0
  46. data/public/deck.js/test/spec.navigation.js +4 -4
  47. data/public/deck.js/test/spec.scale.js +0 -0
  48. data/public/deck.js/test/spec.status.js +0 -0
  49. data/public/deck.js/themes/style/neon.css +7 -1
  50. data/public/deck.js/themes/style/neon.scss +11 -1
  51. data/public/deck.js/themes/style/swiss.css +7 -1
  52. data/public/deck.js/themes/style/swiss.scss +11 -1
  53. data/public/deck.js/themes/style/web-2.0.css +7 -1
  54. data/public/deck.js/themes/style/web-2.0.scss +11 -1
  55. data/public/deck.js/themes/transition/fade.css +0 -0
  56. data/public/deck.js/themes/transition/fade.scss +0 -0
  57. data/public/deck.js/themes/transition/horizontal-slide.css +0 -0
  58. data/public/deck.js/themes/transition/horizontal-slide.scss +0 -0
  59. data/public/deck.js/themes/transition/vertical-slide.css +0 -0
  60. data/public/deck.js/themes/transition/vertical-slide.scss +0 -0
  61. data/public/toc.css +60 -27
  62. data/spec/rack_app_spec.rb +45 -1
  63. data/spec/slide_deck_spec.rb +77 -43
  64. data/spec/slide_spec.rb +19 -0
  65. metadata +22 -8
  66. data/public/deck.js/core/deck.core.html +0 -39
  67. data/public/deck.js/extensions/theme-picker/deck.theme-picker.css +0 -55
  68. data/public/deck.js/extensions/theme-picker/deck.theme-picker.js +0 -13
  69. data/public/deck.js/jquery-1.7.min.js +0 -4
@@ -7,7 +7,7 @@
7
7
  <script type="text/javascript" src="../modernizr.custom.js"></script>
8
8
  <script type="text/javascript" src="lib/jasmine.js"></script>
9
9
  <script type="text/javascript" src="lib/jasmine-html.js"></script>
10
- <script src="../jquery-1.7.min.js"></script>
10
+ <script src="../jquery-1.7.2.min.js"></script>
11
11
  <script type="text/javascript" src="lib/jasmine-jquery.js"></script>
12
12
 
13
13
  <!-- include source files here... -->
@@ -231,10 +231,12 @@ describe('Deck JS', function() {
231
231
  });
232
232
 
233
233
  it('should not trigger events that originate within editable elements', function() {
234
+ var $outside = $('<input type="text" />').appendTo('body');
234
235
  e = jQuery.Event('keydown');
235
236
  e.which = 87;
236
- $('.alt-slide1 input').trigger(e);
237
+ $outside.trigger(e);
237
238
  expect($.deck('getSlide')).toHaveClass('alt-slide1');
239
+ $outside.remove();
238
240
  });
239
241
  });
240
242
  });
File without changes
@@ -41,13 +41,13 @@ describe('Deck JS Hash Extension', function() {
41
41
  it('should update the href on slide change', function() {
42
42
  var $hashLink = $(defaults.selectors.hashLink);
43
43
  $.deck('go', 3);
44
- expect($hashLink).toHaveAttr('href', '#slide-3');
44
+ expect($hashLink.attr('href')).toMatch('#slide-3');
45
45
  });
46
46
 
47
47
  it('should use existing ids if they exist', function() {
48
48
  var $hashLink = $(defaults.selectors.hashLink);
49
49
  $.deck('go', 1);
50
- expect($hashLink).toHaveAttr('href', '#custom-id');
50
+ expect($hashLink.attr('href')).toMatch('#custom-id');
51
51
  });
52
52
 
53
53
  it('should update the URL on slide change (if supported)', function() {
File without changes
@@ -42,10 +42,10 @@ describe('Deck JS Navigation Buttons', function() {
42
42
  });
43
43
 
44
44
  it('should update the links hrefs with real fragment ids', function() {
45
- expect($(defaults.selectors.previousLink)).toHaveAttr('href', '#');
46
- expect($(defaults.selectors.nextLink)).toHaveAttr('href', '#custom-id');
45
+ expect($(defaults.selectors.previousLink).attr('href')).toMatch(/#$/);
46
+ expect($(defaults.selectors.nextLink).attr('href')).toMatch('#custom-id');
47
47
  $.deck('go', 2);
48
- expect($(defaults.selectors.previousLink)).toHaveAttr('href', '#custom-id');
49
- expect($(defaults.selectors.nextLink)).toHaveAttr('href', '#slide-3');
48
+ expect($(defaults.selectors.previousLink).attr('href')).toMatch('#custom-id');
49
+ expect($(defaults.selectors.nextLink).attr('href')).toMatch('#slide-3');
50
50
  });
51
51
  });
File without changes
File without changes
@@ -1,6 +1,6 @@
1
1
  .deck-container {
2
2
  font-family: "Gill Sans", "Gill Sans MT", Calibri, sans-serif;
3
- font-size: 1.25em;
3
+ font-size: 1.75em;
4
4
  color: #aaa;
5
5
  background: #000;
6
6
  }
@@ -84,6 +84,12 @@
84
84
  .deck-container > .slide .deck-before, .deck-container > .slide .deck-previous {
85
85
  opacity: 0.4;
86
86
  }
87
+ .deck-container > .slide .deck-before:not(.deck-child-current) .deck-before, .deck-container > .slide .deck-before:not(.deck-child-current) .deck-previous, .deck-container > .slide .deck-previous:not(.deck-child-current) .deck-before, .deck-container > .slide .deck-previous:not(.deck-child-current) .deck-previous {
88
+ opacity: 1;
89
+ }
90
+ .deck-container > .slide .deck-child-current {
91
+ opacity: 1;
92
+ }
87
93
  .deck-container .deck-status {
88
94
  font-size: 0.6666em;
89
95
  }
@@ -1,6 +1,6 @@
1
1
  .deck-container {
2
2
  font-family: "Gill Sans", "Gill Sans MT", Calibri, sans-serif;
3
- font-size:1.25em;
3
+ font-size:1.75em;
4
4
  color:#aaa;
5
5
  background:#000;
6
6
 
@@ -99,6 +99,16 @@
99
99
  > .slide {
100
100
  .deck-before, .deck-previous {
101
101
  opacity:0.4;
102
+
103
+ &:not(.deck-child-current) {
104
+ .deck-before, .deck-previous {
105
+ opacity:1;
106
+ }
107
+ }
108
+ }
109
+
110
+ .deck-child-current {
111
+ opacity:1;
102
112
  }
103
113
  }
104
114
 
@@ -1,6 +1,6 @@
1
1
  .deck-container {
2
2
  font-family: "Helvetica Neue", sans-serif;
3
- font-size: 1.25em;
3
+ font-size: 1.75em;
4
4
  background: #fff;
5
5
  }
6
6
  .deck-container .slide {
@@ -56,6 +56,12 @@
56
56
  .deck-container > .slide .deck-before, .deck-container > .slide .deck-previous {
57
57
  opacity: 0.4;
58
58
  }
59
+ .deck-container > .slide .deck-before:not(.deck-child-current) .deck-before, .deck-container > .slide .deck-before:not(.deck-child-current) .deck-previous, .deck-container > .slide .deck-previous:not(.deck-child-current) .deck-before, .deck-container > .slide .deck-previous:not(.deck-child-current) .deck-previous {
60
+ opacity: 1;
61
+ }
62
+ .deck-container > .slide .deck-child-current {
63
+ opacity: 1;
64
+ }
59
65
  .deck-container .deck-prev-link, .deck-container .deck-next-link {
60
66
  background: #ccc;
61
67
  font-family: serif;
@@ -1,6 +1,6 @@
1
1
  .deck-container {
2
2
  font-family: "Helvetica Neue", sans-serif;
3
- font-size:1.25em;
3
+ font-size:1.75em;
4
4
  background:#fff;
5
5
 
6
6
  .slide {
@@ -64,6 +64,16 @@
64
64
  > .slide {
65
65
  .deck-before, .deck-previous {
66
66
  opacity:0.4;
67
+
68
+ &:not(.deck-child-current) {
69
+ .deck-before, .deck-previous {
70
+ opacity:1;
71
+ }
72
+ }
73
+ }
74
+
75
+ .deck-child-current {
76
+ opacity:1;
67
77
  }
68
78
  }
69
79
 
@@ -1,7 +1,7 @@
1
1
  @charset "UTF-8";
2
2
  .deck-container {
3
3
  font-family: "Gill Sans", "Gill Sans MT", Calibri, sans-serif;
4
- font-size: 1.25em;
4
+ font-size: 1.75em;
5
5
  background: #f4fafe;
6
6
  /* Old browsers */
7
7
  background: -moz-linear-gradient(top, #f4fafe 0%, #ccf0f0 100%);
@@ -24,6 +24,12 @@
24
24
  .deck-container > .slide .deck-before, .deck-container > .slide .deck-previous {
25
25
  opacity: 0.4;
26
26
  }
27
+ .deck-container > .slide .deck-before:not(.deck-child-current) .deck-before, .deck-container > .slide .deck-before:not(.deck-child-current) .deck-previous, .deck-container > .slide .deck-previous:not(.deck-child-current) .deck-before, .deck-container > .slide .deck-previous:not(.deck-child-current) .deck-previous {
28
+ opacity: 1;
29
+ }
30
+ .deck-container > .slide .deck-child-current {
31
+ opacity: 1;
32
+ }
27
33
  .deck-container .slide h1, .deck-container .slide h2, .deck-container .slide h3, .deck-container .slide h4, .deck-container .slide h5, .deck-container .slide h6 {
28
34
  font-family: "Hoefler Text", Constantia, Palatino, "Palatino Linotype", "Book Antiqua", Georgia, serif;
29
35
  }
@@ -21,7 +21,7 @@
21
21
 
22
22
  .deck-container {
23
23
  font-family: "Gill Sans", "Gill Sans MT", Calibri, sans-serif;
24
- font-size:1.25em;
24
+ font-size:1.75em;
25
25
  background: rgb(244,250,254); /* Old browsers */
26
26
  background: -moz-linear-gradient(top, rgba(244,250,254,1) 0%, rgba(204,240,240,1) 100%); /* FF3.6+ */
27
27
  background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(244,250,254,1)), color-stop(100%,rgba(204,240,240,1))); /* Chrome,Safari4+ */
@@ -36,6 +36,16 @@
36
36
 
37
37
  .deck-before, .deck-previous {
38
38
  opacity:0.4;
39
+
40
+ &:not(.deck-child-current) {
41
+ .deck-before, .deck-previous {
42
+ opacity:1;
43
+ }
44
+ }
45
+ }
46
+
47
+ .deck-child-current {
48
+ opacity:1;
39
49
  }
40
50
  }
41
51
 
File without changes
File without changes
File without changes
File without changes
data/public/toc.css CHANGED
@@ -1,37 +1,70 @@
1
1
  .deck-container .slide_toc {
2
- position:fixed;
3
- bottom:4px;
4
- left:4px;
5
- height: 80%;
6
- color:#888;
7
- z-index:3;
8
- margin:0;
9
- }
2
+ position: fixed;
3
+ bottom: 4px;
4
+ left: 4px;
5
+ height: 80%;
6
+ color: #888;
7
+ z-index: 3;
8
+ margin: 0;
9
+ }
10
10
 
11
11
  .deck-container .slide_toc .toggle {
12
- position: absolute;
13
- bottom: 0px;
14
- cursor: pointer;
12
+ position: absolute;
13
+ bottom: 0px;
14
+ cursor: pointer;
15
+ font-size: 80%;
16
+ }
17
+
18
+ .deck-container .slide_toc .table {
19
+ font-size: 60%;
20
+ display: none;
21
+ position: absolute;
22
+ width: 20em;
23
+ bottom: 1em;
24
+
25
+ border: 1px solid black;
26
+ padding: 4px;
27
+ margin: 4px 0 2em;
28
+ background: white;
29
+ overflow-y: auto;
30
+ color: black;
31
+
32
+ height: 100%;
15
33
  }
16
34
 
17
- .deck-container .slide_toc ul {
18
- display: none;
19
- position: absolute;
20
- width: 20em;
21
- bottom: 1em;
35
+ .deck-container .slide_toc .table > h2 {
36
+ font-weight: bold;
37
+ }
22
38
 
23
- border: 1px solid black;
24
- padding: 4px;
25
- margin: 4px 0 2em;
26
- background: white;
27
- overflow-y: auto;
28
- color: black;
39
+ .deck-container .slide_toc .table ul {
40
+ padding: 4px 4px 4px 8px;
41
+ margin: 4px 0 2em;
42
+ overflow-y: auto;
43
+ }
44
+ .deck-container .slide_toc .table ul > li {
45
+ margin-bottom: .25em;
46
+ }
29
47
 
30
- height: 100%;
31
- }
48
+ .deck-container .slide_toc .table {
49
+ margin: 4px 0 2em;
50
+ }
51
+
52
+ .deck-container a {
53
+ display: block; /* fill the entire containing li */
54
+ padding: .25em;
55
+ }
56
+
57
+ .deck-container a, .deck-container a:visited {
58
+ color: black;
59
+ text-decoration: none;
60
+ }
61
+
62
+ .deck-container a:hover {
63
+ background: #efe0ef;
64
+ }
32
65
 
33
66
  @media print {
34
- .slide_toc {
35
- display:none;
36
- }
67
+ .slide_toc {
68
+ display: none;
69
+ }
37
70
  }
@@ -60,6 +60,13 @@ module Deck
60
60
  assert_ok
61
61
  end
62
62
 
63
+ it "passes options" do
64
+ slide_files = []
65
+ options = {:style => "foo"}
66
+ Deck::RackApp.should_receive(:new).with(slide_files, options).and_call_original
67
+ Deck::RackApp.build slide_files, options
68
+ end
69
+
63
70
  end
64
71
 
65
72
  describe "raw app" do
@@ -90,6 +97,14 @@ module Deck
90
97
  assert { last_response.body.include? "contents of foo.css" }
91
98
  end
92
99
 
100
+ it "passes options" do
101
+ slide_files = []
102
+ options = {:style => "foo"}
103
+ app = Deck::RackApp.new slide_files, options
104
+ slide_deck = app.deck
105
+ assert {slide_deck.instance_variable_get(:@style) == "foo"}
106
+ end
107
+
93
108
  describe "serving multiple slide files from multiple subdirs" do
94
109
 
95
110
  before do
@@ -261,8 +276,37 @@ module Deck
261
276
  assert { app.slides == Slide.from_file(foo_file) + Slide.from_file(bar_file) }
262
277
  end
263
278
 
279
+ it "reads options from a showoff.json file" do
280
+ showoff_file = file "showoff.json", <<-JSON
281
+ {
282
+ "style": "fancy",
283
+ "transition": "flippy",
284
+ "sections": [
285
+ ]
286
+ }
287
+ JSON
264
288
 
265
- it "if no slides are specified, it globs all markdown files under ."
289
+ app = RackApp.new [showoff_file]
290
+ options = app.instance_variable_get(:@options)
291
+ assert { options[:style] == "fancy" }
292
+ assert { options[:transition] == "flippy" }
293
+ end
294
+
295
+ specify "options from a showoff.json file don't override command-line options" do
296
+ showoff_file = file "showoff.json", <<-JSON
297
+ {
298
+ "style": "fancy",
299
+ "transition": "flippy",
300
+ "sections": [
301
+ ]
302
+ }
303
+ JSON
304
+
305
+ app = RackApp.new [showoff_file], style: "homey"
306
+ options = app.instance_variable_get(:@options)
307
+ assert { options[:style] == "homey" }
308
+ assert { options[:transition] == "flippy" }
309
+ end
266
310
 
267
311
  end
268
312
 
@@ -4,56 +4,90 @@ require "#{here}/spec_helper"
4
4
  require "deck/slide_deck"
5
5
 
6
6
  module Deck
7
- describe SlideDeck do
7
+ describe SlideDeck do
8
8
 
9
- include Files
9
+ include Files
10
10
 
11
- def doc
12
- @doc ||= begin
13
- @html = deck_widget.to_html
14
- noko_doc @html
11
+ def doc
12
+ @doc ||= begin
13
+ @html = deck_widget.to_html
14
+ noko_doc @html
15
+ end
15
16
  end
16
- end
17
17
 
18
- def deck_widget options = {}
19
- @deck_widget ||= SlideDeck.new options
20
- end
18
+ def deck_widget options = {}
19
+ @deck_widget ||= SlideDeck.new options
20
+ end
21
21
 
22
- it "renders a basic deck.js HTML page" do
23
- assert { doc }
24
- assert { @html.include? '<link href="/deck.js/core/deck.core.css" rel="stylesheet" />' }
25
- end
22
+ it "renders a basic deck.js HTML page" do
23
+ assert { doc }
24
+ assert { @html.include? '<link href="/deck.js/core/deck.core.css" rel="stylesheet" />' }
25
+ end
26
26
 
27
- it "contains a single dummy slide" do
28
- assert { doc.css('section.slide').size == 1 }
29
- end
27
+ it "contains a single dummy slide" do
28
+ assert { doc.css('section.slide').size == 1 }
29
+ end
30
30
 
31
- it "renders a markdown file with one slide" do
32
- file = file("hello.md", "# hello")
33
- deck_widget :slides => Slide.split(File.read file)
34
- slides = doc.css('section.slide')
35
- assert { slides.size == 1 }
36
- slide = slides.first
37
- assert { slide["id"] == "hello" }
38
- assert { noko_html(slide) == "<section class=\"slide\" id=\"hello\">" +
39
- "<h1>hello</h1>\n" +
40
- "</section>"
41
- }
42
- end
31
+ it "renders a markdown file with one slide" do
32
+ file = file("hello.md", "# hello")
33
+ deck_widget :slides => Slide.split(File.read file)
34
+ slides = doc.css('section.slide')
35
+ assert { slides.size == 1 }
36
+ slide = slides.first
37
+ assert { slide["id"] == "hello" }
38
+ assert { noko_html(slide) == "<section class=\"slide\" id=\"hello\">" +
39
+ "<h1>hello</h1>\n" +
40
+ "</section>"
41
+ }
42
+ end
43
43
 
44
- it "includes a table of contents" do
45
- deck_widget :slides => Slide.split("# Foo\n\n# Bar\n")
46
- toc = doc.css('.slide_toc')
47
- assert { toc.size == 1 }
48
- assert { noko_html(toc.first) == "<div class=\"slide_toc\">" +
49
- "<div class=\"toggle\">[toc]</div>" +
50
- "<ul>" +
51
- "<li><a href=\"#foo\">Foo</a></li>" +
52
- "<li><a href=\"#bar\">Bar</a></li>" +
53
- "</ul>" +
54
- "</div>"
55
- }
56
- end
44
+ it "includes a table of contents" do
45
+ deck_widget :slides => Slide.split("# Foo\n\n# Bar\n")
46
+ toc = doc.css('.slide_toc')
47
+ assert { toc.size == 1 }
48
+ assert { noko_html(toc.first) == "<div class=\"slide_toc\">" +
49
+ "<div class=\"toggle\">[contents]</div>" +
50
+ "<div class=\"table\">" +
51
+ "<h2>deck.rb presentation</h2>" +
52
+ "<ul>" +
53
+ "<li><a href=\"#foo\">Foo</a></li>" +
54
+ "<li><a href=\"#bar\">Bar</a></li>" +
55
+ "</ul>" +
56
+ "</div>"
57
+ "</div>"
58
+ }
59
+ end
57
60
 
58
- end
61
+ describe "themes" do
62
+
63
+ def style_theme_node
64
+ doc.css("head link[rel='stylesheet'][id='style-theme-link']").first
65
+ end
66
+
67
+ def transition_theme_node
68
+ doc.css("head link[rel='stylesheet'][id='transition-theme-link']").first
69
+ end
70
+
71
+ it "defaults to 'swiss' style theme" do
72
+ deck_widget :slides => Slide.split("# Foo\n")
73
+ link_node = style_theme_node()
74
+ assert { link_node['href'] == "/deck.js/themes/style/swiss.css" }
75
+ end
76
+
77
+ it "defaults to 'horizontal-slide' transition theme" do
78
+ deck_widget :slides => Slide.split("# Foo\n")
79
+ link_node = transition_theme_node()
80
+ assert { link_node['href'] == "/deck.js/themes/transition/horizontal-slide.css" }
81
+ end
82
+
83
+ it "accepts theme names params" do
84
+ deck_widget :slides => Slide.split("# Foo\n"), :style => "foo", :transition => "bar"
85
+
86
+ assert { style_theme_node['href'] == "/deck.js/themes/style/foo.css" }
87
+ assert { transition_theme_node['href'] == "/deck.js/themes/transition/bar.css" }
88
+ end
89
+
90
+ end
91
+
92
+ end
59
93
  end