Use actual asciicast width and height in example player usage
This commit is contained in:
parent
c86efba24c
commit
442181efe9
@ -106,6 +106,10 @@
|
||||
margin-bottom: 5px
|
||||
padding: 6px
|
||||
|
||||
pre
|
||||
word-wrap: normal
|
||||
overflow: auto
|
||||
|
||||
.special-label
|
||||
font-size: 12px
|
||||
background-color: rgb(255, 239, 198)
|
||||
|
@ -65,6 +65,14 @@ class Asciicast < ActiveRecord::Base
|
||||
collection
|
||||
end
|
||||
|
||||
def width
|
||||
terminal_columns
|
||||
end
|
||||
|
||||
def height
|
||||
terminal_lines
|
||||
end
|
||||
|
||||
def title=(value)
|
||||
value ? super(value.strip[0...255]) : super
|
||||
end
|
||||
|
@ -4,7 +4,7 @@ class AsciicastPagePresenter
|
||||
|
||||
attr_reader :routes, :asciicast, :current_user, :policy, :playback_options
|
||||
|
||||
delegate :download_filename, to: :asciicast, prefix: true
|
||||
delegate :download_filename, :width, :height, to: :asciicast, prefix: true
|
||||
|
||||
def self.build(routes, asciicast, current_user, playback_options)
|
||||
decorated_asciicast = asciicast.decorate
|
||||
|
@ -1,9 +1,7 @@
|
||||
class AsciicastSerializer < ActiveModel::Serializer
|
||||
self.root = false
|
||||
|
||||
attributes :id, :url, :snapshot
|
||||
attribute :terminal_columns, key: :width
|
||||
attribute :terminal_lines, key: :height
|
||||
attributes :id, :url, :snapshot, :width, :height
|
||||
|
||||
def id
|
||||
object.to_param
|
||||
|
@ -45,7 +45,7 @@
|
||||
<body>
|
||||
<div id="player-container"></div>
|
||||
<script>
|
||||
asciinema_player.core.CreatePlayer('player-container', '/<%= page.asciicast_download_filename %>');
|
||||
asciinema_player.core.CreatePlayer('player-container', '/<%= page.asciicast_download_filename %>', { width: <%= page.asciicast_width %>, height: <%= page.asciicast_height %> });
|
||||
</script>
|
||||
</body>
|
||||
</html></code></pre>
|
||||
|
Loading…
Reference in New Issue
Block a user