2020-05-10 05:22:33 -07:00
|
|
|
- display_all ||= nil
|
2023-03-05 08:17:02 -08:00
|
|
|
.card.answerbox{ data: { id: a.id, q_id: a.question.id, navigation_target: "traversable" } }
|
2020-04-26 08:13:31 -07:00
|
|
|
- if @question.nil?
|
2023-01-12 09:44:49 -08:00
|
|
|
= render "answerbox/header", a: a, display_all: display_all
|
2020-04-26 08:13:31 -07:00
|
|
|
.card-body
|
2023-01-15 04:26:25 -08:00
|
|
|
.answerbox__answer-body{ data: { controller: a.long? ? "collapse" : nil } }
|
2023-01-12 09:44:49 -08:00
|
|
|
.answerbox__answer-text{ class: a.long? && !display_all ? "collapsed" : "", data: { collapse_target: "content" } }
|
2020-04-26 08:13:31 -07:00
|
|
|
= markdown a.content
|
2023-01-12 09:44:49 -08:00
|
|
|
- if a.long? && !display_all
|
2023-01-12 09:27:30 -08:00
|
|
|
= render "shared/collapse", type: "answer"
|
2020-04-26 08:13:31 -07:00
|
|
|
- if @user.nil?
|
|
|
|
.row
|
2023-01-04 03:43:19 -08:00
|
|
|
.col-sm-6.text-start.text-muted
|
2023-01-04 07:12:43 -08:00
|
|
|
.d-flex
|
|
|
|
.flex-shrink-0
|
2022-07-23 03:06:05 -07:00
|
|
|
%a{ href: user_path(a.user) }
|
2023-10-20 02:45:53 -07:00
|
|
|
= render AvatarComponent.new(user: a.user, size: "sm", classes: ["answerbox__answer-user-avatar"])
|
2023-01-04 07:12:43 -08:00
|
|
|
.flex-grow-1
|
|
|
|
%h6.answerbox__answer-user
|
2022-07-30 13:47:18 -07:00
|
|
|
= raw t(".answered", hide: hidespan(t(".hide"), "d-none d-sm-inline"), user: user_screen_name(a.user))
|
2020-05-02 11:35:28 -07:00
|
|
|
.answerbox__answer-date
|
2023-03-05 09:50:27 -08:00
|
|
|
= link_to(raw(t("time.distance_ago", time: time_tooltip(a))), answer_path(a.user.screen_name, a.id), data: { selection_hotkey: "l" })
|
2021-08-05 16:09:28 -07:00
|
|
|
.col-md-6.d-flex.d-md-block.answerbox__actions
|
2023-04-11 02:06:34 -07:00
|
|
|
= render "answerbox/actions", a:, display_all:, subscribed_answer_ids:
|
2020-04-26 08:13:31 -07:00
|
|
|
- else
|
|
|
|
.row
|
2023-01-04 03:43:19 -08:00
|
|
|
.col-md-6.text-start.text-muted
|
2020-04-26 08:13:31 -07:00
|
|
|
%i.fa.fa-clock-o
|
2022-07-30 13:47:18 -07:00
|
|
|
= link_to(raw(t("time.distance_ago", time: time_tooltip(a))), answer_path(a.user.screen_name, a.id), class: "answerbox__permalink")
|
2023-02-07 14:20:47 -08:00
|
|
|
- if a.pinned_at.present?
|
2023-02-07 14:12:13 -08:00
|
|
|
%span.answerbox__pinned
|
|
|
|
·
|
|
|
|
%i.fa.fa-thumbtack
|
|
|
|
= t(".pinned")
|
2021-08-05 16:09:28 -07:00
|
|
|
.col-md-6.d-md-flex.answerbox__actions
|
2023-02-16 15:35:03 -08:00
|
|
|
= render "answerbox/actions", a:, display_all:, subscribed_answer_ids:
|
2022-07-30 13:47:18 -07:00
|
|
|
.card-footer{ id: "ab-comments-section-#{a.id}", class: display_all.nil? ? "d-none" : nil }
|
2023-09-13 15:21:59 -07:00
|
|
|
= turbo_frame_tag("ab-reactions-list-#{a.id}", src: reactions_path(a.question, a), loading: :lazy) do
|
|
|
|
.d-flex.smiles
|
|
|
|
.flex-shrink-0.me-1
|
|
|
|
%i.fa.fa-smile-o
|
2023-03-11 10:48:04 -08:00
|
|
|
= turbo_frame_tag("ab-comments-list-#{a.id}", src: comments_path(a.question, a), loading: :lazy) do
|
|
|
|
.d-flex.justify-content-center
|
|
|
|
.spinner-border{ role: :status }
|
|
|
|
.visually-hidden= t("voc.loading")
|
|
|
|
- if user_signed_in?
|
|
|
|
%button.d-none{ name: "ab-open-and-comment", data: { a_id: a.id, selection_hotkey: "c" } }
|
|
|
|
.comment__compose-wrapper{
|
|
|
|
name: "ab-comment-new-group",
|
|
|
|
data: { a_id: a.id, controller: "character-count", character_count_max_value: 512 }
|
|
|
|
}
|
|
|
|
.form-group.has-feedback.comment__input-group.input-group
|
|
|
|
%textarea.form-control.comment__input{ type: :text, placeholder: t(".comments.placeholder"), name: "ab-comment-new", data: { a_id: a.id, "character-count-target": "input" } }
|
|
|
|
.comment__submit-wrapper
|
|
|
|
%button.btn.btn-primary{
|
|
|
|
type: :button,
|
|
|
|
name: "ab-comment-new-submit",
|
|
|
|
title: t(".comments.action"),
|
|
|
|
data: { a_id: a.id, "character-count-target": "action" }
|
|
|
|
}
|
|
|
|
%i.fa.fa-paper-plane-o
|
|
|
|
%span.text-muted.form-control-feedback.comment__character-count{ id: "ab-comment-charcount-#{a.id}", data: { "character-count-target": "counter" } } 512
|