lib/deck/slide_deck.rb in deckrb-0.3.0 vs lib/deck/slide_deck.rb in deckrb-0.3.1
- old
+ new
@@ -53,29 +53,37 @@
meta 'http-equiv'=>"X-UA-Compatible", 'content'=>"IE=edge,chrome=1"
meta :name => "viewport", :content=> "width=1024, user-scalable=no"
meta :name => "description", :content=> @description if @description
meta :name => "author", :content=> @author if @author
- stylesheet public_asset("coderay.css")
-
# <!-- Core and extension CSS files -->
stylesheet public_asset("deck.js/core/deck.core.css")
extensions.each do |extension|
stylesheet public_asset("deck.js/extensions/#{extension}/deck.#{extension}.css")
end
# <!-- Theme CSS files (menu swaps these out) -->
stylesheet public_asset("deck.js/themes/style/swiss.css"), :id=>"style-theme-link"
+
+ stylesheet public_asset("coderay.css")
+ stylesheet public_asset("tables.css")
+ stylesheet public_asset("toc.css")
end
def scripts
script :src => public_asset("deck.js/modernizr.custom.js")
# comment 'Grab CDN jQuery, with a protocol relative URL; fall back to local if offline'
# script :src => '//ajax.aspnetcdn.com/ajax/jQuery/jquery-1.7.min.js'
script :src => public_asset('deck.js/jquery-1.7.min.js')
+ jquery <<-JAVASCRIPT
+ $('.slide_toc .toggle').click(function(){
+ $('.slide_toc ul').toggle();
+ });
+ JAVASCRIPT
+
comment 'Deck Core and extensions'
script :type => "text/javascript", :src => public_asset('deck.js/core/deck.core.js')
extensions.each do |extension|
script :type => "text/javascript", :src => public_asset("deck.js/extensions/#{extension}/deck.#{extension}.js")
@@ -91,10 +99,11 @@
end
def body_content
slides
slide_navigation
+ toc
deck_status
goto_slide
permalink
scripts
end
@@ -133,9 +142,24 @@
a :href => '#', :class => 'deck-prev-link', :title => 'Previous' do
character 8592
end
a :href => '#', :class => 'deck-next-link', :title => 'Next' do
character 8594
+ end
+ end
+
+ def toc
+ div.slide_toc do
+ div.toggle "[toc]"
+ ul do
+ if @slides
+ @slides.each do |slide|
+ li do
+ a slide.title, :href => "##{slide.slide_id}"
+ end
+ end
+ end
+ end
end
end
def deck_status
p :class => 'deck-status' do