[issue #64] User names are clickable.

This commit is contained in:
George Vinogradov 2012-01-29 22:03:42 +04:00
parent 1ef2bc0f75
commit 706c052a5e
4 changed files with 12 additions and 3 deletions

View File

@ -88,6 +88,15 @@ module WikiHelper
@page.version.author.name @page.version.author.name
end end
def author_email
@page.version.author.email
end
def user_path_by_email(author_email)
user = User.find_by_email(author_email)
(!!user) ? user_path(user) : 'javascript:void(0)'
end
def date def date
@page.version.authored_date.strftime("%Y-%m-%d %H:%M:%S") @page.version.authored_date.strftime("%Y-%m-%d %H:%M:%S")
end end

View File

@ -13,7 +13,7 @@
%td.checkbox %td.checkbox
= check_box_tag "versions[]", v.id = check_box_tag "versions[]", v.id
%td.author %td.author
= link_to "javascript:void(0)" do = link_to user_path_by_email(v.author.email) do
%img{:src => gravatar_url(v.author.email), :alt => "avatar: #{v.author.name}", :class => "mini-gravatar"} %img{:src => gravatar_url(v.author.email), :alt => "avatar: #{v.author.name}", :class => "mini-gravatar"}
%span.username= v.author.name %span.username= v.author.name
%td.commit-name %td.commit-name

View File

@ -14,7 +14,7 @@
%p#last-edit %p#last-edit
= t("layout.wiki.last_edited_by") = t("layout.wiki.last_edited_by")
%b %b
= author = link_to author, user_path_by_email(author_email)
= time_ago_in_words date.to_time - 4.hours, true = time_ago_in_words date.to_time - 4.hours, true
= t("layout.time.ago") = t("layout.time.ago")
- unless action_name == 'preview' or cannot? :write, @project - unless action_name == 'preview' or cannot? :write, @project

View File

@ -83,7 +83,7 @@ en:
Sunday: Sunday Sunday: Sunday
time: time:
ago: назад ago: ago
menu: menu:
categories: Catalogue categories: Catalogue