-
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
Changes from all commits
7f46b53
7139052
e8f708f
f337879
e083bb2
f182055
4833a5e
8381219
1dd1dfb
939845b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,7 @@ | ||
| PATH | ||
| remote: . | ||
| specs: | ||
| rolemodel_rails (0.22.0) | ||
| rolemodel_rails (0.23.0) | ||
|
|
||
| GEM | ||
| remote: https://rubygems.org/ | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| - content_for :title, "Editing <%= human_name.downcase %>" | ||
|
|
||
| nav.breadcrumbs.breadcrumbs--large.margin-y-md | ||
| = link_to "<%= human_name.pluralize %>", <%= index_helper(type: :path) %>, class: "breadcrumbs__link" | ||
| .breadcrumbs__separator = icon('chevron_right') | ||
| = link_to "<%= human_name.pluralize %>", <%= model_resource_name(prefix: "@") %>, class: "breadcrumbs__link" | ||
| .breadcrumbs__separator = icon('chevron_right') | ||
| span.breadcrumbs__text Editing <%= human_name.downcase %> | ||
|
|
||
| .card | ||
| .card__header | ||
| h1 Editing <%= human_name.downcase %> | ||
| .divider | ||
| .card__body | ||
| = render "form", <%= singular_table_name %>: @<%= singular_table_name %> | ||
justwiebe marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| - content_for :title, "<%= human_name.pluralize %>" | ||
|
|
||
| header.content-header | ||
| .content-header__details | ||
| h1.content-header__title <%= human_name.pluralize %> | ||
|
|
||
| .content-header__aside | ||
| = link_to <%= new_helper(type: :path) %>, class: 'btn btn--primary' do | ||
| = icon('add') | ||
| | New <%= human_name.downcase %> | ||
|
|
||
| .flex.flex-col.gap-md#<%= plural_table_name %> | ||
| = render @<%= plural_table_name %> | ||
justwiebe marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| - content_for :title, "New <%= human_name.downcase %>" | ||
|
|
||
| nav.breadcrumbs.breadcrumbs--large.margin-y-md | ||
| = link_to "<%= human_name.pluralize %>", <%= index_helper(type: :path) %>, class: "breadcrumbs__link" | ||
| .breadcrumbs__separator = icon('chevron_right') | ||
| span.breadcrumbs__text New <%= human_name.downcase %> | ||
|
|
||
| .card | ||
| .card__header | ||
| h1 New <%= human_name.downcase %> | ||
| .divider | ||
| .card__body | ||
| = render "form", <%= singular_table_name %>: @<%= singular_table_name %> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| -# locals: (<%= singular_table_name %>:) | ||
|
|
||
| .card.card--padded id=dom_id(<%= singular_name %>) | ||
| .flex.items-center.justify-between | ||
| .text-pair | ||
| span.text-pair__title = <%= singular_table_name %>.name | ||
|
|
||
| = link_to <%= singular_name %>, class: "btn btn--small btn--icon btn--pill btn--no-border" do | ||
| = icon('chevron_right') | ||
| span.sr-only View <%= human_name.downcase %> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| nav.breadcrumbs.breadcrumbs--large.margin-y-md | ||
| = link_to "<%= human_name.pluralize %>", <%= index_helper(type: :path) %>, class: "breadcrumbs__link" | ||
| .breadcrumbs__separator = icon('chevron_right') | ||
| span.breadcrumbs__text = @<%= singular_table_name %>.name | ||
|
|
||
| header.content-header | ||
| .content-header__details | ||
| h1.content-header__title = @<%= singular_table_name %>.name | ||
|
|
||
| .content-header__aside | ||
| = link_to <%= edit_helper(type: :path) %>, class: 'btn btn--icon' do | ||
| = icon('edit') | ||
| span.sr-only Edit <%= human_name.downcase %> | ||
|
|
||
| = button_to @<%= singular_table_name %>, form: { data: { turbo_confirm: 'Are you sure?' } }, class: "btn btn--destructive btn--icon", method: :delete do | ||
| = icon('delete') | ||
| span.sr-only Destroy this <%= human_name.downcase %> | ||
Jeremy-Walton marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| .flex.flex-col.gap-md | ||
| <% attributes.reject(&:password_digest?).each do |attribute| -%> | ||
| .text-pair.text-pair--inline | ||
| span.text-pair__title <%= attribute.human_name %>: | ||
| span.text-pair__subtitle | ||
| <% if attribute.attachment? -%> | ||
| = link_to @<%= singular_name %>.<%= attribute.column_name %>.filename, <%= singular_name %>.<%= attribute.column_name %> if <%= singular_name %>.<%= attribute.column_name %>.attached? | ||
| <% elsif attribute.attachments? -%> | ||
| <%% @<%= singular_name %>.<%= attribute.column_name %>.each do |<%= attribute.singular_name %>| %> | ||
| div = link_to <%= attribute.singular_name %>.filename, <%= attribute.singular_name %> | ||
| <%% end %> | ||
| <% else -%> | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. |
||
| = @<%= singular_name %>.<%= attribute.column_name %> | ||
| <% end -%> | ||
| <% end -%> | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,5 @@ | ||
| # frozen_string_literal: true | ||
|
|
||
| module RolemodelRails | ||
| VERSION = '0.22.0' | ||
| VERSION = '0.23.0' | ||
| end |
Uh oh!
There was an error while loading. Please reload this page.