Project

General

Profile

Feature #4179 » link_to_user_profile_by_id_v2.patch

Marius BĂLTEANU, 2017-06-16 00:13

View differences:

app/helpers/application_helper.rb
821 821
  #  Users:
822 822
  #     user:jsmith -> Link to user with login jsmith
823 823
  #     @jsmith -> Link to user with login jsmith
824
  #     user#2 -> Link to user with id 2
824 825
  #
825 826
  #   Links can refer other objects from other projects, using project identifier:
826 827
  #     identifier:r52
......
908 909
              if p = Project.visible.find_by_id(oid)
909 910
                link = link_to_project(p, {:only_path => only_path}, :class => 'project')
910 911
              end
912
            when 'user'
913
              u = User.visible.where(:id => oid, :type => 'User').first
914
              link = link_to_user(u) if u
911 915
            end
912 916
          elsif sep == ':'
913 917
            name = remove_double_quotes(identifier)
test/unit/helpers/application_helper_test.rb
386 386
      "http://foo.bar/FAQ#3"        => '<a class="external" href="http://foo.bar/FAQ#3">http://foo.bar/FAQ#3</a>',
387 387
      # user
388 388
      'user:jsmith'                 => link_to_user(User.find_by_id(2)),
389
      'user#2'                      => link_to_user(User.find_by_id(2)),
389 390
      '@jsmith'                     => link_to_user(User.find_by_id(2)),
390 391
      # invalid user
391 392
      'user:foobar'                 => 'user:foobar',
(5-5/5)