diff --git a/web/app/controllers/users_controller.rb b/web/app/controllers/users_controller.rb index d380c6b34..3a52f9e3b 100644 --- a/web/app/controllers/users_controller.rb +++ b/web/app/controllers/users_controller.rb @@ -370,18 +370,21 @@ class UsersController < ApplicationController end def endorse - if uu = User.where(['id = ? AND first_liked_us IS NULL',params[:id]]).limit(1).first + if uu = current_user || + uu = User.where(['id = ? AND first_liked_us IS NULL',params[:id]]).limit(1).first uu.first_liked_us = Time.now uu.save! - end if params[:id].present? + end if params[:id].present? && (service=params[:service]).present? - url, service = 'http://www.jamkazam.com', params[:service] + service ||= 'facebook' + url = CGI::escape('http://www.jamkazam.com') + txt = CGI::escape('Check out JamKazam -- Play music together over the Internet as if in the same room') if 'twitter'==service - url = 'https://twitter.com/jamkazam' + url = "https://twitter.com/intent/tweet?text=#{txt}&url=#{url}" elsif 'facebook'==service - url = 'https://www.facebook.com/JamKazam' + url = "http://www.facebook.com/sharer/sharer.php?u=#{url}&t=#{txt}" elsif 'google'==service - url = 'https://plus.google.com/u/0/106619885929396862606/about' + url = "https://plus.google.com/share?url=#{url}" end redirect_to url end diff --git a/web/app/views/clients/_footer.html.erb b/web/app/views/clients/_footer.html.erb index 5c4fee259..fdbcf9b0a 100644 --- a/web/app/views/clients/_footer.html.erb +++ b/web/app/views/clients/_footer.html.erb @@ -1,3 +1,10 @@ +
+
+ <% [:twitter, :facebook, :google].each do |src| %> + <%= link_to(image_tag("http://www.jamkazam.com/assets/content/icon_#{src}.png", :style => "vertical-align:top"), "/endorse/0/#{src}") %>  + <% end %> +
+