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

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

Issue 8339014: Options: Disable the delete button when no profile is selected in personal settings. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Submitting patchset to disable delete button when there are no items to select. Created 9 years, 2 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 6
7 var OptionsPage = options.OptionsPage; 7 var OptionsPage = options.OptionsPage;
8 var ArrayDataModel = cr.ui.ArrayDataModel; 8 var ArrayDataModel = cr.ui.ArrayDataModel;
9 9
10 // State variables. 10 // State variables.
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 // Profiles. 55 // Profiles.
56 var profilesList = $('profiles-list'); 56 var profilesList = $('profiles-list');
57 options.personal_options.ProfileList.decorate(profilesList); 57 options.personal_options.ProfileList.decorate(profilesList);
58 profilesList.autoExpands = true; 58 profilesList.autoExpands = true;
59 59
60 profilesList.onchange = function(event) { 60 profilesList.onchange = function(event) {
61 var selectedProfile = profilesList.selectedItem; 61 var selectedProfile = profilesList.selectedItem;
62 var hasSelection = selectedProfile != null; 62 var hasSelection = selectedProfile != null;
63 var hasSingleProfile = profilesList.dataModel.length == 1; 63 var hasSingleProfile = profilesList.dataModel.length == 1;
64 $('profiles-manage').disabled = !hasSelection; 64 $('profiles-manage').disabled = !hasSelection;
65 $('profiles-delete').disabled = !hasSingleProfile && !hasSelection; 65 $('profiles-delete').disabled = hasSingleProfile ?
66 !hasSingleProfile : !hasSelection;
Evan Stade 2011/10/18 16:18:57 hasSingleProfile ? false : !hasSelection;
Miranda Callahan 2011/10/18 16:40:34 This looks to me like it doesn't change the logic
binji 2011/10/18 17:57:07 I agree w/ Miranda: !hasSelection || hasSinglePro
NaveenBobbili (Motorola) 2011/10/19 06:51:17 Done.
66 }; 67 };
67 $('profiles-create').onclick = function(event) { 68 $('profiles-create').onclick = function(event) {
68 chrome.send('createProfile'); 69 chrome.send('createProfile');
69 }; 70 };
70 $('profiles-manage').onclick = function(event) { 71 $('profiles-manage').onclick = function(event) {
71 var selectedProfile = self.getSelectedProfileItem_(); 72 var selectedProfile = self.getSelectedProfileItem_();
72 if (selectedProfile) 73 if (selectedProfile)
73 ManageProfileOverlay.showManageDialog(selectedProfile); 74 ManageProfileOverlay.showManageDialog(selectedProfile);
74 }; 75 };
75 $('profiles-delete').onclick = function(event) { 76 $('profiles-delete').onclick = function(event) {
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 /** 219 /**
219 * Display the correct dialog layout, depending on how many profiles are 220 * Display the correct dialog layout, depending on how many profiles are
220 * available. 221 * available.
221 * @param {number} numProfiles The number of profiles to display. 222 * @param {number} numProfiles The number of profiles to display.
222 */ 223 */
223 setProfileViewSingle_: function(numProfiles) { 224 setProfileViewSingle_: function(numProfiles) {
224 var hasSingleProfile = numProfiles == 1; 225 var hasSingleProfile = numProfiles == 1;
225 $('profiles-list').hidden = hasSingleProfile; 226 $('profiles-list').hidden = hasSingleProfile;
226 $('profiles-single-message').hidden = !hasSingleProfile; 227 $('profiles-single-message').hidden = !hasSingleProfile;
227 $('profiles-manage').hidden = hasSingleProfile; 228 $('profiles-manage').hidden = hasSingleProfile;
229 $('profiles-delete').disabled = !hasSingleProfile;
Miranda Callahan 2011/10/18 16:40:34 This seems like the opposite of what we should do.
228 $('profiles-delete').textContent = hasSingleProfile ? 230 $('profiles-delete').textContent = hasSingleProfile ?
229 templateData.profilesDeleteSingle : 231 templateData.profilesDeleteSingle :
230 templateData.profilesDelete; 232 templateData.profilesDelete;
231 }, 233 },
232 234
233 /** 235 /**
234 * Adds all |profiles| to the list. 236 * Adds all |profiles| to the list.
235 * @param {Array.<Object>} An array of profile info objects. 237 * @param {Array.<Object>} An array of profile info objects.
236 * each object is of the form: 238 * each object is of the form:
237 * profileInfo = { 239 * profileInfo = {
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
334 PersonalOptions.getInstance()[name + '_'](value); 336 PersonalOptions.getInstance()[name + '_'](value);
335 }; 337 };
336 }); 338 });
337 339
338 // Export 340 // Export
339 return { 341 return {
340 PersonalOptions: PersonalOptions 342 PersonalOptions: PersonalOptions
341 }; 343 };
342 344
343 }); 345 });
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698