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
|
margin-bottom: 5px
|
||||||
padding: 6px
|
padding: 6px
|
||||||
|
|
||||||
|
pre
|
||||||
|
word-wrap: normal
|
||||||
|
overflow: auto
|
||||||
|
|
||||||
.special-label
|
.special-label
|
||||||
font-size: 12px
|
font-size: 12px
|
||||||
background-color: rgb(255, 239, 198)
|
background-color: rgb(255, 239, 198)
|
||||||
|
@ -65,6 +65,14 @@ class Asciicast < ActiveRecord::Base
|
|||||||
collection
|
collection
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def width
|
||||||
|
terminal_columns
|
||||||
|
end
|
||||||
|
|
||||||
|
def height
|
||||||
|
terminal_lines
|
||||||
|
end
|
||||||
|
|
||||||
def title=(value)
|
def title=(value)
|
||||||
value ? super(value.strip[0...255]) : super
|
value ? super(value.strip[0...255]) : super
|
||||||
end
|
end
|
||||||
|
@ -4,7 +4,7 @@ class AsciicastPagePresenter
|
|||||||
|
|
||||||
attr_reader :routes, :asciicast, :current_user, :policy, :playback_options
|
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)
|
def self.build(routes, asciicast, current_user, playback_options)
|
||||||
decorated_asciicast = asciicast.decorate
|
decorated_asciicast = asciicast.decorate
|
||||||
|
@ -1,9 +1,7 @@
|
|||||||
class AsciicastSerializer < ActiveModel::Serializer
|
class AsciicastSerializer < ActiveModel::Serializer
|
||||||
self.root = false
|
self.root = false
|
||||||
|
|
||||||
attributes :id, :url, :snapshot
|
attributes :id, :url, :snapshot, :width, :height
|
||||||
attribute :terminal_columns, key: :width
|
|
||||||
attribute :terminal_lines, key: :height
|
|
||||||
|
|
||||||
def id
|
def id
|
||||||
object.to_param
|
object.to_param
|
||||||
|
@ -45,7 +45,7 @@
|
|||||||
<body>
|
<body>
|
||||||
<div id="player-container"></div>
|
<div id="player-container"></div>
|
||||||
<script>
|
<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>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html></code></pre>
|
</html></code></pre>
|
||||||
|
Loading…
Reference in New Issue
Block a user