Replace question markup with `QuestionComponent`
This commit is contained in:
parent
36b13c5366
commit
e6bd19790a
|
@ -1,7 +1,8 @@
|
|||
- display_all ||= nil
|
||||
.card.answerbox{ data: { id: a.id, q_id: a.question.id, navigation_target: "traversable" } }
|
||||
- if @question.nil?
|
||||
= render "answerbox/header", a: a, display_all: display_all
|
||||
.card-header
|
||||
= render QuestionComponent.new(question: a.question, context_user: a.user, collapse: !display_all)
|
||||
.card-body
|
||||
.answerbox__answer-body{ data: { controller: a.long? ? "collapse" : nil } }
|
||||
.answerbox__answer-text{ class: a.long? && !display_all ? "collapsed" : "", data: { collapse_target: "content" } }
|
||||
|
|
|
@ -1,30 +1,6 @@
|
|||
.card.inbox-entry{ id: "inbox_#{i.id}", class: i.new? ? "inbox-entry--new" : "", data: { id: i.id } }
|
||||
.card-header
|
||||
.d-flex
|
||||
- unless i.question.author_is_anonymous
|
||||
.flex-shrink-0
|
||||
%a.pull-left{ href: user_path(i.question.user) }
|
||||
= render AvatarComponent.new(user: i.question.user, size: "md", classes: ["answerbox__question-user-avatar"])
|
||||
.flex-grow-1
|
||||
%h6.text-muted.answerbox__question-user
|
||||
- if i.question.author_is_anonymous
|
||||
%i.fas.fa-user-secret{ title: t('.anon_hint') }
|
||||
= t(".asked_html", user: user_screen_name(i.question.user, context_user: i.user, author_identifier: i.question.author_is_anonymous ? i.question.author_identifier : nil), time: time_tooltip(i.question))
|
||||
- if !i.question.author_is_anonymous && i.question.answer_count.positive?
|
||||
·
|
||||
%a{ href: question_path(i.question.user.screen_name, i.question.id) }
|
||||
= t(".answers", count: i.question.answer_count)
|
||||
.answerbox__question-body{ data: { controller: i.question.long? ? "collapse" : nil } }
|
||||
.answerbox__question-text{ class: i.question.long? ? "collapsed" : "", data: { collapse_target: "content" } }
|
||||
= question_markdown i.question.content
|
||||
- if i.question.long?
|
||||
= render "shared/collapse", type: "question"
|
||||
- if i.question.user_id != current_user.id || current_user.has_cached_role?(:administrator)
|
||||
.flex-shrink-0.ms-auto
|
||||
.btn-group
|
||||
%button.btn.btn-default.btn-sm.dropdown-toggle{ data: { bs_toggle: :dropdown }, aria: { expanded: false } }
|
||||
%span.caret
|
||||
= render "actions/question", question: i.question
|
||||
= render QuestionComponent.new(question: i.question, context_user: i.user)
|
||||
- if current_user == i.user
|
||||
.card-body
|
||||
%textarea.form-control.mb-3{ name: "ib-answer", placeholder: t(".placeholder"), data: { id: i.id } }
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
- provide(:title, question_title(@question))
|
||||
= render "question", question: @question, hidden: false
|
||||
= render "question", question: @question, hidden: true
|
||||
.card.question--sticky
|
||||
.container
|
||||
.card-body
|
||||
= render QuestionComponent.new(question: @question)
|
||||
.container.question-page
|
||||
#answers{ data: { controller: "navigation" } }
|
||||
%button.d-none{ data: { hotkey: "j", action: "navigation#down" } }
|
||||
|
|
|
@ -1,30 +1,4 @@
|
|||
- type ||= nil
|
||||
.card.questionbox{ data: { id: q.id } }
|
||||
.card-body{ data: { controller: q.long? ? "collapse" : nil } }
|
||||
.d-flex
|
||||
- if type == "discover"
|
||||
.flex-shrink-0
|
||||
%a{ href: user_screen_name(q.user, link_only: true) }
|
||||
= render AvatarComponent.new(user: q.user, size: "md", classes: ["me-2"])
|
||||
.flex-grow-1
|
||||
%h6.text-muted.answerbox__question-user
|
||||
- if type.nil? && q.direct
|
||||
- if user_signed_in? && q.user == current_user
|
||||
%i.fa.fa-eye-slash{ data: { bs_toggle: "tooltip", bs_title: t(".visible_to_you") } }
|
||||
- elsif moderation_view?
|
||||
%i.fa.fa-eye-slash{ data: { bs_toggle: "tooltip", bs_title: t(".visible_mod_mode") } }
|
||||
= t("answerbox.header.asked_html", user: user_screen_name(q.user), time: time_tooltip(q))
|
||||
- if q.answer_count > 1
|
||||
·
|
||||
%a{ href: question_path(q.user.screen_name, q.id) }
|
||||
= pluralize(q.answer_count, t("voc.answer"))
|
||||
.answerbox__question-text{ class: q.long? ? "collapsed" : "", data: { collapse_target: "content" } }
|
||||
= question_markdown q.content
|
||||
- if q.long?
|
||||
= render "shared/collapse", type: "question"
|
||||
- if user_signed_in?
|
||||
.flex-shrink-0.ms-auto
|
||||
.btn-group
|
||||
%button.btn.btn-link.btn-sm.dropdown-toggle{ data: { bs_toggle: :dropdown }, aria: { expanded: false } }
|
||||
%span.caret
|
||||
= render "actions/question", question: q
|
||||
= render QuestionComponent.new(question: q, hide_avatar: type == "discover" ? false : true, profile_question: true)
|
||||
|
|
Loading…
Reference in New Issue