-
-
Notifications
You must be signed in to change notification settings - Fork 251
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
Refactor : change trix field show #3359
base: main
Are you sure you want to change the base?
Conversation
…troller for trix body, add new locales in every language
Code Climate has analyzed commit 5775617 and detected 0 issues on this pull request. View more on Code Climate. |
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.
Hey @Nevelito thank you for this contribution!
I left some comments on specific parts of the code, feel free to continue a conversation on each comment.
Additionally, I noticed that some locale files were generated under the dummy/config/locales
path. Since these won't be used during development, we can remove them to keep the repo clean.
The PR is looking good overall! Let's focus on the tests and on ensuring that always_show
option works as expected. We should also add a test case for always_show
<div data-controller="trix-body"> | ||
<div class="trix-content py-2 max-w-4xl hidden" data-trix-body-target="content"> | ||
<%= sanitize @field.value.to_s %> | ||
</div> | ||
<div class="hidden" data-trix-body-target="moreContentButton"> | ||
<%= link_to t('avo.more_content'), 'javascript:void(0);', class: 'font-bold inline-block pt-3', data: { action: 'click->trix-body#toggleContent' } %> | ||
</div> | ||
<div class="hidden" data-trix-body-target="lessContentButton"> | ||
<%= link_to t('avo.less_content'), 'javascript:void(0);', class: 'font-bold inline-block pt-3', data: { action: 'click->trix-body#toggleContent' } %> | ||
</div> |
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.
@field.always_show
seems to be ignored after these changes.
always_show
is an option for the Trix field, it is documented here https://docs.avohq.io/3.0/fields/trix.html#always_show
We should ensure that setting always_show
to true bypasses the entire show/hide content logic.
click_on "Show content" | ||
|
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.
In all instances where click_on "Show content"
was removed, let's update the test logic to use click_on "More content"
instead.
Since "More content" only appears when there is additional content, we should add extra text to trix_post_body
.
It's essential to keep each test case focused on its original purpose. Here, we only need to add more content, and the test should confirm that the entire content displays correctly after clicking "More content."
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.
the js controller checks if the body has more then one line, so if it is not then More content button will not appear
Description
Fixes # (issue)
#3263
Checklist:
Screenshots & recording