blob: 9c873a1999ed2f5337f610c4520a39ba09cbc76e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
// 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
* 'settings-menu' shows a menu with a hardcoded set of pages and subpages.
*
* Example:
*
* <settings-menu selected-page-id="{{selectedPageId}}">
* </settings-menu>
*
* @group Chrome Settings Elements
* @element settings-menu
*/
Polymer({
is: 'settings-menu',
properties: {
/**
* The current active route.
*/
currentRoute: {
type: Object,
notify: true,
observer: 'currentRouteChanged_',
},
},
/** @private */
currentRouteChanged_: function() {
var submenu = this.shadowRoot.querySelector(
'paper-submenu[data-page="' + this.currentRoute.page + '"]');
if (submenu)
submenu.opened = true;
},
/** @private */
openPage_: function(event) {
var submenuRoute = event.currentTarget.dataset.page;
if (submenuRoute) {
this.currentRoute = {
page: submenuRoute,
section: '',
subpage: [],
};
}
}
});
|