diff --git a/app/assets/stylesheets/asciicasts.sass b/app/assets/stylesheets/asciicasts.sass index a81cfc5..0ca7097 100644 --- a/app/assets/stylesheets/asciicasts.sass +++ b/app/assets/stylesheets/asciicasts.sass @@ -91,7 +91,7 @@ h2 font-size: 20px - .share-modal + .modal-dialog max-width: 900px width: initial diff --git a/app/presenters/asciicast_page_presenter.rb b/app/presenters/asciicast_page_presenter.rb index 24cf952..8811734 100644 --- a/app/presenters/asciicast_page_presenter.rb +++ b/app/presenters/asciicast_page_presenter.rb @@ -4,6 +4,8 @@ class AsciicastPagePresenter attr_reader :routes, :asciicast, :current_user, :policy, :playback_options + delegate :download_filename, to: :asciicast, prefix: true + def self.build(routes, asciicast, current_user, playback_options) decorated_asciicast = asciicast.decorate policy = Pundit.policy(current_user, asciicast) @@ -115,6 +117,10 @@ class AsciicastPagePresenter asciicast.featured? end + def can_replay_in_terminal? + asciicast.version > 0 + end + private def author diff --git a/app/views/asciicasts/_download.html.erb b/app/views/asciicasts/_download.html.erb new file mode 100644 index 0000000..d67da11 --- /dev/null +++ b/app/views/asciicasts/_download.html.erb @@ -0,0 +1,57 @@ + diff --git a/app/views/asciicasts/_share.html.slim b/app/views/asciicasts/_share.html.slim index 934b2be..faf6837 100644 --- a/app/views/asciicasts/_share.html.slim +++ b/app/views/asciicasts/_share.html.slim @@ -1,5 +1,5 @@ .modal.fade id="share-modal" tabindex="-1" role="dialog" - .modal-dialog.share-modal + .modal-dialog .modal-content .modal-header button type="button" class="close" data-dismiss="modal" diff --git a/app/views/asciicasts/show.html.slim b/app/views/asciicasts/show.html.slim index 0211e60..4f475e5 100644 --- a/app/views/asciicasts/show.html.slim +++ b/app/views/asciicasts/show.html.slim @@ -5,6 +5,7 @@ .asciicast-page = render 'share', page: page + = render 'download', page: page section.cinema .container @@ -26,7 +27,7 @@ section.odd.meta .container .row - .col-md-8.col-xs-8 + .col-md-8.col-xs-6 ul.meta-list li span.glyphicon.glyphicon-info-sign @@ -35,7 +36,7 @@ span.glyphicon.glyphicon-eye-open ' #{page.views_count} - .col-md-4.col-xs-4 + .col-md-4.col-xs-6 - if page.show_admin_dropdown? .dropdown.actions-dropdown.pull-right button.btn.btn-default.dropdown-toggle[type="button" data-toggle="dropdown"] @@ -79,6 +80,10 @@ span.glyphicon.glyphicon-share-alt ' a href="#" id="share-link" data-toggle="modal" data-target="#share-modal" Share + li + span.glyphicon.glyphicon-download + ' + a href="#" id="download-link" data-toggle="modal" data-target="#download-modal" Download - if page.show_description? section.odd.description