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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 | 86 |
87 /** | 87 /** |
88 * @param {!SettingsRoute} newRoute | 88 * @param {!SettingsRoute} newRoute |
89 * @private | 89 * @private |
90 */ | 90 */ |
91 currentRouteChanged_: function(newRoute) { | 91 currentRouteChanged_: function(newRoute) { |
92 var isSubpage = !!newRoute.subpage.length; | 92 var isSubpage = !!newRoute.subpage.length; |
93 | 93 |
94 this.showAboutPage_ = newRoute.page == 'about'; | 94 this.showAboutPage_ = newRoute.page == 'about'; |
95 | 95 |
96 this.showAdvancedToggle_ = !this.showAboutPage_ && !isSubpage; | 96 this.showAdvancedToggle_ = !this.showAboutPage_; |
97 | 97 |
98 this.showBasicPage_ = this.showAdvancedToggle_ || newRoute.page == 'basic'; | 98 this.showBasicPage_ = !this.showAboutPage_; |
99 | 99 |
100 this.showAdvancedPage_ = | 100 this.showAdvancedPage_ = this.showAdvancedPage_ || |
101 (this.isAdvancedMenuOpen_ && this.showAdvancedToggle_) || | 101 (this.isAdvancedMenuOpen_ && this.showAdvancedToggle_) || |
102 newRoute.page == 'advanced'; | 102 newRoute.page == 'advanced'; |
| 103 }, |
103 | 104 |
104 this.style.height = isSubpage ? '100%' : ''; | 105 subpageExpanded_: function() { |
| 106 this.showBasicPage_ = this.currentRoute.page == 'basic'; |
| 107 this.showAdvancedPage_ = !this.showBasicPage_; |
| 108 this.showAdvancedToggle_ = false; |
| 109 }, |
| 110 |
| 111 subpageCollapsing_: function() { |
| 112 this.currentRouteChanged_(this.currentRoute); |
105 }, | 113 }, |
106 | 114 |
107 /** @private */ | 115 /** @private */ |
108 toggleAdvancedPage_: function() { | 116 toggleAdvancedPage_: function() { |
109 this.fire('toggle-advanced-page', !this.isAdvancedMenuOpen_); | 117 this.fire('toggle-advanced-page', !this.isAdvancedMenuOpen_); |
110 }, | 118 }, |
111 }); | 119 }); |
OLD | NEW |