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

Side by Side Diff: pkg/polymer/lib/elements/polymer-ui-menu/polymer-ui-menu.html

Issue 175443005: [polymer] import all elements (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: updated from bower Created 6 years, 9 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 <!--
2 Copyright 2013 The Polymer Authors. All rights reserved.
3 Use of this source code is governed by a BSD-style
4 license that can be found in the LICENSE file.
5 -->
6 <!--
7 /**
8 * @module Polymer UI Elements
9 */
10 /**
11 * polymer-ui-menu is a polymer-selector with theme propagation. It styles to l ook like
12 * a menu and should be used in conjunction with polymer-ui-menu-item.
13 *
14 * Example:
15 *
16 * <polymer-ui-menu selected="0">
17 * <polymer-ui-menu-item icon="settings" label="Settings"></polymer-ui-men u-item>
18 * <polymer-ui-menu-item icon="dialog" label="Dialog"></polymer-ui-menu-it em>
19 * <polymer-ui-menu-item icon="search" label="Search"></polymer-ui-menu-it em>
20 * </polymer-ui-menu>
21 *
22 * The "selectedItem" property returns the currently selected item.
23 *
24 * Example:
25 *
26 * <polymer-ui-menu selected="0" selectedItem="{{item}}">
27 * <polymer-ui-menu-item icon="settings" label="Settings"></polymer-ui-men u-item>
28 * <polymer-ui-menu-item icon="dialog" label="Dialog"></polymer-ui-menu-it em>
29 * <polymer-ui-menu-item icon="search" label="Search"></polymer-ui-menu-it em>
30 * </polymer-ui-menu>
31 *
32 * <div>selected label: {{item.label}}</div>
33 *
34 * The event "polymer-select" can also be used to listen for selection change.
35 *
36 * Example:
37 *
38 * <polymer-ui-menu selected="0" on-polymer-select="{{selectAction}}">
39 * <polymer-ui-menu-item icon="settings" label="Settings"></polymer-ui-men u-item>
40 * <polymer-ui-menu-item icon="dialog" label="Dialog"></polymer-ui-menu-it em>
41 * <polymer-ui-menu-item icon="search" label="Search"></polymer-ui-menu-it em>
42 * </polymer-ui-menu>
43 *
44 * ...
45 *
46 * selectAction: function(e, detail) {
47 * if (detail.isSelected) {
48 * var selectedItem = detail.item;
49 * ...
50 * }
51 * }
52 *
53 * @class polymer-ui-menu
54 * @extends polymer-selector
55 */
56 -->
57 <link rel="import" href="../polymer/polymer.html">
58 <link rel="import" href="../polymer-selector/polymer-selector.html">
59 <link rel="import" href="../polymer-ui-theme-aware/polymer-ui-theme-aware.html">
60
61 <polymer-element name="polymer-ui-menu" extends="polymer-selector" attributes="t heme" on-polymer-select="{{selectionChange}}">
62 <template>
63 <link rel="stylesheet" href="polymer-ui-menu.css">
64 <shadow></shadow>
65 </template>
66 <script>
67 Polymer('polymer-ui-menu', {
68 activeTheme: '',
69 validateTheme: PolymerUI.validateTheme,
70 enteredView: function() {
71 this.validateTheme();
72 },
73 themeChanged: function() {
74 this.activeTheme = this.theme;
75 },
76 activeThemeChanged: function(old) {
77 this.classList.switch(old, this.activeTheme);
78 },
79 selectionChange: function(e, detail) {
80 if (detail.isSelected) {
81 var i = detail.item;
82 // find nested selected item
83 while (i.selectedItem) {
84 i = i.selectedItem;
85 }
86 this.selectedItem = i;
87 }
88 }
89 });
90 </script>
91 </polymer-element>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698