diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 74fe977f..56f90b2d 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -43,10 +43,10 @@ module ApplicationHelper 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)}) + def time_tooltip(subject, placement = "bottom") + t = tooltip time_ago_in_words(subject.created_at), localize(subject.created_at), placement + unless subject.user.nil? or (subject.respond_to?(:author_is_anonymous) and subject.author_is_anonymous) + t = content_tag(:a, t, {href: show_user_question_path(subject.user.screen_name, subject.id)}) end t end diff --git a/app/views/shared/_answerbox.html.haml b/app/views/shared/_answerbox.html.haml index 605d8df1..880d42d3 100644 --- a/app/views/shared/_answerbox.html.haml +++ b/app/views/shared/_answerbox.html.haml @@ -54,14 +54,14 @@ %h6.media-heading.answerbox--answer-user = raw t('views.answerbox.answered', hide: hidespan(t('views.answerbox.hide'), "xs"), user: user_screen_name(a.user)) .answerbox--answer-date - = link_to((raw t('views.answerbox.time', time: tooltip(time_ago_in_words(a.created_at), a.created_at, "bottom"))), show_user_answer_path(a.user.screen_name, a.id)) + = link_to(raw(t('views.answerbox.time', time: time_tooltip(a)))) .col-md-6.col-sm-8.col-xs-6.text-right = render 'shared/answerbox_buttons', a: a - else .row .col-md-6.col-sm-4.col-xs-6.text-left.text-muted %i.fa.fa-clock-o - = link_to((raw t('views.answerbox.time', time: tooltip(time_ago_in_words(a.created_at), a.created_at, "bottom"))), show_user_answer_path(a.user.screen_name, a.id)) + = link_to(raw(t('views.answerbox.time', time: time_tooltip(a)))) .col-md-6.col-sm-8.col-xs-6.text-right = render 'shared/answerbox_buttons', a: a .panel-footer{id: "ab-comments-section-#{a.id}", style: @display_all.nil? ? 'display: none' : nil }