-
Notifications
You must be signed in to change notification settings - Fork 154
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
Signup bcpage #2937
Signup bcpage #2937
Conversation
help_text='Choose an existing, or create a new, sign-up form' | ||
) | ||
|
||
panel_count = len(PrimaryPage.content_panels) |
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.
"put things in between other panels" - this adds the signup option between the existing cta option, and the body field.
@api_view(['POST']) | ||
@parser_classes((JSONParser,)) | ||
@permission_classes((permissions.AllowAny,)) | ||
def signup_submission_view(request, pk): |
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 essentially a duplication of the petition code, but I wanted to keep the route view "its own thing" instead of making both signup and petition go to the same def and have its code unravel the actual url things came in on, which would make things far harder to read.
to be clear, @alanmoo @cadecairos this needs review, despite styling not being done. |
test page with both CTA and signup component: https://foundation-mofostaging-pr-2937.herokuapp.com/en/signup-test-page/ |
@@ -23,3 +23,45 @@ | |||
</div> | |||
</div> | |||
{% endblock %} | |||
|
|||
The following block has been borrowed from the templates/tags/cta/petition.html file, |
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.
Why doesn't this (or the above) need to be in some sort of comment tag?
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.
as an extends
template, anything that isn't inside a block gets entirely ignored. (based on "where would it even render it?" logic)
{% block cta %} | ||
{% if page.cta != None or page.signup != None %} | ||
<div class="cta | ||
{% if page.specific.narrowed_page_content == False %} |
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.
Possibly out of scope, but I think this can be removed/made just one class- since if you're seeing the right column, the page content width is a fixed size anyway.
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'd say out of scope - it's a copy of what we already had so I'd rather leave it the same as much as possible until we tackle the cleanup.
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.
Does the templating support wrapping block
tags inside the if
statement? Or can you call a block's super content manually? Just trying to reduce the WETness here.
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.
any toplevel block declaration means "I am overriding the content of this block, overriding everything the parent/ancestor has in that block: ..." and any block declaration inside of templating code means "I am defining a block here, that extending templates can assign their own content".
When overriding a block, leaving it empty will "remove" whatever the parent/ancestor said should happen, and when defining a block, it can similarly be left empty as a "placeholder" for extending templates to fill in as needed, or it can be given real content, that extending templates can then swap out for something else as needed.
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.
Right, I wasn't sure if there was a secret manual call to super
. Not a big deal, when you land this file a ticket to remember to DRY it out.
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 looks reasonable overall, just another comment or two that might be improvable. And obviously, the markup needs some love.
@mmmavis is helping with the markup because we'll need the signup component in the footer etc too. |
superceded and landed |
Related PRs/issues #2908
This is a (draft) PR to add signup functionality based on basket-managed newsletters to the bannered campaign page.
This code is not ready to land, but it is ready for a sanity check around how the signup form (from join.jsx) calls the API server's new
/signups/<id>
route, which is hanlded bysignup_submission_view
innetworkapi.campaign.views
.There is a minimal amount of duplication in the views.py file, falling through to the function that petitions were already using to send data over to SQS, but with a new event type,
newsletter_signup_data
, rather than the existingcrm_petition_data
.Checklist
Tests
Documentation: