Merge pull request #149 from warpc/64-project_wiki

Fixes in wiki
This commit is contained in:
Pasha 2012-02-02 16:16:04 -08:00
commit 2162a75fc8
4 changed files with 15 additions and 9 deletions

View File

@ -246,7 +246,7 @@ class WikiController < ApplicationController
end
def commit
commit_message.merge({:name => current_user.name, :email => current_user.email})
commit_message.merge({:name => current_user.uname, :email => current_user.email})
end
def show_or_create_page

View File

@ -86,16 +86,19 @@ module WikiHelper
end
def author
@page.version.author.name
@page.version.author.name.force_encoding(Encoding.default_internal || Encoding::UTF_8)
end
def author_email
@page.version.author.email
end
def user_path_by_email(email)
user = User.where(:email => email).first
(!!user) ? user_path(user) : 'javascript:void(0)'
def user_path_by_user(user)
(user.present?) ? user_path(user) : 'javascript:void(0)'
end
def user_link_by_user(user)
link_to (user.present?) ? user.uname : author, user_path_by_user(user)
end
def date

View File

@ -13,9 +13,12 @@
%td.checkbox
= check_box_tag "versions[]", v.id
%td.author
= 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"}
%span.username= v.author.name
- user = User.where(:email => v.author.email).first
= link_to user_path_by_user(user) do
%img{:src => gravatar_url(v.author.email),
:alt => "avatar: #{v.author.name.force_encoding(Encoding.default_internal || Encoding::UTF_8)}",
:class => "mini-gravatar"}
%span.username= user.uname
%td.commit-name
%span.time-elapsed= "#{l v.committed_date.to_date, :format => :long}:"
&nbsp;

View File

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