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

Side by Side Diff: chrome/browser/resources/md_bookmarks/list.js

Issue 2614703003: [MD Bookmarks] Add search. (Closed)
Patch Set: Created 3 years, 11 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 Polymer({ 5 Polymer({
6 is: 'bookmarks-list', 6 is: 'bookmarks-list',
7 7
8 properties: { 8 properties: {
9 /** @type {BookmarkTreeNode} */ 9 /** @type {BookmarkTreeNode} */
10 selectedNode: Object, 10 selectedNode: Object,
11
12 searchTerm: String,
tsergeant 2017/01/06 02:43:54 Is it possible to make it so that the list doesn't
angelayang 2017/01/12 05:04:32 That makes a lot of sense yep
13
14 searchResult: {
15 type: Array,
16 },
17
18 displayedList_: Array,
11 }, 19 },
12 20
13 listeners: { 21 listeners: {
14 'toggle-menu': 'onToggleMenu_' 22 'toggle-menu': 'onToggleMenu_'
15 }, 23 },
16 24
25 observers: [
26 'updateDisplayList_(selectedNode.children, searchResult)',
27 ],
28
17 /** 29 /**
18 * @param {Event} e 30 * @param {Event} e
19 * @private 31 * @private
20 */ 32 */
21 onToggleMenu_: function(e) { 33 onToggleMenu_: function(e) {
22 var menu = /** @type {!CrActionMenuElement} */ ( 34 var menu = /** @type {!CrActionMenuElement} */ (
23 this.$.dropdown); 35 this.$.dropdown);
24 menu.showAt(/** @type {!Element} */ (e.detail.target)); 36 menu.showAt(/** @type {!Element} */ (e.detail.target));
25 }, 37 },
26 38
(...skipping 11 matching lines...) Expand all
38 /** @private */ 50 /** @private */
39 onDeleteTap_: function() { 51 onDeleteTap_: function() {
40 this.closeDropdownMenu_(); 52 this.closeDropdownMenu_();
41 }, 53 },
42 54
43 /** @private */ 55 /** @private */
44 closeDropdownMenu_: function() { 56 closeDropdownMenu_: function() {
45 var menu = /** @type {!CrActionMenuElement} */ ( 57 var menu = /** @type {!CrActionMenuElement} */ (
46 this.$.dropdown); 58 this.$.dropdown);
47 menu.close(); 59 menu.close();
48 } 60 },
61
62 /** @private */
63 updateDisplayList_: function() {
64 if (this.searchTerm == '') {
65 this.displayedList_ =
66 /** @type {!Array<!BookmarkTreeNode>} */ (this.selectedNode.children);
67 } else {
68 this.displayedList_ = this.searchResult;
69 }
70 },
49 }); 71 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698