-
Notifications
You must be signed in to change notification settings - Fork 646
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
Encapsulate PDF generation controller code in a renderer class #812
base: master
Are you sure you want to change the base?
Conversation
- Add ensure block to cleanup files in make_pdf renderer method - Remove prerender_header_and_footer from controller since not used standalone - Remove clean_temp_file action/filter which no longer necessary
Add minitest mocha integration for later versions of Rails
Config will be global so put it in the test helper The html document is particular to WickedPdfTest
Split out the PdfHelper into separate modules to explicit including or prepending depending on prepend support. Using the Renderer class makes this much cleaner. I think this should help fix #810 |
The build is erroring and I don't know what to do about it. Gave it a kick. See error message https://travis-ci.org/mileszs/wicked_pdf/jobs/509342770 |
@adzap I was able to restart all the builds that failed due to the system updates, but 1.8.7 is still failing with:
Thanks for alerting me to it. I haven't stopped by to comment yet on any of your PRs yet, but I want you to know I'm very happy to see this cleanup happen. However, I'd really like to ship a focused fix for the remotipart issue separately if possible, then we can roll these up into the next minor or perhaps major release. If you could help with that, I'd be really grateful, but for now I think I'm just going to try and reverse the changes from #574, which I think should make 1.2 a stable upgrade for 1.1 users. |
@unixmonkey I think that is a great plan. I'll let you get back to getting a stable release out. I'd be very happy to help get a major release out. It think it would help to drop some old Rails versions and old Ruby versions to help clean up the gem quite a bit. Let me know when you want to proceed. I am happy to work on a branch to support this. |
My plans for breaking changes that would warrant a major release (could be one or several), would be to:
New stuff that I'd really like to give attention, but not related to breaking changes (that I know of yet), better support with Webpacker and ActiveStorage configurations. |
Sounds Good. My focus was to initially clean up the code and removing it from base Rails classes as much as possible. This would also include some work on extracting the helper code into a classes to allow it to be worked on more freely. I'm still on Rails 4.5 for my work so my webpacker experience is nil. As for your point 2, the renderer class and the railtie changes to add a format specific renderer block that takes care of the issues with overriding render. You could make it opt in also with a combination of config and an after_initialize block to add it late. So far my PRs are non-breaking of the public API, or could be made so (I can clean up this PR to make it non-breaking with by using a render method override always). So I'm not sure if you are comfortable with merging some of my PRs for a minor release. |
Split out PdfHelper into Includable and Prependable versions Cleanup PdfHelperTest
I'm having some issues with the latest release v1.2.0. In diagnosing I read through the gem code and saw quite a bit of method pollution in the base controller I'd like to get rid of.
I've extracted the controller code from PdfHelper into a renderer class to encapsulate it. This helps remove method pollution and gives more freedom to refactor.
This PR is first of probably a few PRs to help minimise impact on base controller render path.