Skip to content
Browse files

Merge pull request #63 from dwildt/master

Adding share links to organization page
  • Loading branch information...
2 parents a32884f + f8c4888 commit de9c94f019ea74572b54d673a819dcf4b084dd9d @rmagrin rmagrin committed Dec 4, 2011
Showing with 26 additions and 7 deletions.
  1. +11 −5 app/helpers/organizations_helper.rb
  2. +10 −0 app/views/layouts/main.html.erb
  3. +5 −2 app/views/organizations/show.html.erb
View
16 app/helpers/organizations_helper.rb
@@ -1,14 +1,20 @@
module OrganizationsHelper
require 'uri'
- def compose_twitter_share_url()
- URI.escape('http://twitter.com/share?url=http://letshelp.it/' +
+ def compose_twitter_share_text()
+ 'http://letshelp.it/' +
@organization.name_slug +
- '&text=' +
+ ' ' +
t("twitter_share.please_help") +
- @organization.name +
- '&via=LetsHelpIt')
+ @organization.name
end
+
+ def compose_facebook_like_url()
+ URI.escape('http://letshelp.it/' +
+ @organization.name_slug)
+ end
+
+
end
View
10 app/views/layouts/main.html.erb
@@ -13,6 +13,16 @@
<![endif]-->
</head>
<body id="body_tag" lang="<%= I18n.locale.to_s %>">
+
+ <div id="fb-root"></div>
+ <script>(function(d, s, id) {
+ var js, fjs = d.getElementsByTagName(s)[0];
+ if (d.getElementById(id)) {return;}
+ js = d.createElement(s); js.id = id;
+ js.src = "//connect.facebook.net/en_US/all.js#xfbml=1";
+ fjs.parentNode.insertBefore(js, fjs);
+ }(document, 'script', 'facebook-jssdk'));</script>
+
<header>
<nav>
<div class="wrapper">
View
7 app/views/organizations/show.html.erb
@@ -4,7 +4,6 @@
<%= @organization.name %>
<div><%= @organization.city %> / <%= @organization.country %></div>
</h3>
-
<div class="waysOfContact">
<strong><%=t("org_form.contact")%>:</strong> <%= @organization.contact %>
</div>
@@ -20,7 +19,11 @@
</div>
<div class="tools">
- <%= link_to t('org_form.edit_button'), edit_organization_path(@organization), :class => 'link edit' %> | <%= link_to t('twitter_share.button'), compose_twitter_share_url(), :class => 'link share' %>
+ <a href="https://twitter.com/share" class="twitter-share-button" data-count="horizontal" data-text="<%= compose_twitter_share_text() %>" data-via="letshelpit"></a><script type="text/javascript" src="//platform.twitter.com/widgets.js"></script>
+ <br />
+ <div class="fb-like" data-href="<%= compose_facebook_like_url() %>" data-send="true" data-layout="button_count" data-width="450" data-show-faces="false"></div>
+ <br />
+ <%= link_to t('org_form.edit_button'), edit_organization_path(@organization), :class => 'link edit' %>
</p>
</div>
<div class="clear"></div>

0 comments on commit de9c94f

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