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

Side by Side Diff: chrome/browser/resources/chromeos/login/screen_supervised_user_creation.js

Issue 1411423006: Simplifed logic of showing/hiding cancel buttons on login screens. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Small fix. Created 5 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 /** 5 /**
6 * @fileoverview Legacy supervised user creation flow screen. 6 * @fileoverview Legacy supervised user creation flow screen.
7 */ 7 */
8 8
9 login.createScreen('SupervisedUserCreationScreen', 9 login.createScreen('SupervisedUserCreationScreen',
10 'supervised-user-creation', function() { 10 'supervised-user-creation', function() {
(...skipping 1082 matching lines...) Expand 10 before | Expand all | Expand 10 after
1093 this.updateText_(); 1093 this.updateText_();
1094 $('bubble').hide(); 1094 $('bubble').hide();
1095 if (!this.imagesRequested_) { 1095 if (!this.imagesRequested_) {
1096 chrome.send('supervisedUserGetImages'); 1096 chrome.send('supervisedUserGetImages');
1097 this.imagesRequested_ = true; 1097 this.imagesRequested_ = true;
1098 } 1098 }
1099 var pageNames = ['intro', 1099 var pageNames = ['intro',
1100 'manager', 1100 'manager',
1101 'username', 1101 'username',
1102 'import', 1102 'import',
1103 'error', 1103 'created',
1104 'created']; 1104 'error'];
Alexander Alekseev 2015/10/24 05:09:33 ?
dzhioev (left Google) 2015/10/24 06:13:53 Same order as in HTML. Doesn't really change anyth
1105 var pageButtons = {'intro' : 'start', 1105 var pageButtons = {'intro' : 'start',
1106 'error' : 'error', 1106 'error' : 'error',
1107 'import' : 'import', 1107 'import' : 'import',
1108 'import-password' : 'import', 1108 'import-password' : 'import',
1109 'created' : 'gotit'}; 1109 'created' : 'gotit'};
1110 this.hideStatus_(); 1110 this.hideStatus_();
1111 var pageToDisplay = visiblePage; 1111 var pageToDisplay = visiblePage;
1112 if (visiblePage == 'import-password') 1112 if (visiblePage == 'import-password')
1113 pageToDisplay = 'username'; 1113 pageToDisplay = 'username';
1114 1114
1115 for (i in pageNames) { 1115 for (i in pageNames) {
1116 var pageName = pageNames[i]; 1116 var pageName = pageNames[i];
1117 var page = $('supervised-user-creation-' + pageName); 1117 var page = $('supervised-user-creation-' + pageName);
1118 page.hidden = (pageName != pageToDisplay); 1118 page.hidden = (pageName != pageToDisplay);
1119 if (pageName == pageToDisplay) 1119 if (pageName == pageToDisplay)
1120 $('step-logo').hidden = page.classList.contains('step-no-logo'); 1120 $('step-logo').hidden = page.classList.contains('step-no-logo');
1121 } 1121 }
1122 1122
1123 for (i in this.buttonIds) { 1123 for (i in this.buttonIds) {
1124 var button = this.getScreenButton(this.buttonIds[i]); 1124 var button = this.getScreenButton(this.buttonIds[i]);
1125 button.hidden = button.pages.indexOf(visiblePage) < 0; 1125 button.hidden = button.pages.indexOf(visiblePage) < 0;
1126 button.disabled = false; 1126 button.disabled = false;
1127 } 1127 }
1128 1128
1129 var pagesWithCancel = ['intro', 'manager', 'username', 'import-password',
1130 'error', 'import'];
1131 $('login-header-bar').allowCancel =
1132 pagesWithCancel.indexOf(visiblePage) > -1;
1133 $('cancel-add-user-button').disabled = false;
1134
1135 this.getScreenElement('import-link').hidden = true; 1129 this.getScreenElement('import-link').hidden = true;
1136 this.getScreenElement('create-link').hidden = true; 1130 this.getScreenElement('create-link').hidden = true;
1137 1131
1138 if (pageButtons[visiblePage]) 1132 if (pageButtons[visiblePage])
1139 this.getScreenButton(pageButtons[visiblePage]).focus(); 1133 this.getScreenButton(pageButtons[visiblePage]).focus();
1140 1134
1141 this.currentPage_ = visiblePage; 1135 this.currentPage_ = visiblePage;
1142 1136
1143 if (visiblePage == 'manager' || visiblePage == 'intro') { 1137 if (visiblePage == 'manager' || visiblePage == 'intro') {
1144 $('supervised-user-creation-password').classList.remove( 1138 $('supervised-user-creation-password').classList.remove(
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
1322 return this.disabled_; 1316 return this.disabled_;
1323 }, 1317 },
1324 1318
1325 set disabled(value) { 1319 set disabled(value) {
1326 this.disabled_ = value; 1320 this.disabled_ = value;
1327 var controls = this.querySelectorAll('button,input'); 1321 var controls = this.querySelectorAll('button,input');
1328 for (var i = 0, control; control = controls[i]; ++i) { 1322 for (var i = 0, control; control = controls[i]; ++i) {
1329 control.disabled = value; 1323 control.disabled = value;
1330 } 1324 }
1331 $('login-header-bar').disabled = value; 1325 $('login-header-bar').disabled = value;
1332 $('cancel-add-user-button').disabled = false;
1333 }, 1326 },
1334 1327
1335 /** 1328 /**
1336 * Called by backend part to propagate list of possible managers. 1329 * Called by backend part to propagate list of possible managers.
1337 * @param {Array} userList - list of users that can be managers. 1330 * @param {Array} userList - list of users that can be managers.
1338 */ 1331 */
1339 loadManagers: function(userList) { 1332 loadManagers: function(userList) {
1340 $('supervised-user-creation-managers-block').hidden = false; 1333 $('supervised-user-creation-managers-block').hidden = false;
1341 this.managerList_.clearPods(); 1334 this.managerList_.clearPods();
1342 for (var i = 0; i < userList.length; ++i) 1335 for (var i = 0; i < userList.length; ++i)
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
1592 1585
1593 if (selectedIndex >= 0) 1586 if (selectedIndex >= 0)
1594 this.importList_.selectPod(this.importList_.pods[selectedIndex]); 1587 this.importList_.selectPod(this.importList_.pods[selectedIndex]);
1595 1588
1596 if (this.currentPage_ == 'username') 1589 if (this.currentPage_ == 'username')
1597 this.getScreenElement('import-link').hidden = (userList.length == 0); 1590 this.getScreenElement('import-link').hidden = (userList.length == 0);
1598 }, 1591 },
1599 }; 1592 };
1600 }); 1593 });
1601 1594
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698