So I'm just trying to add some social networking share links (facebook, g+, addthis ect) to one of my flash messages when a user successfully uploads a file. I have all the code in a partial so I thought I could just render that but I just get a bunch of "/n"'s and html_safe doesnt work.
here is my partial:
<div class="share_buttons">
<div class="addthis_toolbox addthis_default_style addthis_32x32_style">
<a class="addthis_button_facebook"></a>
<a class="addthis_button_twitter"></a>
<a class="addthis_button_stumbleupon"></a>
</div>
<script type="text/javascript" src="http://s7.addthis.com/js/250/addthis_widget.js#pubid=xa-4e8b938653ac0cd3"></script>
</div>
<script type="text/javascript">
reddit_target='tattoos'
</script>
<script type="text/javascript" src="http://www.reddit.com/static/button/button1.js"></script>
<% content_for :jquery do %>
<%= javascript_tag do %>
$(document).ready(function() {
$(".share_buttons a").live("click", function() {
$.ajax({
url: '/index/share?id=<%= @tattoo.id%>',
type: 'post'
});
return false;
});
});
<% end %>
<% end %>
And in my controller I tried this:
flash[:success] = "Thanks, feel free to share that out! #{render :partial=> /shared/social_buttons
}"
Need to render it to a string instead
flash[:success] = "Thanks, feel free to share that out! #{render_to_string :partial => '/shared/social_buttons'}"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With