Skip to content

Commit

Permalink
[FA] [Post-Launch] Rename fields in Petition snippet - Part 2 (#11093)
Browse files Browse the repository at this point in the history
* Remove refs to old fields

* Fix boolean comparison

* Fix show_comment logic on template
  • Loading branch information
jhonatan-lopes authored Sep 13, 2023
1 parent c6e06ca commit 6bcd586
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class Params:
no_cta = Trait(cta=None)
cta_show_all_fields = Trait(
cta=SubFactory(
PetitionFactory, requires_country_code=True, requires_postal_code=True, comment_requirements="required"
PetitionFactory, show_country_field=True, show_postal_code_field=True, show_comment_field=True
)
)

Expand Down
3 changes: 0 additions & 3 deletions network-api/networkapi/wagtailpages/pagemodels/campaigns.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,9 +268,6 @@ class Petition(TranslatableMixin, CTA):
SynchronizedField("show_country_field"),
SynchronizedField("show_postal_code_field"),
SynchronizedField("show_comment_field"),
SynchronizedField("requires_country_code"),
SynchronizedField("requires_postal_code"),
TranslatableField("comment_requirements"),
TranslatableField("checkbox_1"),
TranslatableField("checkbox_2"),
SynchronizedField("share_twitter"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
5. Wrap country field, postal code field, and comment field in {% if %} tag
- for country field: {% if show_country_field %} ... {% endif %}
- for postal code field: {% if show_postal_code_field %} ... {% endif %}
- for comment field: {% if not show_comment_field == "none" %} ... {% endif %}
- for comment field: {% if show_comment_field %} ... {% endif %}

6. If using a required checkbox field, add the classname 'reqMark' to the label wrapping the
span element with the classname of `input-checkbox-faux`. This will ensure that the
Expand Down Expand Up @@ -312,7 +312,7 @@
<label id="tfa_496-L" class="label preField " for="tfa_496">{% trans "Postal Code" %}</label><br><div class="inputWrapper"><input type="text" id="tfa_496" name="tfa_496" value="" title="{% trans "Postal Code" %}" class=""></div>
</div>
{% endif %}
{% if not show_comment_field == "none" %}
{% if show_comment_field %}
<div class="oneField field-container-D " id="tfa_497-D">
<label id="tfa_497-L" class="label preField " for="tfa_497">{% trans "Comments" %}</label><br><div class="inputWrapper"><textarea maxlength="500" id="tfa_497" name="tfa_497" title="{% trans "Comments" %}" class=""></textarea></div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ <h5 class="tw-h5-heading">{{ cta.header | escape }}</h5>
We are inncluding tfa_* in the variable name to make it clear where the value should be plugged in.
For field name reference, see https://mozillafoundation.tfaforms.net/forms/definition/9
{% endcomment %}
{% include "../../fragments/formassembly_body.html" with csp_nonce=csp_nonce show_country_field=cta.requires_country_code show_postal_code_field=cta.requires_postal_code show_comment_field=cta.comment_requirements campaign_id_tfa_1=cta.campaign_id source_url_tfa_498=source_url lang_tfa_499=lang thank_you_url_tfa_500=thank_you_url %}
{% include "../../fragments/formassembly_body.html" with csp_nonce=csp_nonce show_country_field=cta.show_country_field show_postal_code_field=cta.show_postal_code_field show_comment_field=cta.show_comment_field campaign_id_tfa_1=cta.campaign_id source_url_tfa_498=source_url lang_tfa_499=lang thank_you_url_tfa_500=thank_you_url %}
<link rel="stylesheet" href="{% static "_css/formassembly-override.compiled.css" %}">
{% else %}
<div
Expand Down

0 comments on commit 6bcd586

Please sign in to comment.