From 53ea4e4232375395e67050aec4d57a6cd4082d8d Mon Sep 17 00:00:00 2001 From: Seb Bacon Date: Mon, 14 May 2012 18:21:42 +0100 Subject: Support "following" functionality: * Change "email me about stuff" wording to "follow" throughout * Introduce a new flag that the user can set, which controls if they get email alerts * Add a new link to a "wall" for logged in users where they can see a feed of all the things they're following --- app/controllers/track_controller.rb | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'app/controllers/track_controller.rb') diff --git a/app/controllers/track_controller.rb b/app/controllers/track_controller.rb index 312cedc6c..f1ece3bcc 100644 --- a/app/controllers/track_controller.rb +++ b/app/controllers/track_controller.rb @@ -123,7 +123,7 @@ class TrackController < ApplicationController if @user @existing_track = TrackThing.find_by_existing_track(@user, @track_thing) if @existing_track - flash[:notice] = _("You are already being emailed updates about ") + @track_thing.params[:list_description] + flash[:notice] = _("You are already following updates about {{track_description}}", :track_description => @track_thing.params[:list_description]) return true end end @@ -135,8 +135,11 @@ class TrackController < ApplicationController @track_thing.track_medium = 'email_daily' @track_thing.tracking_user_id = @user.id @track_thing.save! - - flash[:notice] = _("You will now be emailed updates about ") + @track_thing.params[:list_description] + if @user.receive_email_alerts + flash[:notice] = _('You will now be emailed updates about {{track_description}}. Prefer not to receive emails?', :track_description => @track_thing.params[:list_description], :change_email_alerts_url => url_for(:controller => "user", :action => "wall", :url_name => @user.url_name)) + else + flash[:notice] = _('You are now following updates about {{track_description}}', @track_thing.params[:list_description], :wall_url_user => url_for(:controller => "user", :action => "wall", :url_name => @user.url_name)) + end return true end @@ -179,7 +182,7 @@ class TrackController < ApplicationController new_medium = params[:track_medium] if new_medium == 'delete' track_thing.destroy - flash[:notice] = _("You will no longer be emailed updates about ") + track_thing.params[:list_description] + flash[:notice] = _("You are no longer following {{track_description}}", :track_description => track_thing.params[:list_description]) redirect_to params[:r] # Reuse code like this if we let medium change again. #elsif new_medium == 'email_daily' -- cgit v1.2.3 From c9503a034cd7f0490bd7ca3a22745e6dc7fa1696 Mon Sep 17 00:00:00 2001 From: Seb Bacon Date: Wed, 16 May 2012 09:09:51 +0100 Subject: Fix typo that broke one of the "follow" informational messages --- app/controllers/track_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app/controllers/track_controller.rb') diff --git a/app/controllers/track_controller.rb b/app/controllers/track_controller.rb index f1ece3bcc..07e807451 100644 --- a/app/controllers/track_controller.rb +++ b/app/controllers/track_controller.rb @@ -138,7 +138,7 @@ class TrackController < ApplicationController if @user.receive_email_alerts flash[:notice] = _('You will now be emailed updates about {{track_description}}. Prefer not to receive emails?', :track_description => @track_thing.params[:list_description], :change_email_alerts_url => url_for(:controller => "user", :action => "wall", :url_name => @user.url_name)) else - flash[:notice] = _('You are now following updates about {{track_description}}', @track_thing.params[:list_description], :wall_url_user => url_for(:controller => "user", :action => "wall", :url_name => @user.url_name)) + flash[:notice] = _('You are now following updates about {{track_description}}', :track_description => @track_thing.params[:list_description], :wall_url_user => url_for(:controller => "user", :action => "wall", :url_name => @user.url_name)) end return true end -- cgit v1.2.3