OLD | NEW |
---|---|
(Empty) | |
1 /* Copyright 2016 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 Polymer({ | |
7 is: 'user-manager-tutorial', | |
8 | |
9 properties: { | |
10 hidden: { | |
11 type: Boolean, | |
12 value: true | |
13 } | |
14 }, | |
15 | |
16 ready: function() { | |
17 this.slides_ = ['yourChrome', | |
18 'friends', | |
anthonyvd
2016/01/29 15:50:17
nit: extra leading space.
Moe
2016/02/01 01:11:13
Done.
| |
19 'guests', | |
20 'complete', | |
21 'notYou']; | |
22 }, | |
23 | |
24 addUser: function(e) { | |
25 // Event is caught by user-manager-pages. | |
26 this.fire('change-page', {page: 'create-user-page'}); | |
27 }, | |
28 | |
29 isSlideHidden_: function(currentStep, slide) { | |
30 return this.slides_[currentStep] != slide; | |
31 }, | |
32 | |
33 next_: function() { | |
34 var nextStep = this.currentStep_ + 1; | |
35 | |
36 // The last tutorial step is an information bubble that ends the tutorial. | |
37 if (nextStep >= this.slides_.length) | |
38 this.endTutorial_(); | |
39 else | |
40 this.currentStep_ = nextStep; | |
41 }, | |
42 | |
43 handleAddUser_: function(e) { | |
44 this.endTutorial_(); | |
45 // Event is caught by user-manager-pages. | |
46 this.fire('change-page', {page: 'create-user-page'}); | |
47 }, | |
48 | |
49 startTutorial: function() { | |
50 /** | |
51 * Current tutorial step, index in the slides array. | |
52 * @type {number} | |
53 */ | |
54 this.currentStep_ = 0; | |
55 | |
56 this.hidden = false; | |
57 | |
58 // If there's only one pod, show the slides to the side of the pod. | |
59 // Otherwise, center the slides and disable interacting with the pods | |
60 // while the tutorial is showing. | |
61 if ($('pod-row').pods.length == 1) { | |
62 this.$.yourChrome.classList.add('single-pod'); | |
63 this.$.complete.classList.add('single-pod'); | |
64 } | |
65 | |
66 $('pod-row').focusPod(); // No focused pods. | |
67 $('inner-container').classList.add('disabled'); | |
68 }, | |
69 | |
70 endTutorial_: function(e) { | |
71 $('inner-container').classList.remove('disabled'); | |
72 this.hidden = true; | |
73 } | |
74 | |
75 }); | |
OLD | NEW |