Don't set the collapse controller for entries that aren't long

This commit is contained in:
Andreas Nedbal 2023-01-15 13:26:25 +01:00 committed by Andreas Nedbal
parent eae99cd9a5
commit d4c2ca5e5e
4 changed files with 4 additions and 4 deletions

View File

@ -13,7 +13,7 @@
· ·
%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-body{ data: { controller: "collapse" } } .answerbox__question-body{ data: { controller: a.question.long? ? "collapse" : nil } }
.answerbox__question-text{ class: a.question.long? && !display_all ? "collapsed" : "", data: { collapse_target: "content" } } .answerbox__question-text{ class: a.question.long? && !display_all ? "collapsed" : "", data: { collapse_target: "content" } }
= question_markdown a.question.content = question_markdown a.question.content
- if a.question.long? && !display_all - if a.question.long? && !display_all

View File

@ -3,7 +3,7 @@
- if @question.nil? - if @question.nil?
= render "answerbox/header", a: a, display_all: display_all = render "answerbox/header", a: a, display_all: display_all
.card-body .card-body
.answerbox__answer-body{ data: { controller: "collapse" } } .answerbox__answer-body{ data: { controller: a.long? ? "collapse" : nil } }
.answerbox__answer-text{ class: a.long? && !display_all ? "collapsed" : "", data: { collapse_target: "content" } } .answerbox__answer-text{ class: a.long? && !display_all ? "collapsed" : "", data: { collapse_target: "content" } }
= markdown a.content = markdown a.content
- if a.long? && !display_all - if a.long? && !display_all

View File

@ -14,7 +14,7 @@
· ·
%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-body{ data: { controller: "collapse" } } .answerbox__question-body{ data: { controller: i.question.long? ? "collapse" : nil } }
.answerbox__question-text{ class: i.question.long? ? "collapsed" : "", data: { collapse_target: "content" } } .answerbox__question-text{ class: i.question.long? ? "collapsed" : "", data: { collapse_target: "content" } }
= question_markdown i.question.content = question_markdown i.question.content
- if i.question.long? - if i.question.long?

View File

@ -13,7 +13,7 @@
= 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-body{ data: { controller: "collapse" } } .answerbox__question-body{ data: { controller: question.long? ? "collapse" : nil } }
.answerbox__question-text{ class: question.long? ? "collapsed" : "", data: { collapse_target: "content" } } .answerbox__question-text{ class: question.long? ? "collapsed" : "", data: { collapse_target: "content" } }
= question_markdown question.content = question_markdown question.content
- if question.long? - if question.long?