Skip to content
This repository has been archived by the owner on Dec 5, 2019. It is now read-only.

Commit

Permalink
move sharing message to translation files
Browse files Browse the repository at this point in the history
  • Loading branch information
PZhao committed Aug 16, 2012
1 parent 0ed70d0 commit 5291e13
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 44 deletions.
23 changes: 1 addition & 22 deletions README.md
Expand Up @@ -200,28 +200,7 @@ Edit app.rb file under the source code repository root folder. Replace "arthriti

to set a new tag.

### Change sharing messages
To change the sharing messages for Facebook, Twitter and Tumblr, edit "lib/helpers/application_helper.rb":

def facebook_message
settings.language == 'en' ?
"Please support 4.6 million Canadians living with arthritis! Watch the video and share the infographic! http://www.goriete.com/page.aspx?pid=6324"
: "S'il vous plaît soutenir 4,6 millions de Canadiens vivant avec l'arthrite! Regardez la vidéo et partager l'infographie! http://www.goriete.com/page.aspx?pid=6324"
end

def tumblr_message
settings.language == 'en' ?
"I support 4.6 million Canadians living with arthritis! Do you?"
: "Je soutiens 4,6 millions de Canadiens vivant avec l'arthrite! Et vous?"
end
def twitter_message(photo_url)
settings.language == 'en' ?
"Please support 4.6 million Canadians living with arthritis! Watch the video and share the infographic! http://www.goriete.com/page.aspx?pid=6324"
: "S'il vous plaît soutenir 4,6 millions de Canadiens vivant avec l'arthrite! Regardez la vidéo et partager l'infographie!"
end

Change the return value of those three methods as shown in above code block for both English and French.


### Change banners

Expand Down
22 changes: 2 additions & 20 deletions lib/helpers/application_helper.rb
Expand Up @@ -13,13 +13,13 @@ def facebook_callback_url(photo_id)

def share_to_tumblr_url(photo_url)
"http://www.tumblr.com/share/photo?source=#{CGI.escape(photo_url)}" +
"&caption=#{CGI.escape(tumblr_message)}" +
"&caption=#{CGI.escape(t.tumblr_message)}" +
"&click_thru=#{CGI.escape(request.url)}"
end

def share_to_twitter_url(photo_url)
account = settings.language == 'fr' ? 'SOCIETEARTHRITE' : 'ArthritisSoc'
"https://twitter.com/intent/tweet?source=webclient&text=#{CGI.escape(twitter_message(photo_url))}&via=#{account}"
"https://twitter.com/intent/tweet?source=webclient&text=#{CGI.escape(t.twitter_message(tiny_url(photo_url)))}&via=#{account}"
end


Expand All @@ -31,24 +31,6 @@ def flickr
@flickr_sharing ||= Sharing::Flickr.new(settings.flickr_api_key, settings.flickr_secret, settings.flickr_access_token, settings.flickr_access_secret)
end

def facebook_message
settings.language == 'en' ?
"Please support 4.6 million Canadians living with arthritis! Watch the video and share the infographic! http://wehavearthritis.ca/"
: "Apportez votre soutien aux 4,6 millions de Canadiens souffrant d’arthrite! Regardez la vidéo et partagez-la! http://couragearthrite.ca/"
end

def tumblr_message
settings.language == 'en' ?
"I support 4.6 million Canadians living with arthritis! Do you?"
: "J’apporte mon soutien aux 4,6 millions de Canadiens souffrant d’arthrite! Et vous?"
end

def twitter_message(photo_url)
settings.language == 'en' ?
"Please support 4.6 million Canadians living with arthritis! Watch the video & share the infographic! http://wehavearthritis.ca"
: "Apportez votre soutien aux 4,6 M de Canadiens atteints d’arthrite! Regardez la vidéo! http://couragearthrite.ca"
end

end
helpers ApplicationHelper
end
5 changes: 4 additions & 1 deletion static/localization/en.yml
Expand Up @@ -24,5 +24,8 @@ text:
cancel: "Cancel"
picture_posted_on_facebook: "Your picture has been posted on your Facebook profile."
close_window: "Close Window"
window_will_be_closed_in_seconds: This window will be closed in seconds..."
window_will_be_closed_in_seconds: "This window will be closed in seconds..."
twitter_message: "Please support 4.6 million Canadians living with arthritis! Watch the video & share the infographic! http://wehavearthritis.ca"
tumblr_message: "I support 4.6 million Canadians living with arthritis! Do you?"
facebook_message: "Please support 4.6 million Canadians living with arthritis! Watch the video and share the infographic! http://wehavearthritis.ca/"
formats:
3 changes: 3 additions & 0 deletions static/localization/fr.yml
Expand Up @@ -25,4 +25,7 @@ text:
picture_posted_on_facebook: "Votre photo s'affiche maintenant dans votre profil Facebook."
close_window: "Fermer la fenêtre"
window_will_be_closed_in_seconds: "Cette fenêtre est en cours de fermeture..."
twitter_message: "Apportez votre soutien aux 4,6 M de Canadiens atteints d’arthrite! Regardez la vidéo! http://couragearthrite.ca"
tumblr_message: "J’apporte mon soutien aux 4,6 millions de Canadiens souffrant d’arthrite! Et vous?"
facebook_message: "Apportez votre soutien aux 4,6 millions de Canadiens souffrant d’arthrite! Regardez la vidéo et partagez-la! http://couragearthrite.ca/"
formats:
2 changes: 1 addition & 1 deletion views/facebook_message.haml
Expand Up @@ -3,7 +3,7 @@
%center
%h3= t.share_on_facebook
%p= t.please_add_message_for_sharing_
%textarea#facebook-message{:name => 'message', :col => 35, :row => 3}=facebook_message
%textarea#facebook-message{:name => 'message', :col => 35, :row => 3}= t.facebook_message
%input.btn.btn-primary#continue{ :href => "#", :type => 'submit', :value => "#{t.continue}"}
%input.btn#cancel{ :href => "#", :type => 'button', :value => "#{t.cancel}"}

Expand Down

0 comments on commit 5291e13

Please sign in to comment.