Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 | 6 * @fileoverview |
| 7 * 'settings-menu' shows a menu with a hardcoded set of pages and subpages. | 7 * 'settings-menu' shows a menu with a hardcoded set of pages and subpages. |
| 8 */ | 8 */ |
| 9 Polymer({ | 9 Polymer({ |
| 10 is: 'settings-menu', | 10 is: 'settings-menu', |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 56 } else if (newRoute.page == 'basic') { | 56 } else if (newRoute.page == 'basic') { |
| 57 this.$.advancedMenu.selected = null; | 57 this.$.advancedMenu.selected = null; |
| 58 this.$.basicMenu.selected = this.currentRoute.section; | 58 this.$.basicMenu.selected = this.currentRoute.section; |
| 59 } else { | 59 } else { |
| 60 this.$.advancedMenu.selected = null; | 60 this.$.advancedMenu.selected = null; |
| 61 this.$.basicMenu.selected = null; | 61 this.$.basicMenu.selected = null; |
| 62 } | 62 } |
| 63 }, | 63 }, |
| 64 | 64 |
| 65 /** | 65 /** |
| 66 * @param {!Event} event | 66 * @param {!Event} event |
|
Dan Beam
2016/06/28 23:59:43
this should be target
dschuyler
2016/07/06 21:05:33
Done.
| |
| 67 * @private | 67 * @private |
| 68 */ | 68 */ |
| 69 ripple_: function(target) { | |
| 70 var ripple = document.createElement('paper-ripple'); | |
| 71 ripple.addEventListener('transitionend', function() { | |
| 72 Polymer.dom(target).removeChild(ripple); | |
| 73 }); | |
| 74 Polymer.dom(target).appendChild(ripple); | |
| 75 ripple.downAction(); | |
| 76 ripple.upAction(); | |
| 77 }, | |
| 78 | |
| 79 /** @private */ | |
| 69 openPage_: function(event) { | 80 openPage_: function(event) { |
|
Dan Beam
2016/06/28 23:59:43
document |event|
dschuyler
2016/07/06 21:05:33
Done.
| |
| 81 this.ripple_(event.currentTarget); | |
| 70 var submenuRoute = event.currentTarget.parentNode.dataset.page; | 82 var submenuRoute = event.currentTarget.parentNode.dataset.page; |
| 71 if (submenuRoute) { | 83 if (submenuRoute) { |
| 72 this.currentRoute = { | 84 this.currentRoute = { |
| 73 page: submenuRoute, | 85 page: submenuRoute, |
| 74 section: event.currentTarget.dataset.section, | 86 section: event.currentTarget.dataset.section, |
| 75 subpage: [], | 87 subpage: [], |
| 76 }; | 88 }; |
| 77 } | 89 } |
| 78 }, | 90 }, |
| 79 | 91 |
| 80 /** | 92 /** |
| 81 * @param {boolean} opened Whether the menu is expanded. | 93 * @param {boolean} opened Whether the menu is expanded. |
| 82 * @return {string} Which icon to use. | 94 * @return {string} Which icon to use. |
| 83 * @private | 95 * @private |
| 84 * */ | 96 * */ |
| 85 arrowState_: function(opened) { | 97 arrowState_: function(opened) { |
| 86 return opened ? 'settings:arrow-drop-up' : 'cr:arrow-drop-down'; | 98 return opened ? 'settings:arrow-drop-up' : 'cr:arrow-drop-down'; |
| 87 }, | 99 }, |
| 88 }); | 100 }); |
| OLD | NEW |