avo icon indicating copy to clipboard operation
avo copied to clipboard

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

Open michael-lins opened this issue 2 years ago • 5 comments

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.

michael-lins avatar Jul 28 '23 15:07 michael-lins

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

github-actions[bot] avatar Aug 13 '23 01:08 github-actions[bot]

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.

adrianthedev avatar Aug 14 '23 09:08 adrianthedev

/> 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_show_content 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_show_content: true)
  2. Trix content is always hidden in the form, (always_show_content: false)
  • with a Show content action (current) presented for the user to show all the field's content.
  • _When Show content is clicked, a Hide content action is presented, so the user can hide the Trix field content again.
  1. The show/hide action labels visibility can be based on each other's state over click.

@adrianthedev Please, let me know your thoughts about it

michael-lins avatar Aug 16 '23 19:08 michael-lins

Hey @adrianthedev . Could this issue be assigned to me and i work through it?

zhephyn avatar Oct 16 '24 16:10 zhephyn

Thank you @zhephyn !

Paul-Bob avatar Oct 16 '24 17:10 Paul-Bob

Hey @Paul-Bob . I'm setting up my local environment for development and so far its been going great. However when i navigate to the url "http://localhost:3030/admin/resources/projects" as part of the dummy app, i get the error below. Image Image I can fix the above error however, what I'm inquiring about is that if i were to proceed to fix the error, should i use the same branch for the initial "Trix show/hide content" feature or its better to solve the above error individually with its own branch, after which i can then proceed to implement the "show/hide content" feature? For context, I'm using a windows machine if that helps in anyway. Also, i understand that this could be an issue on just my end, which if that's the case, then i'll just solve it and work through the initial feature i was supposed to implement. Thanks in advance.

zhephyn avatar Oct 23 '24 22:10 zhephyn

Hey @zhephyn

Also, i understand that this could be an issue on just my end, which if that's the case, then i'll just solve it and work through the initial feature i was supposed to implement.

I think that's the case, try starting the server by running bin/dev which will also trigger the necessary builds.

Paul-Bob avatar Oct 24 '24 08:10 Paul-Bob

Hey @Paul-Bob . Is the bin/dev command supposed to be prefixed by the word "ruby" when running it in the terminal as "ruby bin/dev"? I've CD'd into the avo directory and tried running just "bin/dev" in my terminal(git bash), but i get "bin not recognized as a command error". Then when i run the "ruby bin/dev" command, i get a "no ruby script found in input" error. Is this the right way of running the bin/dev command? PS: I'm sorry if these questions seem very basic, its my first time setting up the repository and running into these errors because of the OS i'm running is very frustrating. Thanks in advance.

zhephyn avatar Oct 24 '24 11:10 zhephyn

but i get "bin not recognized as a command error"

Make sure to be on the avo directory and run it like: bin/dev (all together)

Image

I'm sorry if these questions seem very basic

It's ok, no need to apologize

bin/dev it's a script basically

running into these errors because of the OS i'm running is very frustrating.

It might be related with the OS, are you using WSL?

Paul-Bob avatar Oct 24 '24 11:10 Paul-Bob

I'm using git bash and below is what i see in the terminal when i run bin/dev Image

zhephyn avatar Oct 24 '24 12:10 zhephyn

Got it @zhephyn

bin/dev is tring to run overmind start -f Procfile.dev "$@"

They have a note here about the current supported OS

Note: At the moment, Overmind supports Linux, *BSD, and macOS only.

Let's try to run the foreman alternative.

To do that you should edit the bin/dev file and comment L6, L7, L8 and L10: (don't commit it)

#!/usr/bin/env sh

PORT="${PORT:-3030}"
export PORT

# if command -v overmind &> /dev/null; then
#   overmind start -f Procfile.dev "$@"
# else
  foreman start -f Procfile.dev "$@"
# fi

Then you should ensure that foreman is installed by running gem install foreman

After these 2 steps, you should be able to run bin/dev

Let me know how it goes

Paul-Bob avatar Oct 24 '24 12:10 Paul-Bob

Glad to say i've reached some progress. I made the 2 changes you recommended above, then ran the bin/dev command. I got this error in the terminal. Image Then to solve the above error, i changed the first line in the Procfile.dev file from: web: bin/rails server -p 3030 to: web: rails server -p 3030. Screenshot of final code attached below. Image After the above change, running the bin/dev command proceeded as expected for the CSS and JS files. However, towards the end, i ran into an error related to associated with foreman. Image Regardless of this though, i managed to access the projects page of the dummy app in the browser by navigating to localhost:3000, something which was impossible before, showing that the build process was partly successful. Image Now i think it might be okay to proceed with the feature implementation. PS: You mentioned not commiting the previous changes i made when setting up the development environment. Could you elaborate more on this? I'm yet to create a branch for the show/hide content trix feature. Thanks for the help thus far.

zhephyn avatar Oct 24 '24 13:10 zhephyn

After the above change, running the bin/dev command proceeded as expected for the CSS and JS files. However, towards the end, i ran into an error related to associated with foreman.

I think it might be related with the OS again.

Regardless of this though, i managed to access the projects page of the dummy app in the browser by navigating to localhost:3000, something which was impossible before, showing that the build process was partly successful.

Cool!

You mentioned not commiting the previous changes i made when setting up the development environment. Could you elaborate more on this? I'm yet to create a branch for the show/hide content trix feature.

When you create the branch and you start working on the feature don't include this changes on the commit since they're workarounds for your local env

Paul-Bob avatar Oct 24 '24 14:10 Paul-Bob

Hey @Paul-Bob . i worked through this and opened a PR. I'd appreciate any feedback in reference to it. Thanks in advance.

zhephyn avatar Oct 27 '24 00:10 zhephyn

Duplicated issue, closing in favor of https://github.com/avo-hq/avo/issues/3263

Paul-Bob avatar Oct 30 '24 17:10 Paul-Bob