From 5b6fccda0ba8589160fb5dec959710abdf41c7eb Mon Sep 17 00:00:00 2001 From: Marcin Kulik Date: Tue, 17 Oct 2023 17:18:26 +0200 Subject: [PATCH] Make .txt version and .gif instructions discoverable via Download dropdown --- assets/css/_base.scss | 5 + .../recording/_download_modal.html.eex | 6 +- .../templates/recording/_gif_modal.html.heex | 33 +++++ .../templates/recording/show.html.heex | 114 +++++++++++------- lib/asciinema_web/views/recording_view.ex | 9 +- 5 files changed, 113 insertions(+), 54 deletions(-) create mode 100644 lib/asciinema_web/templates/recording/_gif_modal.html.heex diff --git a/assets/css/_base.scss b/assets/css/_base.scss index 1e597ddee..efd022227 100644 --- a/assets/css/_base.scss +++ b/assets/css/_base.scss @@ -182,6 +182,11 @@ body pre { border-color: #ddd; } +.modal-dialog pre { + background-color: #f7f7f7; + margin-bottom: 1rem; +} + .has-error .form-control { border-color: #dc3545; box-shadow: inset 0 1px 1px rgba(0,0,0,.075); diff --git a/lib/asciinema_web/templates/recording/_download_modal.html.eex b/lib/asciinema_web/templates/recording/_download_modal.html.eex index 05ff5a365..79f885312 100644 --- a/lib/asciinema_web/templates/recording/_download_modal.html.eex +++ b/lib/asciinema_web/templates/recording/_download_modal.html.eex @@ -24,13 +24,13 @@

Replay in terminal

- You can replay this recording in your terminal with asciinema play command: + You can replay the downloaded recording in your terminal using the asciinema play command:

asciinema play <%= download_filename(@asciicast) %>

- If you don't have asciinema cli installed then see installation instructions. + If you don't have asciinema CLI installed then see installation instructions.

Use with stand-alone player on your website

@@ -50,7 +50,7 @@ <script src="asciinema-player.min.js"></script> <script> AsciinemaPlayer.create( - '<%= download_filename(@asciicast) %>', + '/assets/<%= download_filename(@asciicast) %>', document.getElementById('player'), { cols: <%= cols(@asciicast) %>, rows: <%= rows(@asciicast) %> } ); diff --git a/lib/asciinema_web/templates/recording/_gif_modal.html.heex b/lib/asciinema_web/templates/recording/_gif_modal.html.heex new file mode 100644 index 000000000..b104f91a2 --- /dev/null +++ b/lib/asciinema_web/templates/recording/_gif_modal.html.heex @@ -0,0 +1,33 @@ + diff --git a/lib/asciinema_web/templates/recording/show.html.heex b/lib/asciinema_web/templates/recording/show.html.heex index 06683f3e9..6d41cc8ad 100644 --- a/lib/asciinema_web/templates/recording/show.html.heex +++ b/lib/asciinema_web/templates/recording/show.html.heex @@ -37,74 +37,98 @@
-