Commit c1aeddbb authored by Rafael Monnerat's avatar Rafael Monnerat

slapos_jio: Add fields to user edit his address.

  Replace String Field by a selection with the list of Countries available on ERP5,
  so it is consitent with general ERP5 Implementation
parent 8c8851c1
......@@ -111,13 +111,21 @@
"Logins",
"Organisations",
"Your Account",
"Data updated."
"Data updated.",
"Address",
"Postal Code",
"Telephone",
"City",
"Country"
];
return new RSVP.Queue()
.push(function () {
return gadget.getSetting("hateoas_url")
.push(function (url) {
return RSVP.all([
gadget.getDeclaredGadget('form_view'),
gadget.getTranslationList(translation_list)
gadget.getTranslationList(translation_list),
gadget.jio_getAttachment("portal_categories/region",
url + "/portal_categories/region/Category_getCategoryChildTranslatedCompactTitleItemListAsJSON")
]);
})
.push(function (result) {
......@@ -125,6 +133,7 @@
gadget.message_translation = result[1][11];
var form_gadget = result[0],
i,
region_list = result[2],
destination_list,
column_list = [
['reference', result[1][0]],
......@@ -217,6 +226,62 @@
"sort": [["reference", "ascending"]],
"title": result[1][9],
"type": "ListBox"
},
"my_default_telephone_coordinate_text": {
"description": "",
"title": result[1][14],
"default": gadget.state.doc.default_telephone_coordinate_text,
"css_class": "",
"required": 0,
"editable": 1,
"key": "default_telephone_coordinate_text",
"hidden": 0,
"type": "StringField"
},
"my_default_address_street_address": {
"description": "",
"title": result[1][12],
"default": gadget.state.doc.default_address_street_address,
"css_class": "",
"required": 1,
"editable": 1,
"key": "default_address_street_address",
"hidden": 0,
"type": "TextAreaField"
},
"my_default_address_zip_code": {
"description": "",
"title": result[1][13],
"default": gadget.state.doc.default_address_zip_code,
"css_class": "",
"required": 1,
"editable": 1,
"key": "default_address_zip_code",
"hidden": 0,
"type": "StringField"
},
"my_default_address_city": {
"description": "",
"title": result[1][15],
"default": gadget.state.doc.default_address_city,
"css_class": "",
"required": 1,
"editable": 1,
"key": "default_address_city",
"hidden": 0,
"type": "StringField"
},
"my_default_address_region": {
"description": "",
"title": result[1][16],
"default": gadget.state.doc.default_address_region,
"css_class": "",
"items": region_list,
"required": 0,
"editable": 1,
"key": "default_address_region",
"hidden": 0,
"type": "ListField"
}
}},
"_links": {
......@@ -229,7 +294,10 @@
form_definition: {
group_list: [[
"left",
[["my_first_name"], ["my_last_name"], ["my_default_email_text"]]
[["my_first_name"], ["my_last_name"], ["my_default_email_text"], ['my_default_telephone_coordinate_text']]
], [
"right",
[["my_default_address_street_address"], ["my_default_address_zip_code"], ["my_default_address_city"], ["my_default_address_region"]]
], [
"bottom",
[["listbox"], ["organisation_listbox"]]
......
......@@ -242,7 +242,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>982.32663.26530.37700</string> </value>
<value> <string>983.33586.34084.36078</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -260,7 +260,7 @@
</tuple>
<state>
<tuple>
<float>1584299335.69</float>
<float>1588096504.89</float>
<string>UTC</string>
</tuple>
</state>
......
import json
if context.getPortalType() not in ("Category", "Base Category"):
return json.dumps([])
return json.dumps(context.getCategoryChildTranslatedCompactTitleItemList(
sort_id='translated_short_title',
checked_permission='View',
filter_node=1))
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Category_getCategoryChildTranslatedCompactTitleItemListAsJSON</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -93,6 +93,12 @@
<string>my_last_name</string>
<string>my_assignment_destination_list</string>
<string>my_assignment_destination_project_list</string>
<string>my_default_address_city</string>
<string>my_default_address_region</string>
<string>my_default_address_street_address</string>
<string>my_default_address_zip_code</string>
<string>my_career_subordination_title</string>
<string>my_default_telephone_coordinate_text</string>
</list>
</value>
</item>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ProxyField" module="Products.ERP5Form.ProxyField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>delegated_list</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>my_career_subordination_title</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
<value>
<dictionary>
<item>
<key> <string>external_validator_failed</string> </key>
<value> <string>The input failed the external validator.</string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>overrides</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>tales</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string>my_subordination_title</string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string>Career_viewFieldLibrary</string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string>Click to edit the target</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ProxyField" module="Products.ERP5Form.ProxyField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>delegated_list</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>my_default_address_city</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
<value>
<dictionary>
<item>
<key> <string>external_validator_failed</string> </key>
<value> <string>The input failed the external validator.</string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>overrides</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>tales</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string>my_city</string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string>Address_viewFieldLibrary</string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string>Click to edit the target</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ProxyField" module="Products.ERP5Form.ProxyField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>delegated_list</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>my_default_address_region</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
<value>
<dictionary>
<item>
<key> <string>external_validator_failed</string> </key>
<value> <string>The input failed the external validator.</string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>overrides</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>tales</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string>my_string_field</string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string>Base_viewFieldLibrary</string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string>Click to edit the target</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ProxyField" module="Products.ERP5Form.ProxyField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>delegated_list</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>my_default_address_street_address</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
<value>
<dictionary>
<item>
<key> <string>external_validator_failed</string> </key>
<value> <string>The input failed the external validator.</string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>overrides</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>tales</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string>my_street_address</string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string>Address_viewFieldLibrary</string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string>Click to edit the target</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ProxyField" module="Products.ERP5Form.ProxyField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>delegated_list</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>my_default_address_zip_code</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
<value>
<dictionary>
<item>
<key> <string>external_validator_failed</string> </key>
<value> <string>The input failed the external validator.</string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>overrides</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>tales</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string>my_zip_code</string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string>Address_viewFieldLibrary</string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string>Click to edit the target</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ProxyField" module="Products.ERP5Form.ProxyField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>delegated_list</string> </key>
<value>
<list>
<string>title</string>
</list>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>my_default_telephone_coordinate_text</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
<value>
<dictionary>
<item>
<key> <string>external_validator_failed</string> </key>
<value> <string>The input failed the external validator.</string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>overrides</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>tales</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string>my_view_mode_telephone_coordinate_text</string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string>Base_viewBaseFieldLibrary</string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string>Click to edit the target</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Default Telephone</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="TALESMethod" module="Products.Formulator.TALESField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_text</string> </key>
<value> <string>string:</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -86,7 +86,15 @@
</div><br/>
<div class="ui-field-contain">
<label i18n:domain="ui" i18n:translate="" >Country</label>
<div><input type="text" name="default_address_country" value="" required=""></div>
<div>
<select name="default_address_region" required="">
<tal:block tal:repeat="item python: context.portal_categories.region.getCategoryChildTranslatedCompactTitleItemList(sort_id='translated_short_title', checked_permission='View', filter_node=1)">
<option tal:attributes="value python: item[1]">
<tal:block tal:replace="python: item[0]"> Title </tal:block>
</option>
</tal:block>
</select>
</div>
</div><br/>
</div>
<div class="bottom">
......
......@@ -44,6 +44,36 @@
<td></td>
</tr>
<tr>
<td>assertElementPresent</td>
<td>//label[text()="Telephone"]</td>
<td></td>
</tr>
<tr>
<td>assertElementPresent</td>
<td>//label[text()="Address"]</td>
<td></td>
</tr>
<tr>
<td>assertElementPresent</td>
<td>//label[text()="Postal Code"]</td>
<td></td>
</tr>
<tr>
<td>assertElementPresent</td>
<td>//label[text()="City"]</td>
<td></td>
</tr>
<tr>
<td>assertElementPresent</td>
<td>//label[text()="Country"]</td>
<td></td>
</tr>
<tr>
<td colspan="3"><b> Rename user to DEMO A </b></td>
</tr>
......@@ -66,12 +96,86 @@
<td>demoA@nexedi.com</td>
</tr>
<!-- Perform an intermediate save to ensure we can edit partial values -->
<tal:block metal:use-macro="here/Zuite_SlapOSCommonTemplate/macros/save" />
<tr>
<td>type</td>
<td>//textarea[@id="default_address_street_address"]</td>
<td>My New Address</td>
</tr>
<tr>
<td>type</td>
<td>//input[@id="default_address_city"]</td>
<td>My New City</td>
</tr>
<tr>
<td>type</td>
<td>//input[@id="default_address_zip_code"]</td>
<td>99999</td>
</tr>
<tr>
<td>type</td>
<td>//input[@id="default_telephone_coordinate_text"]</td>
<td>+55 0192182812</td>
</tr>
<tr>
<td>select</td>
<td>//select[@id="default_address_region"]</td>
<td>Brazil</td>
</tr>
<tal:block metal:use-macro="here/Zuite_SlapOSCommonTemplate/macros/save" />
<!-- access somewhere else -->
<tal:block define="menu_item python: 'Sites'; header menu_item">
<tal:block metal:use-macro="here/Zuite_SlapOSCommonTemplate/macros/access_menu_item" />
</tal:block>
<tal:block define="person_name python: 'DEMO A DEMO B'">
<tal:block metal:use-macro="here/Zuite_SlapOSCommonTemplate/macros/access_menu_item_account" />
</tal:block>
<tr>
<td>waitForElementPresent</td>
<td>//input[@id="default_address_city" and @value="My New City"]</td>
<td></td>
</tr>
<tr>
<td>verifyValue</td>
<td>//textarea[@id="default_address_street_address"]</td>
<td>My New Address</td>
</tr>
<tr>
<td>assertElementPresent</td>
<td>//input[@id="default_address_city" and @value="My New City"]</td>
<td></td>
</tr>
<tr>
<td>assertElementPresent</td>
<td>//input[@id="default_address_zip_code" and @value="99999"]</td>
<td></td>
</tr>
<tr>
<td>assertElementPresent</td>
<td>//input[@id="default_telephone_coordinate_text" and @value="+55 0192182812"]</td>
<td></td>
</tr>
<tr>
<td>assertElementPresent</td>
<td>//select[@id="default_address_region"]/option[text()="Brazil" and @selected="selected"]</td>
<td></td>
</tr>
<tal:block metal:use-macro="here/Zuite_SlapOSCommonTemplate/macros/slapos_logout" />
</tbody></table>
......
......@@ -131,8 +131,8 @@
<td>Paris</td>
</tr>
<tr>
<td>type</td>
<td>//input[@name='default_address_country']</td>
<td>select</td>
<td>//select[@name='default_address_region']</td>
<td>France</td>
</tr>
<tr>
......
......@@ -131,8 +131,8 @@
<td>Paris</td>
</tr>
<tr>
<td>type</td>
<td>//input[@name='default_address_country']</td>
<td>select</td>
<td>//select[@name='default_address_region']</td>
<td>France</td>
</tr>
<tr>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment