Add collapse to answerboxes and questions
This commit is contained in:
parent
46830f50cd
commit
a3b902b747
|
@ -13,8 +13,11 @@
|
||||||
·
|
·
|
||||||
%a{ href: question_path(a.question.user.screen_name, a.question.id) }
|
%a{ href: question_path(a.question.user.screen_name, a.question.id) }
|
||||||
= t(".answers", count: a.question.answer_count)
|
= t(".answers", count: a.question.answer_count)
|
||||||
.answerbox__question-text
|
.answerbox__question-body{ data: { controller: "collapse" } }
|
||||||
= question_markdown a.question.content
|
.answerbox__question-text{ class: a.question.long? ? "collapsed" : "", data: { collapse_target: "content" } }
|
||||||
|
= question_markdown a.question.content
|
||||||
|
- if a.question.long?
|
||||||
|
= render "shared/collapse", type: "question"
|
||||||
- if user_signed_in?
|
- if user_signed_in?
|
||||||
.flex-shrink-0.ms-auto
|
.flex-shrink-0.ms-auto
|
||||||
.btn-group
|
.btn-group
|
||||||
|
|
|
@ -3,16 +3,11 @@
|
||||||
- if @question.nil?
|
- if @question.nil?
|
||||||
= render "answerbox/header", a: a
|
= render "answerbox/header", a: a
|
||||||
.card-body
|
.card-body
|
||||||
- if display_all.nil?
|
.answerbox__answer-body{ data: { controller: "collapse" } }
|
||||||
.answerbox__answer-text
|
.answerbox__answer-text{ class: a.long? ? "collapsed" : "", data: { collapse_target: "content" } }
|
||||||
= markdown a.content.truncate(640, omission: " [...]", separator: /\s/)
|
|
||||||
- if a.content.length > 640
|
|
||||||
%p
|
|
||||||
%a.btn.btn-primary{ href: answer_path(a.user.screen_name, a.id) }
|
|
||||||
= t(".read")
|
|
||||||
- else
|
|
||||||
.answerbox__answer-text
|
|
||||||
= markdown a.content
|
= markdown a.content
|
||||||
|
- if a.long?
|
||||||
|
= render "shared/collapse", type: "answer"
|
||||||
- if @user.nil?
|
- if @user.nil?
|
||||||
.row
|
.row
|
||||||
.col-sm-6.text-start.text-muted
|
.col-sm-6.text-start.text-muted
|
||||||
|
|
|
@ -14,7 +14,11 @@
|
||||||
·
|
·
|
||||||
%a{ href: question_path(i.question.user.screen_name, i.question.id) }
|
%a{ href: question_path(i.question.user.screen_name, i.question.id) }
|
||||||
= t(".answers", count: i.question.answer_count)
|
= t(".answers", count: i.question.answer_count)
|
||||||
.answerbox__question-text= question_markdown i.question.content
|
.answerbox__question-body{ data: { controller: "collapse" } }
|
||||||
|
.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)
|
- if i.question.user_id != current_user.id || current_user.has_cached_role?(:administrator)
|
||||||
.flex-shrink-0.ms-auto
|
.flex-shrink-0.ms-auto
|
||||||
.btn-group
|
.btn-group
|
||||||
|
|
|
@ -13,7 +13,11 @@
|
||||||
= user_screen_name question.user, author_identifier: identifier, url: false
|
= user_screen_name question.user, author_identifier: identifier, url: false
|
||||||
- else
|
- else
|
||||||
= t("answerbox.header.asked_html", user: user_screen_name(question.user, author_identifier: identifier), time: time_tooltip(question))
|
= t("answerbox.header.asked_html", user: user_screen_name(question.user, author_identifier: identifier), time: time_tooltip(question))
|
||||||
.answerbox__question-text= question_markdown question.content
|
.answerbox__question-body{ data: { controller: "collapse" } }
|
||||||
|
.answerbox__question-text{ class: question.long? ? "collapsed" : "", data: { collapse_target: "content" } }
|
||||||
|
= question_markdown question.content
|
||||||
|
- if question.long?
|
||||||
|
= render "shared/collapse", type: "question"
|
||||||
- if user_signed_in?
|
- if user_signed_in?
|
||||||
.flex-shrink-0.ms-auto
|
.flex-shrink-0.ms-auto
|
||||||
.btn-group
|
.btn-group
|
||||||
|
|
Loading…
Reference in New Issue