Browse Source

Route share links through app

Thibaut 11 years ago
parent
commit
fa73dba4e6
2 changed files with 14 additions and 4 deletions
  1. 2 4
      assets/javascripts/templates/notif_tmpl.coffee
  2. 12 0
      lib/app.rb

+ 2 - 4
assets/javascripts/templates/notif_tmpl.coffee

@@ -25,7 +25,5 @@ app.templates.notifNews = (news) ->
 app.templates.notifShare = ->
 app.templates.notifShare = ->
   textNotif """ Hi there! """,
   textNotif """ Hi there! """,
             """ Like DevDocs? Help us reach more developers by sharing the link with your friends, on
             """ Like DevDocs? Help us reach more developers by sharing the link with your friends, on
-                <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>,
-                <a href="https://www.facebook.com/sharer/sharer.php?u=http%3A%2F%2Fdevdocs.io" target="_blank">Facebook</a>,
-                <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>,
-                etc.<br>Thanks :)"""
+                <a href="/s/tw" target="_blank">Twitter</a>, <a href="/s/fb" target="_blank">Facebook</a>,
+                <a href="/s/re" target="_blank">Reddit</a>, etc.<br>Thanks :) """

+ 12 - 0
lib/app.rb

@@ -141,6 +141,18 @@ class App < Sinatra::Application
     settings.news_feed
     settings.news_feed
   end
   end
 
 
+  get '/s/tw' do
+    redirect 'https://twitter.com/intent/tweet?url=http%3A%2F%2Fdevdocs.io&via=DevDocs&text=All-in-one%2C%20quickly%20searchable%20API%20docs%3A'
+  end
+
+  get '/s/fb' do
+    redirect 'https://www.facebook.com/sharer/sharer.php?u=http%3A%2F%2Fdevdocs.io'
+  end
+
+  get '/s/re' do
+    redirect 'http://www.reddit.com/submit?url=http%3A%2F%2Fdevdocs.io&title=All-in-one%2C%20quickly%20searchable%20API%20docs&resubmit=true'
+  end
+
   get %r{\A/(\w+)(\-[\w\-]+)?(/)?(.+)?\z} do |doc, type, slash, rest|
   get %r{\A/(\w+)(\-[\w\-]+)?(/)?(.+)?\z} do |doc, type, slash, rest|
     return 404 unless @doc = settings.docs[doc]
     return 404 unless @doc = settings.docs[doc]