Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(225)

Side by Side Diff: chrome/browser/resources/options/autofill_edit_address_overlay.js

Issue 7892048: Autofill: Remove fax number completely. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 cr.define('options', function() { 5 cr.define('options', function() {
6 const OptionsPage = options.OptionsPage; 6 const OptionsPage = options.OptionsPage;
7 const ArrayDataModel = cr.ui.ArrayDataModel; 7 const ArrayDataModel = cr.ui.ArrayDataModel;
8 8
9 // The GUID of the loaded address. 9 // The GUID of the loaded address.
10 var guid; 10 var guid;
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 } 43 }
44 44
45 self.guid = ''; 45 self.guid = '';
46 self.populateCountryList_(); 46 self.populateCountryList_();
47 self.clearInputFields_(); 47 self.clearInputFields_();
48 self.connectInputEvents_(); 48 self.connectInputEvents_();
49 }, 49 },
50 50
51 /** 51 /**
52 * Creates, decorates and initializes the multi-value lists for full name, 52 * Creates, decorates and initializes the multi-value lists for full name,
53 * phone, fax, and email. 53 * phone, and email.
54 * @private 54 * @private
55 */ 55 */
56 createMultiValueLists_: function() { 56 createMultiValueLists_: function() {
57 var list = $('full-name-list'); 57 var list = $('full-name-list');
58 options.autofillOptions.AutofillValuesList.decorate(list); 58 options.autofillOptions.AutofillValuesList.decorate(list);
59 list.autoExpands = true; 59 list.autoExpands = true;
60 60
61 list = $('phone-list'); 61 list = $('phone-list');
62 options.autofillOptions.AutofillPhoneValuesList.decorate(list); 62 options.autofillOptions.AutofillPhoneValuesList.decorate(list);
63 list.autoExpands = true; 63 list.autoExpands = true;
64 64
65 list = $('fax-list');
66 options.autofillOptions.AutofillFaxValuesList.decorate(list);
67 list.autoExpands = true;
68
69 list = $('email-list'); 65 list = $('email-list');
70 options.autofillOptions.AutofillValuesList.decorate(list); 66 options.autofillOptions.AutofillValuesList.decorate(list);
71 list.autoExpands = true; 67 list.autoExpands = true;
72 }, 68 },
73 69
74 /** 70 /**
75 * Updates the data model for the list named |listName| with the values from 71 * Updates the data model for the list named |listName| with the values from
76 * |entries|. 72 * |entries|.
77 * @param {String} listName The id of the list. 73 * @param {String} listName The id of the list.
78 * @param {Array} entries The list of items to be added to the list. 74 * @param {Array} entries The list of items to be added to the list.
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 address[1] = list.dataModel.slice(0, list.dataModel.length - 1); 112 address[1] = list.dataModel.slice(0, list.dataModel.length - 1);
117 address[2] = $('company-name').value; 113 address[2] = $('company-name').value;
118 address[3] = $('addr-line-1').value; 114 address[3] = $('addr-line-1').value;
119 address[4] = $('addr-line-2').value; 115 address[4] = $('addr-line-2').value;
120 address[5] = $('city').value; 116 address[5] = $('city').value;
121 address[6] = $('state').value; 117 address[6] = $('state').value;
122 address[7] = $('postal-code').value; 118 address[7] = $('postal-code').value;
123 address[8] = $('country').value; 119 address[8] = $('country').value;
124 list = $('phone-list'); 120 list = $('phone-list');
125 address[9] = list.dataModel.slice(0, list.dataModel.length - 1); 121 address[9] = list.dataModel.slice(0, list.dataModel.length - 1);
126 list = $('fax-list'); 122 list = $('email-list');
127 address[10] = list.dataModel.slice(0, list.dataModel.length - 1); 123 address[10] = list.dataModel.slice(0, list.dataModel.length - 1);
128 list = $('email-list');
129 address[11] = list.dataModel.slice(0, list.dataModel.length - 1);
130 124
131 chrome.send('setAddress', address); 125 chrome.send('setAddress', address);
132 }, 126 },
133 127
134 /** 128 /**
135 * Connects each input field to the inputFieldChanged_() method that enables 129 * Connects each input field to the inputFieldChanged_() method that enables
136 * or disables the 'Ok' button based on whether all the fields are empty or 130 * or disables the 'Ok' button based on whether all the fields are empty or
137 * not. 131 * not.
138 * @private 132 * @private
139 */ 133 */
(...skipping 17 matching lines...) Expand all
157 */ 151 */
158 inputFieldChanged_: function() { 152 inputFieldChanged_: function() {
159 // Length of lists are tested for <= 1 due to the "add" placeholder item 153 // Length of lists are tested for <= 1 due to the "add" placeholder item
160 // in the list. 154 // in the list.
161 var disabled = 155 var disabled =
162 $('full-name-list').items.length <= 1 && 156 $('full-name-list').items.length <= 1 &&
163 !$('company-name').value && 157 !$('company-name').value &&
164 !$('addr-line-1').value && !$('addr-line-2').value && 158 !$('addr-line-1').value && !$('addr-line-2').value &&
165 !$('city').value && !$('state').value && !$('postal-code').value && 159 !$('city').value && !$('state').value && !$('postal-code').value &&
166 !$('country').value && $('phone-list').items.length <= 1 && 160 !$('country').value && $('phone-list').items.length <= 1 &&
167 $('fax-list').items.length <= 1 && $('email-list').items.length <= 1; 161 && $('email-list').items.length <= 1;
Ilya Sherman 2011/09/15 03:47:08 extra '&&'
James Hawkins 2011/09/16 03:23:28 Done.
168 $('autofill-edit-address-apply-button').disabled = disabled; 162 $('autofill-edit-address-apply-button').disabled = disabled;
169 }, 163 },
170 164
171 /** 165 /**
172 * Updates the postal code and state field labels appropriately for the 166 * Updates the postal code and state field labels appropriately for the
173 * selected country. 167 * selected country.
174 * @private 168 * @private
175 */ 169 */
176 countryChanged_: function() { 170 countryChanged_: function() {
177 var countryCode = $('country').value; 171 var countryCode = $('country').value;
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 clearInputFields_: function() { 235 clearInputFields_: function() {
242 this.setMultiValueList_('full-name-list', []); 236 this.setMultiValueList_('full-name-list', []);
243 $('company-name').value = ''; 237 $('company-name').value = '';
244 $('addr-line-1').value = ''; 238 $('addr-line-1').value = '';
245 $('addr-line-2').value = ''; 239 $('addr-line-2').value = '';
246 $('city').value = ''; 240 $('city').value = '';
247 $('state').value = ''; 241 $('state').value = '';
248 $('postal-code').value = ''; 242 $('postal-code').value = '';
249 $('country').value = ''; 243 $('country').value = '';
250 this.setMultiValueList_('phone-list', []); 244 this.setMultiValueList_('phone-list', []);
251 this.setMultiValueList_('fax-list', []);
252 this.setMultiValueList_('email-list', []); 245 this.setMultiValueList_('email-list', []);
253 246
254 this.countryChanged_(); 247 this.countryChanged_();
255 }, 248 },
256 249
257 /** 250 /**
258 * Loads the address data from |address|, sets the input fields based on 251 * Loads the address data from |address|, sets the input fields based on
259 * this data and stores the GUID of the address. 252 * this data and stores the GUID of the address.
260 * @private 253 * @private
261 */ 254 */
(...skipping 10 matching lines...) Expand all
272 setInputFields_: function(address) { 265 setInputFields_: function(address) {
273 this.setMultiValueList_('full-name-list', address['fullName']); 266 this.setMultiValueList_('full-name-list', address['fullName']);
274 $('company-name').value = address['companyName']; 267 $('company-name').value = address['companyName'];
275 $('addr-line-1').value = address['addrLine1']; 268 $('addr-line-1').value = address['addrLine1'];
276 $('addr-line-2').value = address['addrLine2']; 269 $('addr-line-2').value = address['addrLine2'];
277 $('city').value = address['city']; 270 $('city').value = address['city'];
278 $('state').value = address['state']; 271 $('state').value = address['state'];
279 $('postal-code').value = address['postalCode']; 272 $('postal-code').value = address['postalCode'];
280 $('country').value = address['country']; 273 $('country').value = address['country'];
281 this.setMultiValueList_('phone-list', address['phone']); 274 this.setMultiValueList_('phone-list', address['phone']);
282 this.setMultiValueList_('fax-list', address['fax']);
283 this.setMultiValueList_('email-list', address['email']); 275 this.setMultiValueList_('email-list', address['email']);
284 276
285 this.countryChanged_(); 277 this.countryChanged_();
286 }, 278 },
287 }; 279 };
288 280
289 AutofillEditAddressOverlay.clearInputFields = function() { 281 AutofillEditAddressOverlay.clearInputFields = function() {
290 AutofillEditAddressOverlay.getInstance().clearInputFields_(); 282 AutofillEditAddressOverlay.getInstance().clearInputFields_();
291 }; 283 };
292 284
293 AutofillEditAddressOverlay.loadAddress = function(address) { 285 AutofillEditAddressOverlay.loadAddress = function(address) {
294 AutofillEditAddressOverlay.getInstance().loadAddress_(address); 286 AutofillEditAddressOverlay.getInstance().loadAddress_(address);
295 }; 287 };
296 288
297 AutofillEditAddressOverlay.setTitle = function(title) { 289 AutofillEditAddressOverlay.setTitle = function(title) {
298 $('autofill-address-title').textContent = title; 290 $('autofill-address-title').textContent = title;
299 }; 291 };
300 292
301 AutofillEditAddressOverlay.setValidatedPhoneNumbers = function(numbers) { 293 AutofillEditAddressOverlay.setValidatedPhoneNumbers = function(numbers) {
302 AutofillEditAddressOverlay.getInstance().setMultiValueList_('phone-list', 294 AutofillEditAddressOverlay.getInstance().setMultiValueList_('phone-list',
303 numbers); 295 numbers);
304 }; 296 };
305 297
306 AutofillEditAddressOverlay.setValidatedFaxNumbers = function(numbers) {
307 AutofillEditAddressOverlay.getInstance().setMultiValueList_('fax-list',
308 numbers);
309 };
310
311 // Export 298 // Export
312 return { 299 return {
313 AutofillEditAddressOverlay: AutofillEditAddressOverlay 300 AutofillEditAddressOverlay: AutofillEditAddressOverlay
314 }; 301 };
315 }); 302 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698