aboutsummaryrefslogtreecommitdiffstats
path: root/app/helpers
diff options
context:
space:
mode:
authorLouise Crow <louise.crow@gmail.com>2014-03-17 17:35:21 +0000
committerLouise Crow <louise.crow@gmail.com>2014-03-24 13:07:51 +0000
commit5ac63b9c812fc914fd52de7dae813e1bb5f0f36e (patch)
tree15feb8d085ba68d7a8b02dce7ff17502a3aa8112 /app/helpers
parent5cb467c469d9a34336da483e47b931c9dd5b9078 (diff)
Move track descriptions to a helper.
We can access url generation methods more easily here.
Diffstat (limited to 'app/helpers')
-rw-r--r--app/helpers/track_helper.rb20
1 files changed, 20 insertions, 0 deletions
diff --git a/app/helpers/track_helper.rb b/app/helpers/track_helper.rb
index 5038cf5e8..7bd0fa55d 100644
--- a/app/helpers/track_helper.rb
+++ b/app/helpers/track_helper.rb
@@ -99,4 +99,24 @@ module TrackHelper
end
end
+ def track_description(track_thing)
+ case track_thing.track_type
+ when 'request_updates'
+ _("'{{link_to_request}}', a request",
+ :link_to_request => request_link(track_thing.info_request))
+ when 'all_new_requests'
+ link_to(_('new requests'), request_list_path)
+ when 'all_successful_requests'
+ link_to(_('successful requests'), request_list_successful_path)
+ when 'public_body_updates'
+ _("'{{link_to_authority}}', a public authority",
+ :link_to_authority => public_body_link(track_thing.public_body))
+ when 'user_updates'
+ _("'{{link_to_user}}', a person",
+ :link_to_user => user_link(track_thing.tracked_user))
+ when 'search_query'
+ link_to(track_thing.track_query_description,
+ search_path([track_thing.track_query, 'newest', 'advanced']))
+ end
+ end
end