Skip to content

Commit

Permalink
VA-16652: separate phone extension for mental health numbers
Browse files Browse the repository at this point in the history
  • Loading branch information
maxx1128 committed Feb 26, 2024
1 parent 9698bde commit ecebfe5
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,17 @@
</div>
{% else %}
{% if isMentalHealthService and fieldMentalHealthPhone %}
{% assign localHealthServiceMainNumber = fieldMentalHealthPhone %}
{% assign localHealthServiceMainNumber = fieldMentalHealthPhone | separatePhoneNumberExtension %}
{% else %}
{% assign localHealthServiceMainNumber = fieldPhoneNumber %}
{% assign localHealthServiceMainNumber = fieldPhoneNumber | separatePhoneNumberExtension %}
{% endif %}

<div class="vads-u-display--flex vads-u-flex-direction--column vads-u-margin-bottom--1" data-template="facilities/health_care_local_health_service">


{% include "src/site/components/phone-number.drupal.liquid" with
phoneNumber = localHealthServiceMainNumber
phoneNumber = localHealthServiceMainNumber.phoneNumber
phoneExtension = localHealthServiceMainNumber.extension
phoneLabel = 'Main Phone'
phoneHeaderLevel = 5
%}
Expand Down
9 changes: 8 additions & 1 deletion src/site/filters/liquid.js
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,13 @@ module.exports = function registerFilters() {
return data;
};

liquid.filters.separatePhoneNumberExtension = phoneNumber => {
return {
phoneNumber: phoneNumber.split(', ext. ')[0],
extension: phoneNumber.split(', ext. ')[1],
};
};

liquid.filters.trackLinks = (html, eventDataString) => {
// Add calls to "recordEvent" to all links found in html
const eventData = JSON.parse(eventDataString);
Expand Down Expand Up @@ -866,7 +873,7 @@ module.exports = function registerFilters() {

/**
* Converts a string to camel case and removes a prefix
@param {string} prefix - prefix to be removed - make empty string not to change string
@param {string} prefix - prefix to be removed - make empty string not to change string
@param {string} string - string to be converted
*/
liquid.filters.trimAndCamelCase = (toRemove, string) => {
Expand Down

0 comments on commit ecebfe5

Please sign in to comment.