Skip to content

Commit

Permalink
Add share buttons
Browse files Browse the repository at this point in the history
  • Loading branch information
pauldowman committed Aug 4, 2011
1 parent e7dec20 commit a498a16
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 1 deletion.
3 changes: 3 additions & 0 deletions app/stylesheets/partials/_page.scss
Expand Up @@ -224,6 +224,9 @@ ul, ol {
margin-bottom: 12px;
font-style: italic;
}
#share p {
margin-top: 6px;
}
}
}

Expand Down
16 changes: 16 additions & 0 deletions app/views/pages/_share_buttons.html.erb
@@ -0,0 +1,16 @@
<!-- Twitter -->
<script src="http://platform.twitter.com/widgets.js" type="text/javascript"></script>
<%= link_to "Tweet", "http://twitter.com/share?url=#{u(request.url)}&text=#{u(@page.title)}: ", :class => "twitter-share-button" %>

<!-- Google +1 -->
<g:plusone size="medium"></g:plusone>
<script type="text/javascript">
(function() {
var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
po.src = 'https://apis.google.com/js/plusone.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
})();
</script>

<!-- Facebook -->
<iframe src="http://www.facebook.com/plugins/like.php?app_id=147048792045005&amp;href=<%=u(request.url)%>&amp;send=false&amp;layout=button_count&amp;width=90&amp;show_faces=false&amp;action=like&amp;colorscheme=light&amp;font&amp;height=20" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:90px; height:20px;" allowTransparency="true"></iframe>
6 changes: 6 additions & 0 deletions app/views/pages/show.html.haml
Expand Up @@ -23,6 +23,12 @@
Categories:
!= @page.categories.sort.collect { |c| link_to(c, "/category/#{c}")}.join(', ')

#share
%h3
Share
%p
= render :partial => "share_buttons"

- if @page.is_post?
#comments
%h3
Expand Down
2 changes: 1 addition & 1 deletion features/comments.feature
Expand Up @@ -10,7 +10,7 @@ Feature: Comments
| Whiskey | A page with no date | 2010-02-01-whiskey | alcohol, bourbon, scotch, whiskey |
And The GitModel database is indexed
When I go to the path "/2010/02/01/whiskey"
Then I should see "Comments" within "h3"
Then I should see "Comments" within "div#comments"

Scenario: Pages with no date in the id don't show comment section
Given the following pages:
Expand Down

0 comments on commit a498a16

Please sign in to comment.