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

Unified Diff: chrome/browser/resources/settings/settings_page/settings_section.js

Issue 1241363002: Settings Rewrite: Make a common settings-section component. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@0300-webui-settings-structure
Patch Set: Created 5 years, 5 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_page/settings_section.js
diff --git a/chrome/browser/resources/settings/settings_page/settings_section.js b/chrome/browser/resources/settings/settings_page/settings_section.js
new file mode 100644
index 0000000000000000000000000000000000000000..0ca2b7e7e6bef2f8fa03a6569bed9c6755b9dd20
--- /dev/null
+++ b/chrome/browser/resources/settings/settings_page/settings_section.js
@@ -0,0 +1,34 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+/**
+ * @fileoverview
+ * 'cr-settings-section' shows a paper material themed section with a header
+ * which shows its page title and icon.
+ *
+ * Example:
+ *
+ * <cr-settings-section page-title="[[pageTitle]]", icon="[[icon]]">
michaelpg 2015/07/22 21:01:32 no comma
tommycli 2015/07/22 23:54:38 Done.
+ * <!-- Insert your section controls here -->
+ * </cr-settings-section>
+ *
+ * @group Chrome Settings Elements
+ * @element cr-settings-section
+ */
+Polymer({
+ is: 'cr-settings-section',
+
+ ready: function() {
+ // We use this trickery to retrieve the content page's title and icon, as
+ // Polymer does not support directly binding content element properties.
+ var contentElement = this.getContentChildren()[0];
+ if (contentElement !== undefined &&
michaelpg 2015/07/22 21:01:32 nit: use != instead of !==
tommycli 2015/07/22 23:54:37 Deleted this.
+ contentElement.properties !== undefined) {
+ // Page title value is defined as a function.
+ this.pageTitle = contentElement.properties.pageTitle.value();
michaelpg 2015/07/22 21:01:32 this means updating a page's pageTitle or icon has
michaelpg 2015/07/22 21:01:32 does contentElement.pageTitle not work?
Dan Beam 2015/07/22 21:56:31 ^ this
Dan Beam 2015/07/22 21:56:31 why are we duplicating the title to begin with? c
Dan Beam 2015/07/22 22:03:07 scratch the parent part, thought this was a subpag
tommycli 2015/07/22 23:54:37 Deleted this.
tommycli 2015/07/22 23:54:38 Deleted this.
+ // Icon value is defined as a property.
+ this.icon = contentElement.properties.icon.value;
+ }
+ }
+});

Powered by Google App Engine
This is Rietveld 408576698