Skip to content

Ship scaffold generator that uses a nice Tailwind design #23

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

Closed
dhh opened this issue Jan 22, 2021 · 14 comments
Closed

Ship scaffold generator that uses a nice Tailwind design #23

dhh opened this issue Jan 22, 2021 · 14 comments

Comments

@dhh
Copy link
Member

dhh commented Jan 22, 2021

The default Rails scaffold is plain to a fault. Let's ship some scaffold templates with this gem that uses Tailwind to demonstrate it.

@gobijan
Copy link

gobijan commented Jan 24, 2021

Okay just to get the discussion started I think we first need to agree on a few things:

  1. Do we want to use table or div under the hood?
    Divs make it easier to adjust to mobile and also for turbo-rails to substitute responses if I remember correctly.
    Tables are more structured and offer some kind of easy to add sortability (for example https://datatables.net or https://www.w3schools.com/w3js/w3js_sort.asp or whatever).

  2. Do we want to show all properties by default or say only the first 4 (or whatever number)?
    If we show all tables might really be the wrong approach given they are a pain on mobile.
    Giving it a thought definition lists might be a feasible approach. Any opinion on that?

  3. What about the actions per item?
    Do we want to show all actions on every item or do we want to make an item clickable and show the edit or delete functionality only on the details page? This would provide less visual clutter.

  4. Do we want to add javascript functionality out of the box?
    Not sure if we want to use dropdowns with additional actions like edit or delete. I would say no but let me know what you think.

  5. Do we have any color preferences?
    Rails uses a lot of red but for example a create item button is in western color usage more of a dangerous thing.

I played around a little and came up with this. It is still not nearly refined but uses definition list under the hood as an idea.
Bildschirmfoto 2021-01-24 um 22 48 13

Tailwind UI gave me the idea of stacked lists BUT how to choose what to show or not, when there are many items?
See screenshot:
Bildschirmfoto 2021-01-24 um 23 00 32

@hahmed
Copy link

hahmed commented Jan 26, 2021

@gobijan maybe worth creating a PR that adds the tailwind scaffold views and the basic styles then the discussion can happen on the PR?

We should be showing all the records by default and perhaps skip the colours in the initial PR (links commonly have blue so that should be good?)

@dixpac
Copy link
Contributor

dixpac commented Feb 4, 2021

@dhh you want this scaffold generator to override default(bin/rails g scaffold), or with the different name such as bin/rails g tailwind_scaffold ...?

@dhh
Copy link
Member Author

dhh commented Feb 4, 2021

I'd like to see it overridden. If you have tailwind installed, you want tailwind scaffolds.

@dixpac
Copy link
Contributor

dixpac commented Feb 5, 2021

Alright! I'm on it 😄

@guledali
Copy link

Would be cool to see a pairing between @adamwathan and @dhh like the one made for Tuple,

https://www.youtube.com/watch?v=SK27unk2UuI&ab_channel=AdamWathan

@dhh Maybe someone should consult Steve Schoger @sschoger on this one as well. He has really good eye for design, he would easily bring the design for rails scaffold to the next level

@dixpac
Copy link
Contributor

dixpac commented Feb 20, 2021

@guledali I've already contacted Adam and Tailwind team to help with this. Adam and the team are 👍🏼 to help shaping scaffold with their touch :)

@guledali
Copy link

I hope this becomes the default in Rails 7

@afomera
Copy link

afomera commented Sep 3, 2021

Is anyone still actively working on this one?

@BakiVernes
Copy link
Contributor

@afomera We are! Check out the PR.

@afomera
Copy link

afomera commented Sep 3, 2021

Great, thanks @BakiVernes! I'll leave it for now :)

@gardnerapp
Copy link

Hello, I am very new to open source I've been looking to create a default scaffolding views for Tailwind for quiet some time and I would like to help work on this project . Where should I get started?

@dhh
Copy link
Member Author

dhh commented Sep 20, 2021

Already done in #71 👍 Just need to find some time to review and I'll merge.

@yshmarov
Copy link
Contributor

@dhh you want this scaffold generator to override default(bin/rails g scaffold), or with the different name such as bin/rails g tailwind_scaffold ...?

if you are using tailwind, but do not want to use the provided tailwind scaffold templates, you can manually set the template engine like this:

# config/application.rb
    config.generators.template_engine = :erb

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants