diff --git a/app/helpers/asciicasts_helper.rb b/app/helpers/asciicasts_helper.rb index b8bc1de..0e2dad8 100644 --- a/app/helpers/asciicasts_helper.rb +++ b/app/helpers/asciicasts_helper.rb @@ -1,7 +1,7 @@ module AsciicastsHelper def player_script(asciicast, options = {}) - speed = (params[:speed] || 1).to_f + speed = (options[:speed] || 1).to_f benchmark = !!params[:bm] auto_play = options.key?(:auto_play) ? !!options[:auto_play] : false diff --git a/app/views/asciicasts/_player.html.erb b/app/views/asciicasts/_player.html.erb index 63e7a09..3230b84 100644 --- a/app/views/asciicasts/_player.html.erb +++ b/app/views/asciicasts/_player.html.erb @@ -1,2 +1,2 @@
-<%= player_script(asciicast, :auto_play => local_assigns[:auto_play]) %> +<%= player_script(asciicast, :speed => local_assigns[:speed]) %> diff --git a/app/views/asciicasts/show.html.erb b/app/views/asciicasts/show.html.erb index 6c3a50e..4e6f918 100644 --- a/app/views/asciicasts/show.html.erb +++ b/app/views/asciicasts/show.html.erb @@ -1,7 +1,9 @@
- <%= render :partial => 'asciicasts/player', - :locals => { :asciicast => @asciicast } %> + <%= render :partial => 'asciicasts/player', :locals => { + :asciicast => @asciicast, + :speed => params[:speed] + } %>
diff --git a/app/views/home/show.html.erb b/app/views/home/show.html.erb index 04d2c26..7765fb7 100644 --- a/app/views/home/show.html.erb +++ b/app/views/home/show.html.erb @@ -18,8 +18,10 @@
<% if @asciicast -%> - <%= render :partial => 'asciicasts/player', - :locals => { :asciicast => @asciicast } %> + <%= render :partial => 'asciicasts/player', :locals => { + :asciicast => @asciicast, + :speed => 2.0 + } %> <% end -%>