diff options
Diffstat (limited to 'app')
-rw-r--r-- | app/controllers/track_controller.rb | 10 | ||||
-rw-r--r-- | app/views/request/widget.html.erb | 18 |
2 files changed, 22 insertions, 6 deletions
diff --git a/app/controllers/track_controller.rb b/app/controllers/track_controller.rb index 4b272797f..708dd8737 100644 --- a/app/controllers/track_controller.rb +++ b/app/controllers/track_controller.rb @@ -214,6 +214,14 @@ class TrackController < ApplicationController redirect_to URI.parse(params[:r]).path end + # Track interest in a request from a non-logged in user + def widget_vote + info_request = InfoRequest.find(params[:info_request_id]) + if not @user and cookies[:widget_vote] + wv = info_request.widget_votes.where(:cookie => cookies[:widget_vote]).first_or_create + end + track_thing = TrackThing.create_track_for_request(info_request) + redirect_to do_track_path(track_thing), status => :temporary_redirect + end end - diff --git a/app/views/request/widget.html.erb b/app/views/request/widget.html.erb index a196f40de..462170400 100644 --- a/app/views/request/widget.html.erb +++ b/app/views/request/widget.html.erb @@ -68,11 +68,19 @@ </div> </a> <% else %> - <a href="<%= url_for do_track_path(@track_thing) %>" target="_blank"> - <div id="alawidget-button"> - <%= _('I also want to know!') %> - </div> - </a> + <% if @user %> + <a href="<%= url_for do_track_path(@track_thing) %>" target="_blank"> + <div id="alawidget-button"> + <%= _('I also want to know!') %> + </div> + </a> + <% else %> + <a href="<%= url_for :controller => 'track', :action => 'widget_vote', :info_request_id => @info_request %>" target="_blank"> + <div id="alawidget-button"> + <%= _('I also want to know!') %> + </div> + </a> + <% end %> <% end %> </div> </div> |