answerbox: use ActiveSupport's String#truncate

this change cuts off the answer after a word and not within one.
This commit is contained in:
Georg Gadinger 2022-08-19 16:33:28 +02:00
parent 455e478e45
commit 8f86f8bc96
1 changed files with 1 additions and 2 deletions

View File

@ -5,9 +5,8 @@
.card-body .card-body
- if display_all.nil? - if display_all.nil?
.answerbox__answer-text .answerbox__answer-text
= markdown a.content[0..640] = markdown a.content.truncate(640, omission: " [...]", separator: /\s/)
- if a.content.length > 640 - if a.content.length > 640
[...]
%p %p
%a.btn.btn-primary{ href: answer_path(a.user.screen_name, a.id) } %a.btn.btn-primary{ href: answer_path(a.user.screen_name, a.id) }
= t(".read") = t(".read")