Display embed link on the asciicast's page

This commit is contained in:
Marcin Kulik 2013-06-13 11:45:00 +02:00
parent 20cf58e89b
commit feec862f99
7 changed files with 34 additions and 32 deletions

View File

@ -15,4 +15,8 @@
$(function() { $(function() {
$('abbr.timeago').timeago(); $('abbr.timeago').timeago();
$("input[data-behavior=auto-select]").click(function() {
this.select();
});
}); });

View File

@ -96,3 +96,8 @@ div.presentation
.other-asciicasts .other-asciicasts
margin-top: 70px margin-top: 70px
.extras
.embed-script
width: 100%
margin: 5px 0

View File

@ -99,6 +99,10 @@ class AsciicastDecorator < ApplicationDecorator
end end
end end
def embed_script
%(<script type="text/javascript" src="#{h.asciicast_url(model, :format => :js)}" id="asciicast-#{id}" async></script>)
end
private private
def prepare_lines(lines, width, height) def prepare_lines(lines, width, height)

View File

@ -1,7 +0,0 @@
<h1>Share</h1>
<ul class="delimited">
<li>
Twitter
</li>
</ul>

View File

@ -0,0 +1,6 @@
h1 Share
ul.delimited
li
' Embed on your page
input[type="text" class="embed-script" value=@asciicast.embed_script data-behavior="auto-select" readonly]

View File

@ -1,25 +0,0 @@
<section id="presentation" class="feature">
<div class="asciicast-wrapper">
<%= player @asciicast %>
</div>
</section>
<section class="supplimental">
<div class="wrapper">
<div class="main">
<h1><%= @asciicast.title %></h1>
<div class="description">
<%= @asciicast.description %>
</div>
<%= render :partial => 'other_by_user' %>
</div>
<div class="extras">
<%= render :partial => 'author' %>
<%= render :partial => 'actions' %>
<%= render :partial => 'info' %>
</div>
</div>
</section>

View File

@ -0,0 +1,15 @@
section#presentation.feature
.asciicast-wrapper
= player @asciicast
section.supplimental
.wrapper
.main
h1 = @asciicast.title
.description = @asciicast.description
= render :partial => 'other_by_user'
.extras
= render :partial => 'author'
= render :partial => 'actions'
= render :partial => 'info'
= render :partial => 'share'