Skip to content

Commit 5c77074

Browse files
adamcarhedenMarkusBordihn
authored andcommitted
Add tour-based tutorial feature. (#153)
* Add tour-based tutorial feature. Cwc files can contain and a step-by-step tutoral in the form of a Shepherd tour (http://github.hubspot.com/shepherd/docs/welcome/) in the metadata at tutorial/tour.
1 parent df15e2b commit 5c77074

File tree

14 files changed

+402
-289
lines changed

14 files changed

+402
-289
lines changed

src/addon/message/message.soy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* @fileoverview Message pane template
2+
* @fileoverview Message pane template
33
*
44
* @license Copyright 2018 The Coding with Chrome Authors.
55
*

src/addon/tutorial/tutorial.js

Lines changed: 0 additions & 183 deletions
This file was deleted.

src/addon/tutorial/tutorial.soy

Lines changed: 0 additions & 70 deletions
This file was deleted.

src/file_handler/file_loader.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,11 @@ cwc.fileHandler.FileLoader = function(helper) {
4141
/** @type {!Array} */
4242
this.acceptedFiles = [{
4343
'description': 'All supported files',
44-
'extensions': ['cwc', 'txt', 'html', 'htm', 'js', 'coffee', 'py', 'css'],
44+
'extensions': ['cwc', 'cwct', 'txt', 'html', 'htm', 'js', 'coffee', 'py',
45+
'css'],
4546
}, {
46-
'description': 'Coding with Chrome file (.cwc)',
47-
'extensions': ['cwc'],
47+
'description': 'Coding with Chrome file (.cwc, .cwct)',
48+
'extensions': ['cwc', 'cwct'],
4849
},
4950
{'extensions': ['coffee']},
5051
{'extensions': ['css']},

src/mode/modder.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ goog.provide('cwc.mode.Modder');
2323
goog.require('cwc.utils.mime.Type');
2424
goog.require('cwc.mode.Config');
2525
goog.require('cwc.mode.Type');
26+
goog.require('cwc.Tutorial');
2627
goog.require('cwc.utils.Helper');
2728
goog.require('cwc.utils.Logger');
2829

@@ -59,6 +60,9 @@ cwc.mode.Modder = function(helper) {
5960

6061
/** @private {string} */
6162
this.templatePath_ = '../resources/templates/';
63+
64+
/** @private {cwc.Tutorial} */
65+
this.tutorial_ = null;
6266
};
6367

6468

@@ -130,6 +134,12 @@ cwc.mode.Modder.prototype.setMode = function(mode) {
130134
sidebarInstance.clear();
131135
}
132136

137+
// Remove tutorial
138+
if (this.tutorial_) {
139+
this.tutorial_.clear();
140+
this.tutorial_ = null;
141+
}
142+
133143
this.log_.info('Initialize mode and decorate UI for', mode, '…');
134144
this.mode = mode;
135145
this.modder = modeConfig.getMod(this.helper);
@@ -183,6 +193,10 @@ cwc.mode.Modder.prototype.postMode = function(mode = this.mode) {
183193
if (fileInstance.hasLibraryFiles()) {
184194
this.syncLibrary();
185195
}
196+
197+
// Enable tutorials
198+
this.tutorial_ = new cwc.Tutorial(this.helper);
199+
this.tutorial_.render();
186200
}
187201

188202
// Event Handling
File renamed without changes.

0 commit comments

Comments
 (0)