diff options
Diffstat (limited to 'app/helpers/projects_helper.rb')
-rw-r--r-- | app/helpers/projects_helper.rb | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/app/helpers/projects_helper.rb b/app/helpers/projects_helper.rb index d6fb629b0c2..4e4c6e301d5 100644 --- a/app/helpers/projects_helper.rb +++ b/app/helpers/projects_helper.rb @@ -8,7 +8,7 @@ module ProjectsHelper end def link_to_project(project) - link_to [project.namespace.becomes(Namespace), project] do + link_to [project.namespace.becomes(Namespace), project], title: h(project.name) do title = content_tag(:span, project.name, class: 'project-name') if project.namespace @@ -26,7 +26,7 @@ module ProjectsHelper image_tag(avatar_icon(author, opts[:size]), width: opts[:size], class: "avatar avatar-inline #{"s#{opts[:size]}" if opts[:size]}", alt:'') if opts[:avatar] end - def link_to_member(project, author, opts = {}) + def link_to_member(project, author, opts = {}, &block) default_opts = { avatar: true, name: true, size: 16, author_class: 'author', title: ":name" } opts = default_opts.merge(opts) @@ -38,15 +38,21 @@ module ProjectsHelper author_html << image_tag(avatar_icon(author, opts[:size]), width: opts[:size], class: "avatar avatar-inline #{"s#{opts[:size]}" if opts[:size]}", alt:'') if opts[:avatar] # Build name span tag - author_html << content_tag(:span, sanitize(author.name), class: opts[:author_class]) if opts[:name] + if opts[:by_username] + author_html << content_tag(:span, sanitize("@#{author.username}"), class: opts[:author_class]) if opts[:name] + else + author_html << content_tag(:span, sanitize(author.name), class: opts[:author_class]) if opts[:name] + end + + author_html << capture(&block) if block author_html = author_html.html_safe if opts[:name] - link_to(author_html, user_path(author), class: "author_link").html_safe + link_to(author_html, user_path(author), class: "author_link #{"#{opts[:mobile_classes]}" if opts[:mobile_classes]}").html_safe else title = opts[:title].sub(":name", sanitize(author.name)) - link_to(author_html, user_path(author), class: "author_link has_tooltip", data: { 'original-title'.to_sym => title, container: 'body' } ).html_safe + link_to(author_html, user_path(author), class: "author_link has-tooltip", data: { 'original-title'.to_sym => title, container: 'body' } ).html_safe end end @@ -203,7 +209,7 @@ module ProjectsHelper def default_clone_protocol if !current_user || current_user.require_ssh_key? - "http" + gitlab_config.protocol else "ssh" end |