Skip to content
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

Radius Custom Templates #16

Merged
merged 4 commits into from
Oct 23, 2018
Merged

Radius Custom Templates #16

merged 4 commits into from
Oct 23, 2018

Conversation

sam-kim
Copy link

@sam-kim sam-kim commented Oct 18, 2018

I jumped the gun a bit on this PR - still WIP

Now we can use our Radius custom templates for a scaffolded controller and action views. A project using this will still need to have slim-rails in it's own Gemfile since we are not monkey-patching any generators. However, because of that, we need to tweak and work around the generators behavior.

By default, rails will look for a template, and generate that first one it finds. Since our custom templates are in a gem, rails will find a template (default) in the project and spit it out. We want to check radius-rails first for any templates before going back to the defaults. Those changes are in lib/radius-rails.rb. I found that answer here.

I remember I had an issue with a datetimepicker that wasn't resolved in an early version of 2.0.0 so I bumped the version.

🎉

Now we can use our Radius custom templates for a scaffolded controller
and action views.  A project using this will still need to have
`slim-rails` in it's own Gemfile since we are not monkey-patching any
generators.  However, because of that, we need to work around how the
generators work. By default, rails will look for a template, and
generate that first one it finds.  Since our custom templates are in a
gem, rails will find a template (default) in the project and spit it
out. We want to check `radius-rails` first for any templates before
going back to the defaults.  Those changes are in `lib/radius-rails.rb`.
@sam-kim sam-kim self-assigned this Oct 18, 2018
lib/radius-rails.rb Outdated Show resolved Hide resolved
lib/radius-rails.rb Outdated Show resolved Hide resolved
@sam-kim sam-kim added the wip label Oct 19, 2018
.panel-heading
| My <%= plural_table_name.titleize %>

table.table.table-hover.table-generic
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we need to move the .table-generic and any related styling over too.

lib/templates/slim/scaffold/show.html.slim.tt Outdated Show resolved Hide resolved
@sam-kim sam-kim removed the wip label Oct 23, 2018
@sam-kim
Copy link
Author

sam-kim commented Oct 23, 2018

@cupakromer Okay I think this is ready to merge and has all the basics for controller and view files. We are using singular_table_name elsewhere in the generator, so I opted to go the route of just using @<%= singular_table_name %> instead of the fancy rails 5.2 redirect_resource_name.

@sam-kim sam-kim merged commit e38812b into master Oct 23, 2018
@sam-kim sam-kim deleted the custom-templates branch October 23, 2018 21:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants