From d4c2ca5e5ed5dfba5fa4465f74a53af65d33e945 Mon Sep 17 00:00:00 2001 From: Andreas Nedbal Date: Sun, 15 Jan 2023 13:26:25 +0100 Subject: [PATCH] Don't set the collapse controller for entries that aren't long --- app/views/answerbox/_header.html.haml | 2 +- app/views/application/_answerbox.html.haml | 2 +- app/views/inbox/_entry.html.haml | 2 +- app/views/question/_question.html.haml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/views/answerbox/_header.html.haml b/app/views/answerbox/_header.html.haml index b9831611..5e60c114 100644 --- a/app/views/answerbox/_header.html.haml +++ b/app/views/answerbox/_header.html.haml @@ -13,7 +13,7 @@ · %a{ href: question_path(a.question.user.screen_name, a.question.id) } = 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" } } = question_markdown a.question.content - if a.question.long? && !display_all diff --git a/app/views/application/_answerbox.html.haml b/app/views/application/_answerbox.html.haml index fc37071d..fe27f953 100644 --- a/app/views/application/_answerbox.html.haml +++ b/app/views/application/_answerbox.html.haml @@ -3,7 +3,7 @@ - if @question.nil? = render "answerbox/header", a: a, display_all: display_all .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" } } = markdown a.content - if a.long? && !display_all diff --git a/app/views/inbox/_entry.html.haml b/app/views/inbox/_entry.html.haml index fb9aaf3c..e761af4f 100644 --- a/app/views/inbox/_entry.html.haml +++ b/app/views/inbox/_entry.html.haml @@ -14,7 +14,7 @@ · %a{ href: question_path(i.question.user.screen_name, i.question.id) } = 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" } } = question_markdown i.question.content - if i.question.long? diff --git a/app/views/question/_question.html.haml b/app/views/question/_question.html.haml index 44060561..1128bb5f 100644 --- a/app/views/question/_question.html.haml +++ b/app/views/question/_question.html.haml @@ -13,7 +13,7 @@ = user_screen_name question.user, author_identifier: identifier, url: false - else = 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" } } = question_markdown question.content - if question.long?