Skip to content

Commit

Permalink
Fix #64; rename al_intl_phone input to al_international_phone
Browse files Browse the repository at this point in the history
  • Loading branch information
nonprofittechy committed May 9, 2022
1 parent 4aa1069 commit 28eb4ef
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 16 deletions.
10 changes: 5 additions & 5 deletions docassemble/ALToolbox/PhoneNumberDataType.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@


class PhoneNumber(CustomDataType):
name = "al_intl_phone"
input_class = "al_intl_phone"
name = "al_international_phone"
input_class = "al_international_phone"
javascript = """\
/** When combined with the phone number javascript file shown in
* phone_number_validation_demo.yml, this docassemble CustomDataType
* will make sure a user has give valid phone numbers in input fields
* with the `datatype` `al_intl_phone`. This includes international
* with the `datatype` `al_international_phone`. This includes international
* numbers.
*
* This docassemble CustomDataType will be installed on your server along
Expand Down Expand Up @@ -41,9 +41,9 @@ class PhoneNumber(CustomDataType):
return true;
};
$.validator.addMethod( 'al_intl_phone', validatePhoneNumber );
$.validator.addMethod( 'al_international_phone', validatePhoneNumber );
"""
jq_rule = "al_intl_phone"
jq_rule = "al_international_phone"
# People that have just entered an invalid US phone number could find this confusing
jq_message = 'This phone number doesn\'t look right. Note that a non-US number needs a "+" before the number.'

Expand Down
2 changes: 1 addition & 1 deletion docassemble/ALToolbox/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '0.4.0'
__version__ = '0.4.1'
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,21 @@ include:
question: |
International phone number input validation
subquestion: |
This tool creates a **custom datatype called "al_intl_phone"**, then use a javascript plugin ([intl-tel-input](https://www.npmjs.com/package/intl-tel-input)) to validate international phone number input in docassemble interviews.
This tool creates a **custom datatype called "al_international_phone"**, then use a javascript plugin ([intl-tel-input](https://www.npmjs.com/package/intl-tel-input)) to validate international phone number input in docassemble interviews.
To use this feature,
1. Add `phone_number_validation.yml` to your `include` block.
1. Add one or more input fields with `datatype: al_intl_phone` in a question block.
1. Add one or more input fields with `datatype: al_international_phone` in a question block.
Valid US phone number to try: **201-555-0123**[BR]
Valid UK phone number to try: **+44 1434 634996**[BR]
Valid Spain phone number to try: **+34 912 345 678** (34 9xx xxx xxx)
fields:
- Phone number 1: phone_number_1
datatype: al_intl_phone
datatype: al_international_phone
- Phone number 2: phone_number_2
datatype: al_intl_phone
datatype: al_international_phone
required: false
---
mandatory: True
Expand Down
6 changes: 3 additions & 3 deletions docassemble/ALToolbox/data/static/phone-number-validation.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
$(document).on('daPageLoad', function(){
/** When the page first loads, gets the value from any `.al_intl_phone` input
/** When the page first loads, gets the value from any `.al_international_phone` input
* field, transforms it, puts the transformed value back into the input
* field, and adds a dropdown from which to choose a country. It
* can also automatically identify the country based on the phone number
Expand Down Expand Up @@ -30,8 +30,8 @@ $(document).on('daPageLoad', function(){
* 1. https://github.com/google/libphonenumber/blob/master/FAQ.md
*/

// Loop through all the .al_intl_phone input fields on the current screen
let phoneNodes = document.querySelectorAll( '.al_intl_phone' ); // Class given by the CustomDataType
// Loop through all the .al_international_phone input fields on the current screen
let phoneNodes = document.querySelectorAll( '.al_international_phone' ); // Class given by the CustomDataType
for ( var node of phoneNodes ) {
var telObj = window.intlTelInput( node, {
// The default country without any input into the plugin is 'us'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ Fixes CSS for dropdown height being affected by DA error message
padding-bottom: .75em;
}

.al_intl_phone {
.al_international_phone {
width: unset;
}
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def find_package_data(where='.', package='', exclude=standard_exclude, exclude_d
return out

setup(name='docassemble.ALToolbox',
version='0.4.0',
version='0.4.1',
description=('Collection of small utility functions, classes, and web components for Docassemble interviews'),
long_description='# ALToolbox\r\n\r\nThis repository is used to host small Python modules, widgets, and JavaScript web components js files that enhance Docassemble interviews. These modules were\r\nbuilt as part of the Suffolk University Law School LIT Lab\'s [Document Assembly Line project](https://suffolklitlab.org/docassemble-AssemblyLine-documentation/).\r\nThey are placed here\r\nrather than in https://github.com/SuffolkLitLab/docassemble-AssemblyLine because we believe these small components can easily be used\r\nby anyone, regardless of whether they use any other code from the Document Assembly Line project.\r\n\r\nIf you want to add a small fuction to this project, consider adding it to the existing misc.py to avoid creating too many module files.\r\n\r\n## Documentation\r\n\r\nRead the [documentation for the functions and components](https://suffolklitlab.org/docassemble-AssemblyLine-documentation/docs/framework/altoolbox) to learn\r\nhow to use these components in your own [Docassemble](https://github.com/jhpyle/docassemble) projects.\r\n\r\n## Suffolk LIT Lab Document Assembly Line\r\n\r\n<img src="https://user-images.githubusercontent.com/7645641/142245862-c2eb02ab-3090-4e97-9653-bb700bf4c54d.png" alt="drawing" width="300" alt="work together" style="align: center;"/>\r\n\r\nThe Assembly Line Project is a collection of volunteers, students, and institutions who joined together\r\nduring the COVID-19 pandemic to help increase access to the court system. Our vision is mobile-friendly,\r\neasy to use **guided** online forms that help empower litigants to access the court remotely.\r\n\r\nOur signature project is [CourtFormsOnline.org](https://courtformsonline.org).\r\n\r\nWe designed a step-by-step, assembly line style process for automating court forms on top of Docassemble\r\nand built several tools along the way that **you** can use in your home jurisdiction.\r\n\r\nThis package contains **runtime code** and **pre-written questions** to support authoring robust, \r\nconsistent, and attractive Docassemble interviews that help complete court forms.\r\n\r\nRead more on our [documentation page](https://suffolklitlab.org/docassemble-AssemblyLine-documentation/).\r\n\r\n\r\n# Related repositories\r\n\r\n* https://github.com/SuffolkLitLab/docassemble-AssemblyLine\r\n* https://github.com/SuffolkLitLab/docassemble-ALWeaver\r\n* https://github.com/SuffolkLitLab/docassemble-ALMassachusetts\r\n* https://github.com/SuffolkLitLab/docassemble-MassAccess\r\n* https://github.com/SuffolkLitLab/docassemble-ALGenericJurisdiction\r\n* https://github.com/SuffolkLitLab/EfileProxyServer\r\n\r\n## Contributors: \r\n* @plocket \r\n* @nonprofittechy\r\n* @purplesky2016\r\n* @brycestevenwilley\r\n',
long_description_content_type='text/markdown',
Expand All @@ -53,7 +53,7 @@ def find_package_data(where='.', package='', exclude=standard_exclude, exclude_d
url='https://suffolklitlab.org/docassemble-AssemblyLine-documentation/docs/framework/altoolbox',
packages=find_packages(),
namespace_packages=['docassemble'],
install_requires=['holidays>=0.13', 'pandas>=1.2.4'],
install_requires=['holidays>=0.13', 'pandas>=1.4.2'],
zip_safe=False,
package_data=find_package_data(where='docassemble/ALToolbox/', package='docassemble.ALToolbox'),
)
Expand Down

0 comments on commit 28eb4ef

Please sign in to comment.