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

Side by Side Diff: chrome/browser/resources/md_user_manager/user_manager_tutorial.js

Issue 1725563003: MD user manager (learn more page, user manager tutorial) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: UI tweaks and bug fix Created 4 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
OLDNEW
(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 * @fileoverview 'user-manager-tutorial' is the element that controls the
7 * tutorial steps for the user manager page.
8 */
9 Polymer({
10 is: 'user-manager-tutorial',
11
12 behaviors: [
13 I18nBehavior,
14 ],
15
16 properties: {
17 /**
18 * True if the tutorial is currently hidden.
19 * @private {boolean}
20 */
21 hidden_: {
22 type: Boolean,
23 value: true
24 },
25
26 /**
27 * Current tutorial step ID.
28 * @type {string}
29 */
30 currentStep_: {
31 type: String,
32 value: ''
33 },
34
35 /**
36 * Enum values for the step IDs.
37 * @private {!Object<string, string>}
Dan Beam 2016/03/25 02:39:14 nit: only strings can be object keys in js, so thi
Moe 2016/03/29 18:54:39 Done.
38 */
39 steps_: {
40 readOnly: true,
41 type: Object,
42 value: {
43 YOUR_CHROME: 'yourChrome',
44 FRIENDS: 'friends',
45 GUESTS: 'guests',
46 COMPLETE: 'complete',
47 NOT_YOU: 'notYou'
48 }
49 }
50 },
51
52 /**
53 * Determines whether a given step is displaying.
54 * @param {string} currentStep Index of the current step
55 * @param {string} step Name of the given step
56 * @return {boolean}
57 * @private
58 */
59 isStepHidden_: function(currentStep, step) {
60 return currentStep != step;
61 },
62
63 /**
64 * Navigates to the next step.
65 * @param {!Event} event
66 * @private
67 */
68 onNextTap_: function(event) {
69 var element = Polymer.dom(event).rootTarget;
70 this.currentStep_ = element.dataset.next;
71 },
72
73 /**
74 * Handler for the link in the last step. Takes user to the create-profile
75 * page in order to add a new profile.
76 * @param {!Event} event
77 * @private
78 */
79 onAddUserTap_: function(event) {
80 this.onDissmissTap_();
81 // Event is caught by user-manager-pages.
82 this.fire('change-page', {page: 'create-user-page'});
83 },
84
85 /**
86 * Starts the tutorial.
87 */
88 startTutorial: function() {
89 this.currentStep_ = this.steps_.YOUR_CHROME;
90 this.hidden_ = false;
91
92 // If there's only one pod, show the steps to the side of the pod.
93 // Otherwise, center the steps and disable interacting with the pods
94 // while the tutorial is showing.
95 var podRow = /** @type {{focusPod: !function(), pods: !Array}} */
Dan Beam 2016/03/25 02:39:14 i still think this is a bummer to cast to instead
Moe 2016/03/29 18:54:39 I agree. I did try adding a compiled_resources2.gy
96 ($('pod-row'));
97
98 this.classList.toggle('single-pod', podRow.pods.length == 1);
99
100 podRow.focusPod(); // No focused pods.
101 $('inner-container').classList.add('disabled');
102 },
103
104 /**
105 * Ends the tutorial.
106 * @private
107 */
108 onDissmissTap_: function() {
109 $('inner-container').classList.remove('disabled');
110 this.hidden_ = true;
111 }
112 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698