Skip to content

Commit

Permalink
Add twitter button
Browse files Browse the repository at this point in the history
  • Loading branch information
Pradeep TV committed Nov 24, 2012
1 parent b7fb863 commit a55434c
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
10 changes: 8 additions & 2 deletions app/assets/stylesheets/main.css.scss
Expand Up @@ -41,7 +41,7 @@ body {
.quote {
margin: 0 0 40px 0;

blockquote {
.body {
background: #f8f8f8;
border: 1px solid #ddd;
border-left: 5px solid #e8e8e8;
Expand All @@ -58,10 +58,11 @@ body {
}

.meta {
float:left;
font-size:1.0em;
padding-top:10px;
padding-left:20px;
float:left;
width: 60%;
}

.posted-date {
Expand All @@ -72,6 +73,11 @@ body {
padding-top: 20px;
}

.tweet-this {
float: right;
padding: 23px 0px 0px 15px;
}

.navigation {
margin-bottom: 25px;
margin-top: 25px;
Expand Down
13 changes: 11 additions & 2 deletions app/views/quotes/_quote.html.erb
@@ -1,9 +1,18 @@
<div class="quote">
<blockquote><%= quote.body %></blockquote>
<div class="body"><%= quote.body %></div>
<div class="meta">
<%= quote.author_name%><%= quote.author_description? ? ", " : " " %>
<%= quote.author_description %>
<%= quote.author_description%>
<% if signed_in? %>
<%= link_to "Edit", edit_quote_path(quote) %>
<%= link_to("Delete", quote, method: :delete, data: { confirm: "Are you sure?" } ) %>
<% end %>
</div>
<div class="tweet-this">
<a href="https://twitter.com/share" class="twitter-share-button" data-url="http://hackerquotes.com/quotes/<%=quote.id%>" data-text="<%= truncate(quote.body, :length => 119, :omission => '... (contd)') %>" >Tweet</a>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
</div>
<div class="posted-date">
<%= link_to(quote.created_at.strftime("%b, %d, %Y"), quote_path(quote)) %>
</div>
Expand Down

0 comments on commit a55434c

Please sign in to comment.