diff options
Diffstat (limited to 'app')
-rw-r--r-- | app/controllers/track_controller.rb | 2 | ||||
-rw-r--r-- | app/helpers/track_helper.rb | 23 |
2 files changed, 24 insertions, 1 deletions
diff --git a/app/controllers/track_controller.rb b/app/controllers/track_controller.rb index c861971bd..dccc52efc 100644 --- a/app/controllers/track_controller.rb +++ b/app/controllers/track_controller.rb @@ -179,7 +179,7 @@ class TrackController < ApplicationController new_medium = params[:track_medium] if new_medium == 'delete' track_thing.destroy - flash[:notice] = _("You are no longer following {{track_description}}.", :track_description => track_thing.params[:list_description]) + flash[:notice] = view_context.unsubscribe_notice(track_thing) redirect_to URI.parse(params[:r]).path else raise "new medium not handled " + new_medium diff --git a/app/helpers/track_helper.rb b/app/helpers/track_helper.rb index 49209d6bc..5038cf5e8 100644 --- a/app/helpers/track_helper.rb +++ b/app/helpers/track_helper.rb @@ -76,4 +76,27 @@ module TrackHelper end end + def unsubscribe_notice(track_thing) + case track_thing.track_type + when 'request_updates' + _("You are no longer following '{{link_to_request}}', a request", + :link_to_request => request_link(track_thing.info_request)) + when 'all_new_requests' + _('You are no longer following <a href="{{new_requests_url}}">new requests</a>', + :new_requests_url => request_list_path) + when 'all_successful_requests' + _('You are no longer following <a href="{{successful_requests_url}}">successful requests</a>', + :successful_requests_url => request_list_successful_path ) + when 'public_body_updates' + _("You are no longer following '{{link_to_authority}}', a public authority", + :link_to_authority => public_body_link(track_thing.public_body)) + when 'user_updates' + _("You are no longer following '{{link_to_user}}', a person", + :link_to_user => user_link(track_thing.tracked_user)) + when 'search_query' + _('You are no longer following <a href="{{search_url}}">this search</a>', + :search_url => search_path([track_thing.track_query, 'newest', 'advanced'])) + end + end + end |