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

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

Issue 1630903002: material design user manager with create profile flow (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: addressed tommy's comments Created 4 years, 10 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 /**
Moe 2016/02/05 17:58:39 @tommy, not sure if this is the right way to quiet
tommycli 2016/02/08 18:45:19 I think when you create podRow variable, down on l
Moe 2016/02/09 00:15:34 Done.
Moe 2016/02/09 00:15:34 It worked. Thank you!
7 * A PodRow holding user pods.
8 * @constructor
9 * @extends {HTMLElement}
10 */
11 function PodRow() {}
12 /** Focuses a given user pod or clear focus when given null. */
13 PodRow.prototype.focusPod = function() {};
14 /** User Pods. */
15 PodRow.prototype.pods = null;
16
17 /**
18 * @fileoverview
19 * 'user-manager-tutorial' is the element that controls the tutorial steps for
20 * the user manager page.
21 *
22 * @element user-manager-tutorial
23 */
24 Polymer({
25 is: 'user-manager-tutorial',
26
27 properties: {
28 /**
29 * Controls whether the tutorial is showing.
30 * @type {boolean}
31 */
32 hidden: {
33 type: Boolean,
34 value: true
35 }
36 },
37
38 /** @override */
39 attached: function() {
40 this.steps_ = ['yourChrome',
41 'friends',
tommycli 2016/02/08 18:45:19 alignment
Moe 2016/02/09 00:15:34 Done.
42 'guests',
43 'complete',
44 'notYou'];
45 },
46
47 /**
48 * Determines whether a given step is displaying.
49 * @param {!string} currentStep Index of the current step
50 * @param {!string} step Name of the given step
51 * @private
52 * @return {boolean}
53 */
54 isStepHidden_: function(currentStep, step) {
55 return this.steps_[currentStep] != step;
56 },
57
58 /**
59 * Navigates to the next step.
60 * @private
61 */
62 next_: function() {
63 var nextStep = this.currentStep_ + 1;
64
65 // The last tutorial step is an information bubble that ends the tutorial.
66 if (nextStep >= this.steps_.length)
67 this.endTutorial_();
68 else
69 this.currentStep_ = nextStep;
70 },
71
72 /**
73 * Handler for the link in the last step. Takes user to the create-profile
74 * page in order to add a new profile.
75 * @param {!Event} event
76 * @private
77 */
78 handleAddUser_: function(event) {
79 this.endTutorial_();
80 // Event is caught by user-manager-pages.
81 this.fire('change-page', {page: 'create-user-page'});
82 },
83
84 /**
85 * Starts the tutorial.
86 */
87 startTutorial: function() {
88 /**
89 * Current tutorial step, index in the steps array.
90 * @type {number}
91 */
92 this.currentStep_ = 0;
93 this.hidden = false;
94
95 // If there's only one pod, show the steps to the side of the pod.
96 // Otherwise, center the steps and disable interacting with the pods
97 // while the tutorial is showing.
98
99 /** @extends {PodRow} */
100 var podRow = $('pod-row');
101
102 if (podRow.pods.length == 1) {
103 this.$.yourChrome.classList.add('single-pod');
104 this.$.complete.classList.add('single-pod');
105 }
106
107 podRow.focusPod(); // No focused pods.
108 $('inner-container').classList.add('disabled');
109 },
110
111 /**
112 * Ends the tutorial.
113 * @private
114 */
115 endTutorial_: function() {
116 $('inner-container').classList.remove('disabled');
117 this.hidden = true;
118 }
119
120 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698