-
-
Notifications
You must be signed in to change notification settings - Fork 445
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
Add Optional Signature Lines to Distribution PDF #4342
base: main
Are you sure you want to change the base?
Add Optional Signature Lines to Distribution PDF #4342
Conversation
@@ -14,7 +14,6 @@ | |||
let(:hashed_id) { CGI.escape(crypt.encrypt_and_sign(organization.id)) } | |||
before(:each) do | |||
allow(Rails.application).to receive(:secret_key_base).and_return(secret_key) | |||
allow(DistributionPdf).to receive(:new).and_return(double("DistributionPdf", compute_and_render: "PDF")) |
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 assume this was being mocked to save time/resources? Locally I'm not seeing a significant difference in how long this test file takes to run with or without it. I think it might make more sense to add this mocking to the contexts that actually need the mock rather than just doing it at the top level here? But then again I'm trying to prove that my new feature doesn't cause the pdf to blow up and the only way to do that is to actually render it, but maybe that's less important? Happy to revert this if that makes more sense.
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.
If everything works and it doesn't slow it down noticeably, it's fine to unstub it.
@@ -0,0 +1,11 @@ | |||
class AddSignatureFieldsFlagToOrganizations < ActiveRecord::Migration[7.0] | |||
def up | |||
add_column :organizations, :include_signature_fields_on_distribution_printout, :boolean |
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.
Can we make this a bit less wordy? Maybe signature_for_distribution_pdf
?
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.
surely, naming things is always a pain so I tend to default to extra verbose
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've gone ahead and made this change.
@@ -14,7 +14,6 @@ | |||
let(:hashed_id) { CGI.escape(crypt.encrypt_and_sign(organization.id)) } | |||
before(:each) do | |||
allow(Rails.application).to receive(:secret_key_base).and_return(secret_key) | |||
allow(DistributionPdf).to receive(:new).and_return(double("DistributionPdf", compute_and_render: "PDF")) |
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.
If everything works and it doesn't slow it down noticeably, it's fine to unstub it.
2bf7c68
to
338e344
Compare
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.
LGTM. @cielf did you want to check it over?
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.
The actual functionality works like a dream.
I'm afraid I have a wee nit-pick though: Can we please refer to them as "signature lines" instead of "signature fields" throughout? Calling them fields implies that it's something they can fill in on-line.
Thank you
Adds the migration and factory updates with the new boolean flag
35f44e8
to
ee10266
Compare
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.
Alas I spoke too soon -- I didnt initially test the border case where the signatures could potentially span pages. They shouldn't, though.
Sample Distribution pdf.pdf
Ah that makes sense. I'll dig into prawn to see if there's a way to ensure this doesn't happen. |
@cielf I've gone ahead and addressed the edge case. Here's the results: |
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.
Very nearly there, but it would be good if the signature lines cleared the "Lovingly created" at the bottom in all cases.
Pawnee Pregnancy Center 2024-05-08.pdf
The failing tests are unrelated. I'm pretty sure they've been fixed on main.
- need to account for the footer
@cielf This should be ready to test again, I've adjusted the margin so it now accounts for the footer |
Resolves #4312
Description
Some organizations want to include signature fields on their distribution pdf printouts. We want to make this optional for organizations to toggle this setting on or off on their own so they don't have to use comments as a work around.
Type of change
How Has This Been Tested?
Screenshots
Organization show view
Organization edit view
PDF with Signature fields included