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

Side by Side Diff: chrome/browser/resources/options2/deletable_item_list.js

Issue 9706052: [uber page] Fix row delete buttons on all lists in options. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 8 years, 9 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 */ var List = cr.ui.List; 6 /** @const */ var List = cr.ui.List;
7 /** @const */ var ListItem = cr.ui.ListItem; 7 /** @const */ var ListItem = cr.ui.ListItem;
8 8
9 /** 9 /**
10 * Creates a deletable list item, which has a button that will trigger a call 10 * Creates a deletable list item, which has a button that will trigger a call
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 /** 115 /**
116 * Callback for onclick events. 116 * Callback for onclick events.
117 * @param {Event} e The click event object. 117 * @param {Event} e The click event object.
118 * @private 118 * @private
119 */ 119 */
120 handleClick_: function(e) { 120 handleClick_: function(e) {
121 if (this.disabled) 121 if (this.disabled)
122 return; 122 return;
123 123
124 var target = e.target; 124 var target = e.target;
125 if (target.classList.contains('close-button')) { 125 if (target.classList.contains('row-delete-button')) {
126 var listItem = this.getListItemAncestor(target); 126 var listItem = this.getListItemAncestor(target);
127 var selected = this.selectionModel.selectedIndexes; 127 var selected = this.selectionModel.selectedIndexes;
128 128
129 // Check if the list item that contains the close button being clicked 129 // Check if the list item that contains the close button being clicked
130 // is not in the list of selected items. Only delete this item in that 130 // is not in the list of selected items. Only delete this item in that
131 // case. 131 // case.
132 var idx = this.getIndexOfListItem(listItem); 132 var idx = this.getIndexOfListItem(listItem);
133 if (selected.indexOf(idx) == -1) { 133 if (selected.indexOf(idx) == -1) {
134 this.deleteItemAtIndex(idx); 134 this.deleteItemAtIndex(idx);
135 } else { 135 } else {
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 */ 176 */
177 deleteItemAtIndex: function(index) { 177 deleteItemAtIndex: function(index) {
178 }, 178 },
179 }; 179 };
180 180
181 return { 181 return {
182 DeletableItemList: DeletableItemList, 182 DeletableItemList: DeletableItemList,
183 DeletableItem: DeletableItem, 183 DeletableItem: DeletableItem,
184 }; 184 };
185 }); 185 });
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