-
Notifications
You must be signed in to change notification settings - Fork 0
Add Scaffold Templates #168
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
Conversation
OutlawAndy
left a comment
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.
This is great, @Jeremy-Walton! Thanks!
I think it would be worthwhile to add a bit of documentation to the slim generator explaining where to find the scaffold templates so they can be customized to your applications designs.
lib/generators/rolemodel/slim/templates/lib/templates/slim/scaffold/edit.html.slim.tt
Show resolved
Hide resolved
lib/generators/rolemodel/slim/templates/lib/templates/slim/scaffold/index.html.slim.tt
Show resolved
Hide resolved
lib/generators/rolemodel/slim/templates/lib/templates/slim/scaffold/show.html.slim.tt
Show resolved
Hide resolved
| <%% @<%= singular_name %>.<%= attribute.column_name %>.each do |<%= attribute.singular_name %>| %> | ||
| div = link_to <%= attribute.singular_name %>.filename, <%= attribute.singular_name %> | ||
| <%% end %> | ||
| <% else -%> |
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.
It would be nice to take rich text into account here and in the form
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.
I just copied the default rails scaffold and adapted to slim. https://github.com/rails/rails/blob/main/railties/lib/rails/generators/erb/scaffold/templates/partial.html.erb.tt
Could be a future improvement
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.
My expectation is that every project is going to want to customize these templates immediately. But also that over time with lots of use, we'll find commonality to upstream.
Why?
When using the rails scaffolding commands, it would be nice to auto generate templates already set up to use slim and Optics.
What Changed
rolemodel:ui_components:allcommandrolemodel:allcommandPre-merge checklist
lib/rolemodel_rails/version.rbVideo Demo