-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix feedback comments not being expandable #1506
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot! 👍
This fixes the issue, however I think there might be a more efficient solution...
Also, could you add a note to the changelog?
I also noticed that the feedback text only gets collapsed when it has more than one line or when it has more than 20 words. I don't know if this is a problem in practice, but a text with few but long words would break the layout
Good point, maybe it makes sense to include this block as last elif
case before printing the whole comment?
{% elif feedback.comment|length > 120 %}
<span>
{{ feedback.comment|truncatechars:120 }} <i data-feather="chevron-down"
class="toggle-feedback-comment transform cursor-pointer hover:scale-125"></i>
</span>
<span class="hidden">
{{ feedback.comment }} <i data-feather="chevron-up"
class="toggle-feedback-comment transform cursor-pointer hover:scale-125"></i>
</span>
{% else %}
{{ feedback.comment }}
{% endif %}
integreat_cms/static/src/js/feedback/toggle-feedback-comments.ts
Outdated
Show resolved
Hide resolved
04062c6
to
03eec1e
Compare
I have now removed the call to |
03eec1e
to
22c5f69
Compare
Code Climate has analyzed commit e59330c and detected 0 issues on this pull request. The test coverage on the diff in this pull request is 100.0% (50% is the threshold). This pull request will bring the total coverage in the repository to 73.9% (0.0% change). View more on Code Climate. |
22c5f69
to
1c078e8
Compare
@david-venhoff I think my initial solution with truncating the feedback in the django template doesn't work well for all edge cases (e.g. comments with multiple lines that contain very long words or less than 20 words but very long ones etc.), so I tried to do the truncation in css + js... |
c6913c2
to
a6a7837
Compare
Looks good to me. 👍 |
Co-authored-by: David Venhoff <venhoff@integreat-app.de>
a6a7837
to
e59330c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎉
Short description
This pr fixes a bug where feedback comments were not expandable in some cases. This bug existed because the responsible event handlers were (depending on page load order) set up on the
<i>
elements, which got later replaced by<svg>
elements.Proposed changes
Resolved issues
Fixes: #1503
I also noticed that the feedback text only gets collapsed when it has more than one line or when it has more than 20 words.
I don't know if this is a problem in practice, but a text with few but long words would break the layout: