From 74bbbdf4ca71b7253e5c077d896543c5bcdffaad Mon Sep 17 00:00:00 2001 From: Yuki Date: Wed, 27 May 2015 06:41:21 +0530 Subject: [PATCH] FILTHY --- app/helpers/application_helper.rb | 10 +++++++++- app/views/shared/_answerbox.html.haml | 2 +- 2 files changed, 10 insertions(+), 2 deletions(-) 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 ยท