Skip to content

Commit

Permalink
VA-16652: Use liquid filter for VBA phone numbers
Browse files Browse the repository at this point in the history
  • Loading branch information
maxx1128 committed Feb 29, 2024
1 parent 1efab75 commit 69ad722
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 12 deletions.
27 changes: 19 additions & 8 deletions src/site/components/phone-number.drupal.liquid
Original file line number Diff line number Diff line change
@@ -1,8 +1,19 @@
<h{{ phoneHeaderLevel }}>{{ phoneLabel | default: 'Phone' }}</h{{ phoneHeaderLevel }}>
<div>
<va-telephone
contact="{{ phoneNumber | removeDashes }}"
extension="{{ phoneExtension | default: '' }}"
message-aria-describedby="{{ phoneLabel | default: 'Phone' }}"
/>
</div>
{% if phoneNumber %}
{% if phoneExtension %}
{% assign partialPhoneNumber = phoneNumber %}
{% assign partialPhoneExtension = phoneExtension %}
{% else %}
{% assign separatedPhoneNumber = phoneNumber | separatePhoneNumberExtension %}
{% assign partialPhoneNumber = separatedPhoneNumber.phoneNumber %}
{% assign partialPhoneExtension = separatedPhoneNumber.extension %}
{% endif %}

<h{{ phoneHeaderLevel }}>{{ phoneLabel | default: 'Phone' }}</h{{ phoneHeaderLevel }}>
<div>
<va-telephone
contact="{{ partialPhoneNumber | removeDashes }}"
extension="{{ partialPhoneExtension | default: '' }}"
message-aria-describedby="{{ phoneLabel | default: 'Phone' }}"
/>
</div>
{% endif %}
9 changes: 7 additions & 2 deletions src/site/includes/vba_facilities/service_location.liquid
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,12 @@
Main Phone
</h5>

<va-telephone contact="{{ facilityPhone }}" message-aria-describedby="Main Phone" />
{% assign serviceLocationMainPhone = facilityPhone | separatePhoneNumberExtension %}
<va-telephone
contact="{{ serviceLocationMainPhone.phoneNumber }}"
extension="{{ serviceLocationMainPhone.extension }}"
message-aria-describedby="Main Phone"
/>
</div>
{% elsif location.entity.fieldPhone %}
{% for phoneObj in location.entity.fieldPhone %}
Expand Down Expand Up @@ -136,4 +141,4 @@
</p>
</div>
{% endif %}
</div>
</div>
10 changes: 8 additions & 2 deletions src/site/layouts/vba_facility.drupal.liquid
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,13 @@
<div class="vads-u-margin-bottom--1">
<p class="vads-u-margin-top--0">
<strong>Main phone:</strong>
<va-telephone contact="{{fieldPhoneNumber}}" />

{% assign vbaFacilityMainPhone = fieldPhoneNumber | separatePhoneNumberExtension %}
<va-telephone
contact="{{ vbaFacilityMainPhone.phoneNumber }}"
extension="{{ vbaFacilityMainPhone.extension }}"
message-aria-describedby="Main Phone"
/>
</p>
</div>
{% endif %}
Expand Down Expand Up @@ -249,7 +255,7 @@
fieldTwitter = fieldUpdatesVba.links.twitter
fieldInstagram = fieldUpdatesVba.links.instagram
fieldFlickr = fieldUpdatesVba.links.flickr

%}
{% endif %}
<h2 class="vads-u-line-height--1 vads-u-margin-bottom--3">
Expand Down

0 comments on commit 69ad722

Please sign in to comment.