Skip to content

Commit

Permalink
Vote-2957: No Online Registration (#1054)
Browse files Browse the repository at this point in the history
* add placeholder for no online reg

* Updating twig template

* Update to config for  new field
  • Loading branch information
clmedders authored Oct 17, 2024
1 parent 68f40b9 commit b3a5941
Show file tree
Hide file tree
Showing 5 changed files with 85 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ dependencies:
- field.field.block_content.state_display_content.field_in_person_registration
- field.field.block_content.state_display_content.field_mail_registration
- field.field.block_content.state_display_content.field_military_and_overseas_regi
- field.field.block_content.state_display_content.field_no_online_registration
- field.field.block_content.state_display_content.field_nvrf_details
- field.field.block_content.state_display_content.field_online_registration
- field.field.block_content.state_display_content.field_registration_intro
Expand Down Expand Up @@ -45,13 +46,13 @@ content:
third_party_settings: { }
field_election_date:
type: datetime_default
weight: 10
weight: 11
region: content
settings: { }
third_party_settings: { }
field_election_text:
type: text_textarea
weight: 11
weight: 12
region: content
settings:
rows: 3
Expand All @@ -62,7 +63,7 @@ content:
hide_guidelines: '0'
field_in_person_registration:
type: vote_fields_state_content
weight: 7
weight: 8
region: content
settings:
form_subfield_display:
Expand All @@ -72,7 +73,7 @@ content:
third_party_settings: { }
field_mail_registration:
type: vote_fields_state_content
weight: 5
weight: 6
region: content
settings:
form_subfield_display:
Expand All @@ -82,17 +83,27 @@ content:
third_party_settings: { }
field_military_and_overseas_regi:
type: vote_fields_state_content
weight: 8
weight: 9
region: content
settings:
form_subfield_display:
heading: heading
text: text
link_text: 0
third_party_settings: { }
field_no_online_registration:
type: vote_fields_state_content
weight: 5
region: content
settings:
form_subfield_display:
- heading
- text
- link_text
third_party_settings: { }
field_nvrf_details:
type: vote_fields_state_content
weight: 6
weight: 7
region: content
settings:
form_subfield_display:
Expand Down Expand Up @@ -122,7 +133,7 @@ content:
third_party_settings: { }
field_registration_not_needed:
type: vote_fields_state_content
weight: 9
weight: 10
region: content
settings:
form_subfield_display:
Expand All @@ -140,13 +151,13 @@ content:
third_party_settings: { }
langcode:
type: language_select
weight: 13
weight: 14
region: content
settings:
include_locked: true
third_party_settings: { }
translation:
weight: 12
weight: 13
region: content
settings: { }
third_party_settings: { }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ dependencies:
- field.field.block_content.state_display_content.field_in_person_registration
- field.field.block_content.state_display_content.field_mail_registration
- field.field.block_content.state_display_content.field_military_and_overseas_regi
- field.field.block_content.state_display_content.field_no_online_registration
- field.field.block_content.state_display_content.field_nvrf_details
- field.field.block_content.state_display_content.field_online_registration
- field.field.block_content.state_display_content.field_registration_intro
Expand Down Expand Up @@ -76,6 +77,13 @@ content:
third_party_settings: { }
weight: 8
region: content
field_no_online_registration:
type: vote_fields_state_content_default
label: above
settings: { }
third_party_settings: { }
weight: 12
region: content
field_nvrf_details:
type: vote_fields_state_content_default
label: above
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
uuid: 398183c8-0c7a-4960-aaf6-d3bb2caa3f9c
langcode: en
status: true
dependencies:
config:
- block_content.type.state_display_content
- field.storage.block_content.field_no_online_registration
module:
- vote_fields
id: block_content.state_display_content.field_no_online_registration
field_name: field_no_online_registration
entity_type: block_content
bundle: state_display_content
label: 'No Online registration'
description: ''
required: false
translatable: true
default_value: { }
default_value_callback: ''
settings: { }
field_type: vote_fields_state_content
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
uuid: fb15b55f-486c-41b1-9c7b-5296239c2e10
langcode: en
status: true
dependencies:
module:
- block_content
- vote_fields
id: block_content.field_no_online_registration
field_name: field_no_online_registration
entity_type: block_content
type: vote_fields_state_content
settings: { }
module: vote_fields
locked: false
cardinality: 1
translatable: true
indexes: { }
persist_with_no_fields: false
custom_storage: false
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,8 @@
{% set check_registration = state_display_content.field_check_registration.0 | default([]) | merge(content.field_check_registration.0 | default([])) %}
{% set election_date = state_display_content.field_election_date.0 | default([]) | merge(content.field_election_date.0 | default([])) %}
{% set election_text = state_display_content.field_election_text.0 | default([]) | merge(content.field_election_text.0 | default([])) %}
{% set no_online_registration = state_display_content.field_no_online_registration.0 | default([]) | merge(content.field_no_online_registration.0 | default([])) %}

{# Registration types #}
{% set registration_types = content.field_registration_type | field_value | column('#markup') %}
{% set has_in_person = "in-person" in registration_types %}
{% set has_mail = "by-mail" in registration_types %}
{% set has_online = "online" in registration_types %}
{% set not_needed = "not-needed" in registration_types %}

<div{{ attributes.addClass(classes) }}>
{# Hold these title_* placeholders for potential integration #}
Expand Down Expand Up @@ -109,21 +104,22 @@
{{ registration_intro.text }}
{% endif %}

{% if has_online and (online_registration is not empty) %}
{{ online_registration }}
{{ online_deadline }}
{{ registration_link }}
{% set body = online_registration.text['#markup'] | t({'@state_online_deadline': online_deadline | render, '@state_name': title_english}) %}
{% set link_title = online_registration.link_text['#markup'] | t({'@state_name': title_english }) %}
{% include '@votegov/component/info-card.html.twig' with {
'heading': online_registration.heading,
'body': body,
'link': {
'url': registration_link,
'title': link_title,
}
} %}
{% endif %}
{# setting online registration variables #}
{% set online_registration_vars = has_online ? online_registration : no_online_registration %}
{% set body_vars = has_online ? {'@state_online_deadline': online_deadline | render, '@state_name': title_english} : {'@state_name': title_english} %}

{% if online_registration_vars is not empty %}
{% set body = online_registration_vars.text['#markup'] | t(body_vars) %}
{% set link_title = online_registration_vars.link_text['#markup'] | t({'@state_name': title_english}) %}
{% include '@votegov/component/info-card.html.twig' with {
'heading': online_registration_vars.heading,
'body': body,
'link': {
'url': registration_link,
'title': link_title,
}
} %}
{% endif %}

{% if has_mail and mail_registration is not empty %}
{% set mail_body %}
Expand Down

0 comments on commit b3a5941

Please sign in to comment.