Initial tour

This commit is contained in:
Henry 2016-04-10 17:14:34 -07:00
parent 54bf57d0e2
commit 47106be99c
9 changed files with 1561 additions and 8 deletions

View File

@ -45,7 +45,7 @@ define([
"representers": [
{
"implementation": DemoConductorRepresenter,
"depends": ["$q", "$compile", "conductorService", "views[]", "throttle"]
"depends": ["$q", "$compile", "conductorService", "views[]", "throttle", "navigationService"]
}
],
"components": [
@ -71,6 +71,7 @@ define([
{
"implementation": DemoInitializer,
"depends": [
"$timeout",
"representers[]"
]
}
@ -104,6 +105,16 @@ define([
]
}
}
],
"stylesheets": [
{
"stylesheetUrl": "css/hopscotch.css",
priority: "fallback"
},
{
"stylesheetUrl": "css/tour.css"
}
]
}
});

17
demo/lib/hopscotch/hopscotch.min.js vendored Executable file

File diff suppressed because one or more lines are too long

1
demo/lib/shepherd/shepherd.min.js vendored Executable file

File diff suppressed because one or more lines are too long

1443
demo/lib/tether/tether.js Executable file

File diff suppressed because it is too large Load Diff

BIN
demo/res/img/sprite-green.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

BIN
demo/res/img/sprite-orange.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

View File

@ -20,13 +20,40 @@
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global define*/
require.config({
/* paths: {
tether: "demo/lib/tether/tether",
shepherd: "demo/lib/shepherd/shepherd.min"
},
shim: {
tether: {
exports: "tether"
},
shepherd: {
deps: ["tether"],
exports: "shepherd"
}
}*/
paths: {
hopscotch: "demo/lib/hopscotch/hopscotch.min"
},
shim: {
tourist: {
exports: "hopscotch"
}
}
});
define(
["../../platform/features/conductor/src/ConductorRepresenter"],
function (ConductorRepresenter){
[
"../../platform/features/conductor/src/ConductorRepresenter",
"hopscotch",
"zepto"
],
function (ConductorRepresenter, hopscotch, $){
"use strict";
function DemoInitializer(representers) {
function DemoInitializer($timeout, representers) {
function indexOf(array, callback) {
return array.reduce(function(previous, element, index) {
@ -48,6 +75,53 @@ define(
}
removeRepresenter(ConductorRepresenter);
$timeout(function() {
var tour = {
id: "hello-hopscotch",
steps: [
{
title: "The Object Tree",
content: "The object tree contains telemetry and" +
" view <strong>objects</strong>",
target: document.querySelector("mct-tree ul.tree"),
placement: "right"
},
{
title: "Creating objects",
content: "New objects can be created under" +
" the <strong>My Items</strong> folder using the " +
" <strong>Create</strong> button",
target: document.querySelector(".create-btn"),
placement: "bottom"
},
{
title: "Composing objects",
content: "Objects can be composed by dragging" +
" them from the tree...",
target: document.querySelector("mct-tree" +
" ul.tree"),
placement: "right"
},
{
title: "Composing objects (cont.)",
content: "...into the current view",
target: document.querySelector(".object-holder-main"),
placement: "top"
},
{
title: "Create a layout",
content: "Try composing a <strong> Display Layout </strong> by creating it from the create menu, and then dragging some objects into it.",
target: document.querySelector(".create-btn"),
placement: "right"
}
]
};
hopscotch.endTour(true);
// Start the tour!
hopscotch.startTour(tour);
}, 3000);
}
return DemoInitializer;

View File

@ -48,6 +48,12 @@ define(
}, true);
}
function or(array) {
return array.reduce(function (previous, next) {
return previous || next;
}, false);
}
/**
* @param {DomainObject} candidate
* @returns {Promise} a promise resolved with true if the object
@ -66,7 +72,7 @@ define(
if (composition.length === 0 ) {
return fastPromise(false);
} else {
return self.$q.all(composition.map(self.allow.bind(self))).then(and);
return self.$q.all(composition.map(self.allow.bind(self))).then(or);
}
});
} else {

View File

@ -36,6 +36,7 @@ define(
conductorService,
views,
throttle,
navigationService,
scope,
element
) {
@ -43,6 +44,7 @@ define(
this.element = element;
this.views = views;
this.conductorPolicy = new ConductorPolicy($q);
this.navigationService = navigationService;
ConductorRepresenter.call(this,
throttle,
@ -57,7 +59,8 @@ define(
DemoConductorRepresenter.prototype.represent = function (representation, representedObject) {
var self = this;
if (this.views.indexOf(representation) !== -1) {
if (this.views.indexOf(representation) !== -1 && representedObject.getId() === this.navigationService.getNavigation().getId()) {
this.conductorPolicy.allow(representedObject).then(function (show) {
if (show && representation.type !== 'folder') {
ConductorRepresenter.prototype.represent.call(self, representation, representedObject);
@ -66,7 +69,5 @@ define(
}
};
DemoConductorRepresenter.prototype.destroy = function destroy() {};
return DemoConductorRepresenter;
});