avo-hq / avo

Build Ruby on Rails apps 10x faster
https://avohq.io
Other
1.51k stars 239 forks source link

Display an action to hide Trix field content in index/show pages (as opposed to the existing show content) #1871

Open michael-lins opened 1 year ago

michael-lins commented 1 year ago

Feature

I would like to suggest an action to hide Trix field content in index/show pages as opposed to the existing show content.

Current workarounds

I understand this is currently achievable by adding custom code to the project's implementations in isolation, but it would be interesting to have this as a built-in feature activated by code customization on avo resources.

Screenshots or screen recordings

Example of existing Show Content of Trix fields on index/show pages

Example of existing Show Content of Trix fields on index/show pages

Example of the suggested action in place to hide Trix content

Example of the suggested action in place to hide Trix content

Additional context

No, I just imagined it would be useful as I got a very huge content to visualize on the example page.

github-actions[bot] commented 1 year ago

This issue has been marked as stale because there was no activity for the past 15 days.

adrianthedev commented 1 year ago

Yeah, I think That's a good idea! I see it as a field option always_show_content: true which defaults to false. What do you think? I would also remove the "hide content" button because you'd want to always see it. It doesn't really makes sense to hide it everytime you reload the page.

Would you be able to submit a PR for it?

PS: Apologies for the late reply. We've been pretty busy with the v3 launch.

michael-lins commented 1 year ago

/> I see it as a field option always_show_content: true which defaults to false. What do you think?

I agree, Adrian, that should work to make it shown on every page reload.

I would also remove the "hide content" button because you'd want to always see it.

Now, for the scenario in which we have _always_showcontent set to false, we would still have the Show content in place. I would suggest adding the Hide content for an "instant clean up" of the entire form view, where the user can switch on and off to better visualise data underneath the Trix field, without the need to reload the page (current behaviour).

Would you be able to submit a PR for it?

I certainly would! I just need to study the code a bit, but that's my goal here. Any heads-up on how to go over the code is more than welcome, although I know the v3 is coming soon 👀

In summary

We would have two scenarios:

  1. Trix content is always shown in the form, without the possibility to hide it. (_always_showcontent: true)
  2. Trix content is always hidden in the form, (_always_showcontent: false)

@adrianthedev Please, let me know your thoughts about it