| OLD | NEW |
| (Empty) |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 /** | |
| 6 * @fileoverview | |
| 7 * 'settings-breadcrumb' displays the breadcrumb. | |
| 8 * | |
| 9 * Example: | |
| 10 * | |
| 11 * <settings-breadcrumb current-route="{{currentRoute}}"> | |
| 12 * </settings-breadcrumb> | |
| 13 */ | |
| 14 Polymer({ | |
| 15 is: 'settings-breadcrumb', | |
| 16 | |
| 17 properties: { | |
| 18 /** | |
| 19 * The current active route. | |
| 20 */ | |
| 21 currentRoute: { | |
| 22 type: Object, | |
| 23 notify: true, | |
| 24 }, | |
| 25 | |
| 26 /** | |
| 27 * Page titles for the currently active route. | |
| 28 */ | |
| 29 currentRouteTitles: { | |
| 30 type: Object, | |
| 31 }, | |
| 32 }, | |
| 33 | |
| 34 /** @private */ | |
| 35 onTapPage_: function() { | |
| 36 this.currentRoute = { | |
| 37 page: this.currentRoute.page, | |
| 38 section: '', | |
| 39 subpage: [], | |
| 40 }; | |
| 41 }, | |
| 42 | |
| 43 /** @private */ | |
| 44 onTapSubpage_: function(event) { | |
| 45 var clickedIndex = event.target.dataset.subpageIndex; | |
| 46 this.currentRoute = { | |
| 47 page: this.currentRoute.page, | |
| 48 section: this.currentRoute.section, | |
| 49 subpage: this.currentRoute.subpage.slice(0, clickedIndex + 1), | |
| 50 }; | |
| 51 }, | |
| 52 }); | |
| OLD | NEW |