Skip to content

Instantly share code, notes, and snippets.

@jakelear
Created August 12, 2014 15:08
Show Gist options
  • Select an option

  • Save jakelear/ef6058a10281e7ad36a0 to your computer and use it in GitHub Desktop.

Select an option

Save jakelear/ef6058a10281e7ad36a0 to your computer and use it in GitHub Desktop.
diff --git a/app/views/shared/chorus/social/_social_buttons.html.erb b/app/views/shared/chorus/social/_social_buttons.html.erb
index 8d4df52..033e05d 100644
--- a/app/views/shared/chorus/social/_social_buttons.html.erb
+++ b/app/views/shared/chorus/social/_social_buttons.html.erb
@@ -25,15 +25,18 @@
<% elsif ['twitter-tweet', 'twitter-tall'].include?(type) %>
<%
twitter_link_html_options = { :class => 'twitter-share-button' }
- twitter_link_html_options[:'data-text'] = (current_network.config.uses_promo_headlines_for_social? ? (@entry.promo_headline_plain || @entry.title_plain) : @entry.title_plain) if @entry
+ if @entry
+ if current_network.config.uses_promo_headlines_for_social?
+ twitter_link_html_options[:'data-text'] = @entry.promo_headline_plain.blank? ? @entry.title_plain : @entry.promo_headline_plain
+ else
+ twitter_link_html_options[:'data-text'] = @entry.title_plain
+ end
+ twitter_link_html_options[:'data-url'] = @entry.short_url ? @entry.short_url : request.url
+ end
twitter_link_html_options[:'data-count'] = type == 'twitter-tall' ? 'vertical' : 'none'
+ twitter_link_html_options[:'data-counturl'] = request.url
twitter_link_html_options[:'data-via'] = (username || "")
twitter_link_html_options[:'data-via'] += " #{@entry.additional_twitter_text}" if (@entry && @entry.additional_twitter_text)
- twitter_link_html_options[:'data-url'] = @entry.short_url if @entry
- if @entry && @entry.short_url
- twitter_link_html_options[:'data-url'] = @entry.short_url
- twitter_link_html_options[:'data-counturl'] = request.url
- end
%>
<%= link_to '', 'http://twitter.com/share', twitter_link_html_options %>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment