This commit is contained in:
Yuki 2015-05-27 06:41:21 +05:30
parent 9c83972105
commit 74bbbdf4ca
2 changed files with 10 additions and 2 deletions

View File

@ -39,10 +39,18 @@ module ApplicationHelper
content_tag(:a, body.html_safe, href: path, class: ("list-group-item #{'active ' if current_page? path}#{options[:class]}")) content_tag(:a, body.html_safe, href: path, class: ("list-group-item #{'active ' if current_page? path}#{options[:class]}"))
end end
def tooltip(body, tooltip_content, placement) def tooltip(body, tooltip_content, placement = "bottom")
content_tag(:span, body, {title: tooltip_content, "data-toggle" => "tooltip", "data-placement" => placement} ) content_tag(:span, body, {title: tooltip_content, "data-toggle" => "tooltip", "data-placement" => placement} )
end end
def time_tooltip(question, placement = "bottom")
t = tooltip time_ago_in_words(question.created_at), localize(question.created_at), placement
unless question.user.nil? or question.author_is_anonymous
t = content_tag(:a, t, {href: show_user_question_path(question.user.screen_name, question.id)})
end
t
end
def hidespan(body, hide) def hidespan(body, hide)
content_tag(:span, body, class: "hidden-#{hide}") content_tag(:span, body, class: "hidden-#{hide}")
end end

View File

@ -23,7 +23,7 @@
%i.fa.fa-exclamation-triangle %i.fa.fa-exclamation-triangle
Report Report
%h6.text-muted.media-heading.answerbox--question-user %h6.text-muted.media-heading.answerbox--question-user
= raw t('views.answerbox.asked', user: user_screen_name(a.question.user, a.question.author_is_anonymous), time: (@user.nil? or a.question.author_is_anonymous) ? tooltip(time_ago_in_words(a.question.created_at), a.question.created_at, "bottom") : link_to(tooltip(time_ago_in_words(a.question.created_at), a.question.created_at, "bottom"),show_user_question_path(a.question.user.screen_name, a.question.id))) = raw t('views.answerbox.asked', user: user_screen_name(a.question.user, a.question.author_is_anonymous), time: time_tooltip(a.question))
- unless a.question.author_is_anonymous - unless a.question.author_is_anonymous
- if a.question.answer_count > 1 - if a.question.answer_count > 1
· ·