Feature #4179 » link_to_user_profile_by_id_v2.patch
| app/helpers/application_helper.rb | ||
|---|---|---|
|
# Users:
|
||
|
# user:jsmith -> Link to user with login jsmith
|
||
|
# @jsmith -> Link to user with login jsmith
|
||
|
# user#2 -> Link to user with id 2
|
||
|
#
|
||
|
# Links can refer other objects from other projects, using project identifier:
|
||
|
# identifier:r52
|
||
| ... | ... | |
|
if p = Project.visible.find_by_id(oid)
|
||
|
link = link_to_project(p, {:only_path => only_path}, :class => 'project')
|
||
|
end
|
||
|
when 'user'
|
||
|
u = User.visible.where(:id => oid, :type => 'User').first
|
||
|
link = link_to_user(u) if u
|
||
|
end
|
||
|
elsif sep == ':'
|
||
|
name = remove_double_quotes(identifier)
|
||
| test/unit/helpers/application_helper_test.rb | ||
|---|---|---|
|
"http://foo.bar/FAQ#3" => '<a class="external" href="http://foo.bar/FAQ#3">http://foo.bar/FAQ#3</a>',
|
||
|
# user
|
||
|
'user:jsmith' => link_to_user(User.find_by_id(2)),
|
||
|
'user#2' => link_to_user(User.find_by_id(2)),
|
||
|
'@jsmith' => link_to_user(User.find_by_id(2)),
|
||
|
# invalid user
|
||
|
'user:foobar' => 'user:foobar',
|
||
- « Previous
- 1
- …
- 3
- 4
- 5
- Next »