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-main' displays the selected settings page. | 7 * 'settings-main' displays the selected settings page. |
| 8 */ | 8 */ |
| 9 Polymer({ | 9 Polymer({ |
| 10 is: 'settings-main', | 10 is: 'settings-main', |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 102 | 102 |
| 103 /** | 103 /** |
| 104 * @param {!SettingsRoute} newRoute | 104 * @param {!SettingsRoute} newRoute |
| 105 * @private | 105 * @private |
| 106 */ | 106 */ |
| 107 currentRouteChanged_: function(newRoute) { | 107 currentRouteChanged_: function(newRoute) { |
| 108 var isSubpage = !!newRoute.subpage.length; | 108 var isSubpage = !!newRoute.subpage.length; |
| 109 | 109 |
| 110 this.showAboutPage_ = newRoute.page == 'about'; | 110 this.showAboutPage_ = newRoute.page == 'about'; |
| 111 | 111 |
| 112 this.showAdvancedToggle_ = !this.showAboutPage_ && !isSubpage; | 112 this.showAdvancedToggle_ = !this.showAboutPage_; |
| 113 | 113 |
| 114 this.showBasicPage_ = this.showAdvancedToggle_ || newRoute.page == 'basic'; | 114 this.showBasicPage_ = !this.showAboutPage_; |
| 115 | 115 |
| 116 this.showAdvancedPage_ = | 116 this.showAdvancedPage_ = this.showAdvancedPage_ || |
| 117 (this.isAdvancedMenuOpen_ && this.showAdvancedToggle_) || | 117 (this.isAdvancedMenuOpen_ && this.showAdvancedToggle_) || |
| 118 newRoute.page == 'advanced'; | 118 newRoute.page == 'advanced'; |
|
Dan Beam
2016/07/07 18:15:38
should all of these be computed separtely with the
michaelpg
2016/07/08 00:19:02
Done, great suggestion!
| |
| 119 }, | |
| 119 | 120 |
|
Dan Beam
2016/07/07 18:15:38
/** @private */
michaelpg
2016/07/08 00:19:02
Done.
| |
| 120 this.style.height = isSubpage ? '100%' : ''; | 121 subpageExpanded_: function() { |
| 122 this.showBasicPage_ = this.currentRoute.page == 'basic'; | |
| 123 this.showAdvancedPage_ = !this.showBasicPage_; | |
| 124 this.showAdvancedToggle_ = false; | |
| 125 }, | |
| 126 | |
| 127 subpageCollapsing_: function() { | |
| 128 this.currentRouteChanged_(this.currentRoute); | |
| 121 }, | 129 }, |
| 122 | 130 |
| 123 /** @private */ | 131 /** @private */ |
| 124 toggleAdvancedPage_: function() { | 132 toggleAdvancedPage_: function() { |
| 125 this.fire('toggle-advanced-page', !this.isAdvancedMenuOpen_); | 133 this.fire('toggle-advanced-page', !this.isAdvancedMenuOpen_); |
| 126 }, | 134 }, |
| 127 }); | 135 }); |
| OLD | NEW |