History

Route share links through app

Thibaut committed 11 years ago

Commit fa73dba1 parent 1ec91402 files · +14 −4Browse files

Unified · Split

2 files
  1. assets/javascripts/templates/notif_tmpl.coffee +2 −4
  2. lib/app.rb +12 −0
assets/javascripts/templates/notif_tmpl.coffee+2−4
@@ -25,7 +25,5 @@ app.templates.notifNews = (news) -> · 24 unmodified lines
2525 app.templates.notifShare = ->
2626 textNotif """ Hi there! """,
2727 """ Like DevDocs? Help us reach more developers by sharing the link with your friends, on
28− <a href="https://twitter.com/intent/tweet?url=http%3A%2F%2Fdevdocs.io&via=DevDocs&text=All-in-one%2C%20quickly%20searchable%20API%20docs%3A" target="_blank">Twitter</a>,
29− <a href="https://www.facebook.com/sharer/sharer.php?u=http%3A%2F%2Fdevdocs.io" target="_blank">Facebook</a>,
30− <a href="http://www.reddit.com/submit?url=http%3A%2F%2Fdevdocs.io&title=All-in-one%2C%20quickly%20searchable%20API%20docs&resubmit=true" target="_blank">Reddit</a>,
31− etc.<br>Thanks :)"""
28+ <a href="/s/tw" target="_blank">Twitter</a>, <a href="/s/fb" target="_blank">Facebook</a>,
29+ <a href="/s/re" target="_blank">Reddit</a>, etc.<br>Thanks :) """
lib/app.rb+12−0
@@ -141,6 +141,18 @@ class App < Sinatra::Application · 140 unmodified lines
141141 settings.news_feed
142142 end
143143
144+ get '/s/tw' do
145+ redirect 'https://twitter.com/intent/tweet?url=http%3A%2F%2Fdevdocs.io&via=DevDocs&text=All-in-one%2C%20quickly%20searchable%20API%20docs%3A'
146+ end
147+
148+ get '/s/fb' do
149+ redirect 'https://www.facebook.com/sharer/sharer.php?u=http%3A%2F%2Fdevdocs.io'
150+ end
151+
152+ get '/s/re' do
153+ redirect 'http://www.reddit.com/submit?url=http%3A%2F%2Fdevdocs.io&title=All-in-one%2C%20quickly%20searchable%20API%20docs&resubmit=true'
154+ end
155+
144156 get %r{\A/(\w+)(\-[\w\-]+)?(/)?(.+)?\z} do |doc, type, slash, rest|
145157 return 404 unless @doc = settings.docs[doc]
146158