Skip to content
Browse files

Add twitter button

  • Loading branch information...
1 parent b7fb863 commit a55434c8a2afa7a663fb2cb02b25b4b6ec2a9581 Pradeep TV committed
Showing with 19 additions and 4 deletions.
  1. +8 −2 app/assets/stylesheets/main.css.scss
  2. +11 −2 app/views/quotes/_quote.html.erb
View
10 app/assets/stylesheets/main.css.scss
@@ -41,7 +41,7 @@ body {
.quote {
margin: 0 0 40px 0;
- blockquote {
+ .body {
background: #f8f8f8;
border: 1px solid #ddd;
border-left: 5px solid #e8e8e8;
@@ -58,10 +58,11 @@ body {
}
.meta {
+ float:left;
font-size:1.0em;
padding-top:10px;
padding-left:20px;
- float:left;
+ width: 60%;
}
.posted-date {
@@ -72,6 +73,11 @@ body {
padding-top: 20px;
}
+ .tweet-this {
+ float: right;
+ padding: 23px 0px 0px 15px;
+ }
+
.navigation {
margin-bottom: 25px;
margin-top: 25px;
View
13 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>

0 comments on commit a55434c

Please sign in to comment.
Something went wrong with that request. Please try again.