diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index a55bec83..74fe977f 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -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]}")) 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} ) 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) content_tag(:span, body, class: "hidden-#{hide}") end diff --git a/app/views/shared/_answerbox.html.haml b/app/views/shared/_answerbox.html.haml index 6d773ba2..605d8df1 100644 --- a/app/views/shared/_answerbox.html.haml +++ b/app/views/shared/_answerbox.html.haml @@ -23,7 +23,7 @@ %i.fa.fa-exclamation-triangle Report %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 - if a.question.answer_count > 1 ยท