From c4e494e22409811cf7e7ea6853dd2918119ccdf8 Mon Sep 17 00:00:00 2001 From: Marcin Kulik Date: Thu, 27 Jul 2017 14:21:54 +0200 Subject: [PATCH] Allow overriding player cols & rows via query params --- app/helpers/asciicasts_helper.rb | 4 ++-- app/models/playback_options.rb | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/app/helpers/asciicasts_helper.rb b/app/helpers/asciicasts_helper.rb index 6beb257..06d0b28 100644 --- a/app/helpers/asciicasts_helper.rb +++ b/app/helpers/asciicasts_helper.rb @@ -11,8 +11,8 @@ module AsciicastsHelper opts = { id: 'player', src: asciicast.url, - cols: asciicast.width, - rows: asciicast.height, + cols: options.cols || asciicast.width, + rows: options.rows || asciicast.height, poster: options.poster || base64_poster(asciicast), speed: options.speed, autoplay: options.autoplay, diff --git a/app/models/playback_options.rb b/app/models/playback_options.rb index 3b5ed9a..8af2b4c 100644 --- a/app/models/playback_options.rb +++ b/app/models/playback_options.rb @@ -23,6 +23,8 @@ class PlaybackOptions attribute :t, Time attribute :v0, Boolean, default: false attribute :poster, String + attribute :cols, Integer + attribute :rows, Integer def autoplay() ap = super