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

Side by Side Diff: pkg/polymer/lib/elements/polymer-ui-submenu-item/polymer-ui-submenu-item.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 Toolkitchen 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-submenu-item is a menu-item that can contains other menu-items.
12 * It should be used in conjunction with polymer-ui-menu or
13 * polymer-ui-sibebar-menu.
14 *
15 * Example:
16 *
17 * <polymer-ui-menu selected="0">
18 * <polymer-ui-submenu-item icon="settings" label="Topics">
19 * <polymer-ui-menu-item label="Topics 1"></polymer-ui-menu-item>
20 * <polymer-ui-menu-item label="Topics 2"></polymer-ui-menu-item>
21 * </polymer-ui-submenu-item>
22 * <polymer-ui-submenu-item icon="settings" label="Favorites">
23 * <polymer-ui-menu-item label="Favorites 1"></polymer-ui-menu-item>
24 * <polymer-ui-menu-item label="Favorites 2"></polymer-ui-menu-item>
25 * <polymer-ui-menu-item label="Favorites 3"></polymer-ui-menu-item>
26 * </polymer-ui-submenu-item>
27 * </polymer-ui-menu>
28 *
29 * @class polymer-ui-submenu-item
30 * @extends polymer-ui-menu-item
31 */
32 -->
33 <link rel="import" href="../polymer/polymer.html">
34 <link rel="import" href="../polymer-ui-theme-aware/polymer-ui-theme-aware.html">
35 <link rel="import" href="../polymer-ui-menu-item/polymer-ui-menu-item.html">
36 <link rel="import" href="../polymer-ui-menu/polymer-ui-menu.html">
37 <link rel="import" href="../polymer-collapse/polymer-collapse.html">
38
39 <polymer-element name="polymer-ui-submenu-item" extends="polymer-ui-menu-item" a ttributes="active selected selectedItem">
40 <template>
41 <link rel="stylesheet" href="polymer-ui-submenu-item.css">
42 <polymer-ui-menu-item id="item" src="{{src}}" label="{{label}}" icon="{{icon }}" active?="{{active}}" on-tap="{{activate}}">
43 <content select=".item-content"></content>
44 </polymer-ui-menu-item>
45 <polymer-ui-menu id="menu" selected="{{selected}}" selectedItem="{{selectedI tem}}">
46 <content></content>
47 </polymer-ui-menu>
48 <polymer-collapse targetId="menu" closed="{{collapsed}}"></polymer-collapse>
49 </template>
50 <script>
51 Polymer('polymer-ui-submenu-item', {
52 active: false,
53 collapsed: true,
54 get items() {
55 return this.$.menu.items;
56 },
57 hasItems: function() {
58 return !!this.items.length;
59 },
60 unselectAllItems: function() {
61 this.$.menu.selected = null;
62 this.$.menu.clearSelection();
63 },
64 activeChanged: function() {
65 if (this.hasItems()) {
66 this.collapsed = !this.active;
67 }
68 if (!this.active) {
69 this.unselectAllItems();
70 }
71 this.$.item.classList.toggle('no-active-bg', this.hasItems());
72 },
73 activate: function() {
74 if (this.hasItems() && this.active) {
75 this.collapsed = !this.collapsed;
76 this.unselectAllItems();
77 this.fire("polymer-select", {isSelected: true, item: this});
78 }
79 },
80 getItemHeight: function() {
81 return this.$ && this.$.item && this.$.item.offsetHeight;
82 }
83 });
84 </script>
85 </polymer-element>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698