OLD | NEW |
---|---|
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-folder-node', | 6 is: 'bookmarks-folder-node', |
7 | 7 |
8 properties: { | 8 properties: { |
9 /** @type {BookmarkTreeNode} */ | 9 /** @type {BookmarkTreeNode} */ |
10 item: Object, | 10 item: Object, |
11 | 11 |
12 isSelected: { | 12 isSelectedFolder: { |
13 type: Boolean, | 13 type: Boolean, |
14 value: false, | 14 value: false, |
15 reflectToAttribute: true, | 15 reflectToAttribute: true, |
16 }, | 16 }, |
17 }, | 17 }, |
18 | 18 |
19 /** | 19 /** |
20 * @private | 20 * @private |
21 * @return {string} | 21 * @return {string} |
22 */ | 22 */ |
23 getFolderIcon_: function() { | 23 getFolderIcon_: function() { |
24 return this.isSelected ? 'bookmarks:folder-open' : 'cr:folder'; | 24 return this.isSelectedFolder ? 'bookmarks:folder-open' : 'cr:folder'; |
25 }, | 25 }, |
26 | 26 |
27 /** | 27 /** |
28 * @private | 28 * @private |
29 * @return {string} | 29 * @return {string} |
30 */ | 30 */ |
31 getArrowIcon_: function() { | 31 getArrowIcon_: function() { |
32 return this.item.isOpen ? 'cr:arrow-drop-up' : | 32 return this.item.isOpen ? 'cr:arrow-drop-up' : |
33 'cr:arrow-drop-down'; | 33 'cr:arrow-drop-down'; |
34 }, | 34 }, |
(...skipping 12 matching lines...) Expand all Loading... | |
47 id: this.item.id, | 47 id: this.item.id, |
48 open: !this.item.isOpen, | 48 open: !this.item.isOpen, |
49 }); | 49 }); |
50 }, | 50 }, |
51 | 51 |
52 /** | 52 /** |
53 * @private | 53 * @private |
54 * @return {boolean} | 54 * @return {boolean} |
55 */ | 55 */ |
56 hasChildFolder_: function() { | 56 hasChildFolder_: function() { |
57 if (!this.item.children) | |
58 return false; | |
59 | |
jiaxi
2017/01/20 04:51:09
This helps when a folder has been removed but the
calamity
2017/01/23 00:44:27
Does this get recalculated properly? You may need
jiaxi
2017/01/23 06:14:46
Done.
| |
57 for (var i = 0; i < this.item.children.length; i++) { | 60 for (var i = 0; i < this.item.children.length; i++) { |
58 if (!this.item.children[i].url) | 61 if (!this.item.children[i].url) |
59 return true; | 62 return true; |
60 } | 63 } |
61 return false; | 64 return false; |
62 }, | 65 }, |
63 }); | 66 }); |
OLD | NEW |