diff --git a/productMods/templates/freemarker/body/partials/individual/propStatement-mailingAddress.ftl b/productMods/templates/freemarker/body/partials/individual/propStatement-mailingAddress.ftl index f5a45eec..5b18d090 100644 --- a/productMods/templates/freemarker/body/partials/individual/propStatement-mailingAddress.ftl +++ b/productMods/templates/freemarker/body/partials/individual/propStatement-mailingAddress.ftl @@ -13,9 +13,17 @@ <#macro showAddress statement> <#if statement.street?has_content> -
- ${statement.street} -
+ <#if statement.street?contains(";") > + <#list statement.street?split("; ") as lines> ++ ${lines} +
+ #list> + <#else> ++ ${statement.street} +
+ #if> #if> <#if ( statement.country?has_content && (statement.country == "US" || statement.country?contains("United States") || statement.country?contains("U.S.") || statement.country?contains("U.S.A.") || statement.country?contains("USA")))> @@ -23,7 +31,7 @@ <#local cityStateZip><@s.join [ cityState!, statement.postalCode!], " " />#local> <#if cityStateZip?has_content>${cityStateZip}
-${statement.country!}
+${statement.country!}
#if> <#else> <#if statement.locality?has_content> @@ -42,7 +50,7 @@ #if> <#if statement.country?has_content> -+
${statement.country}
#if> diff --git a/productMods/templates/freemarker/edit/forms/js/mailingAddressUtils.js b/productMods/templates/freemarker/edit/forms/js/mailingAddressUtils.js new file mode 100644 index 00000000..d2104330 --- /dev/null +++ b/productMods/templates/freemarker/edit/forms/js/mailingAddressUtils.js @@ -0,0 +1,51 @@ +/* $This file is distributed under the terms of the license in /doc/license.txt$ */ + + +var mailingAddressUtils = { + + onLoad: function(editMode) { + this.initObjectReferences(); + this.bindEventListeners(); + + if ( editMode != "add" ) { + this.setStreetAddressDisplayFields(); + } + }, + + initObjectReferences: function() { + + this.form = $('#personHasMailingAddress'); + this.street1 = $('#streetAddressOne'); + this.street2 = $('#streetAddressTwo'); + this.streetAddress = $('#streetAddress'); + + }, + + bindEventListeners: function() { + this.idCache = {}; + + this.form.submit(function() { + mailingAddressUtils.setStreetAddressField(); + }); + + }, + + // the vcard only has one address field, so combine the two + // displayed addresses into the hidden field which gets asserted in the N3 + setStreetAddressField: function() { + var tempString = this.street1.val() + "; " + this.street2.val(); + this.streetAddress.val(tempString); + }, + + // in edit mode, take the asserted streetAddress value and parse it into + // the two displayed address fields + setStreetAddressDisplayFields: function() { + var tempString = this.streetAddress.val(); + var lineOne = tempString.substring(0,tempString.lastIndexOf(";")); + var lineTwo = tempString.substring(tempString.lastIndexOf(";") + 2); + + this.street1.val(lineOne); + this.street2.val(lineTwo); + } + +} \ No newline at end of file diff --git a/productMods/templates/freemarker/edit/forms/subjectHasMailingAddress.ftl b/productMods/templates/freemarker/edit/forms/subjectHasMailingAddress.ftl index 99236069..e44041ea 100644 --- a/productMods/templates/freemarker/edit/forms/subjectHasMailingAddress.ftl +++ b/productMods/templates/freemarker/edit/forms/subjectHasMailingAddress.ftl @@ -68,13 +68,19 @@