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

Unified Diff: chrome/browser/resources/settings/settings_main/settings_main.js

Issue 2008843003: [MD settings] redesign of side nav (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix for open advanced Created 4 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/resources/settings/settings_main/settings_main.js
diff --git a/chrome/browser/resources/settings/settings_main/settings_main.js b/chrome/browser/resources/settings/settings_main/settings_main.js
index a7070d055de7346ce2f20152e1dde8525681c5d1..30bf903b663c096f5ea01804b2590c1a587d21b6 100644
--- a/chrome/browser/resources/settings/settings_main/settings_main.js
+++ b/chrome/browser/resources/settings/settings_main/settings_main.js
@@ -2,6 +2,27 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+Polymer({
+ is: 'advanced-page-toggle',
Dan Beam 2016/05/31 23:28:24 can this be implemented in simple DOM instead of c
dschuyler 2016/06/02 01:05:37 Done.
+
+ properties: {
+ /** @private */
+ isShown_: Boolean,
+ },
+
+ attached: function() {
+ document.addEventListener('toggle-advanced-page', function(e) {
+ this.isShown_ = e.detail;
+ }.bind(this));
+ },
+
+ /** @private */
+ toggleValue_: function() {
+ this.fire('toggle-advanced-page', !this.isShown_);
+ },
+});
+
+
/**
* @fileoverview
* 'settings-main' displays the selected settings page.
@@ -29,6 +50,7 @@ Polymer({
/**
* The current active route.
+ * @type {!SettingsRoute}
*/
currentRoute: {
type: Object,
@@ -40,19 +62,35 @@ Polymer({
showAdvancedPage_: Boolean,
/** @private */
+ showAdvancedToggle_: Boolean,
+
+ /** @private */
showBasicPage_: Boolean,
/** @private */
showAboutPage_: Boolean,
},
+ attached: function() {
+ document.addEventListener('toggle-advanced-page', function(e) {
+ this.showAdvancedPage_ = e.detail;
+ }.bind(this));
+ },
+
/**
* @param {!SettingsRoute} newRoute
* @private
*/
currentRouteChanged_: function(newRoute) {
+ var isSubpage = !!newRoute.subpage.length;
+
this.showAboutPage_ = newRoute.page == 'about';
- this.showAdvancedPage_ = newRoute.page == 'advanced';
- this.showBasicPage_ = newRoute.page == 'basic';
+
+ this.showBasicPage_ = !(newRoute.page == 'about' ||
Dan Beam 2016/05/31 23:28:24 can you use this.showAboutPage_ and this.showAdvan
dschuyler 2016/06/02 01:05:37 Done.
+ (isSubpage && newRoute.page == 'advanced'));
+
+ this.showAdvancedToggle_ = newRoute.page != 'about' && !isSubpage;
+
+ this.$.pageContainer.style.height = (isSubpage ? '100%' : '');
},
});

Powered by Google App Engine
This is Rietveld 408576698