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

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..96883a3fd31caa39a78c12788103064db9ffe4e5
--- /dev/null
+++ b/chrome/browser/resources/settings/settings_page/settings_section.js
@@ -0,0 +1,36 @@
+// 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. Note, the page title and icon are not
+ * bound properties, but are instead directly retrieved from the content
+ * element.
+ *
+ * Example:
+ *
+ * <cr-settings-section>
+ * <!-- 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 &&
+ contentElement.properties != undefined) {
+ // Page title value is defined as a function.
+ this.pageTitle = contentElement.properties.pageTitle.value();
+ // Icon value is defined as a property.
+ this.icon = contentElement.properties.icon.value;
Dan Beam 2015/07/22 23:12:17 why are we setting titles in JS vs just with i18n-
michaelpg 2015/07/22 23:26:55 basically we bound the header to the title of the
+ }
+ }
+});

Powered by Google App Engine
This is Rietveld 408576698