aboutsummaryrefslogtreecommitdiffstats
path: root/app/helpers/link_to_helper.rb
diff options
context:
space:
mode:
authorLouise Crow <louise.crow@gmail.com>2014-01-14 17:03:45 +0000
committerLouise Crow <louise.crow@gmail.com>2014-01-14 17:37:05 +0000
commitcb326c18d586220c6196b66c2af22dce250dbc06 (patch)
treeb3e8021c455444f62ea907b91438467862f0148d /app/helpers/link_to_helper.rb
parent1555a395957f6d1208980509efb9bc989443a063 (diff)
Link 'anonymous' users to help section with explanation.
Requests submitted using the write API may have an anonymous user. Add a section to the FAQ explaining this, and link to it from those requests. Note this commit removes some 'h' calls that are no longer needed in Rails 3. Contributes to https://github.com/mysociety/alaveteli/issues/1286
Diffstat (limited to 'app/helpers/link_to_helper.rb')
-rwxr-xr-xapp/helpers/link_to_helper.rb25
1 files changed, 19 insertions, 6 deletions
diff --git a/app/helpers/link_to_helper.rb b/app/helpers/link_to_helper.rb
index 8df28f350..433a34da9 100755
--- a/app/helpers/link_to_helper.rb
+++ b/app/helpers/link_to_helper.rb
@@ -121,24 +121,37 @@ module LinkToHelper
end
def user_link_absolute(user)
- link_to h(user.name), user_url(user)
+ link_to user.name, user_url(user)
end
def user_link(user)
- link_to h(user.name), user_path(user)
+ link_to user.name, user_path(user)
end
- def request_user_link_absolute(request)
+ def external_user_link(request, absolute=false, text)
+ if request.external_user_name
+ request.external_user_name
+ else
+ if absolute
+ url = help_privacy_url(:anchor => 'anonymous')
+ else
+ url = help_privacy_path(:anchor => 'anonymous')
+ end
+ link_to(text, url)
+ end
+ end
+
+ def request_user_link_absolute(request, anonymous_text=_("Anonymous user"))
if request.is_external?
- request.external_user_name || _("Anonymous user")
+ external_user_link(request, absolute=true, anonymous_text)
else
user_link_absolute(request.user)
end
end
- def request_user_link(request)
+ def request_user_link(request, anonymous_text=_("Anonymous user"))
if request.is_external?
- request.external_user_name || _("Anonymous user")
+ external_user_link(request, anonymous_text)
else
user_link(request.user)
end