-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
47 changed files
with
985 additions
and
1,009 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
"use strict"; | ||
|
||
var createTour = require('../core/createTour'); | ||
|
||
var compareTour = createTour( | ||
{ | ||
id: "compare-tour", | ||
steps: [ | ||
{ | ||
target: "compare-crop-dropdown", | ||
content: "Use drop down menus to view one crop at a time.", | ||
placement: "bottom", | ||
}, | ||
{ | ||
target: "slide-controls", | ||
content: "Use these arrows to scroll through your scenarios.", | ||
placement: "top", | ||
arrowOffset: 250, | ||
xOffset: -230, | ||
}, | ||
{ | ||
target: "back-to-model", | ||
content: "Click here to return to the scenario tab.", | ||
placement: "top", | ||
xOffset: 40, | ||
}, | ||
] | ||
} | ||
); | ||
|
||
module.exports = { | ||
compareTour: compareTour, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
"use strict"; | ||
|
||
var _ = require('lodash'), | ||
hopscotch = require('hopscotch'), | ||
App = require('../app'), | ||
modelingModels = require('../modeling/models'); | ||
|
||
var Tour = { | ||
getStatus: function() { | ||
var step = localStorage.getItem(this.id); | ||
return step !== null ? parseInt(step) : null; | ||
}, | ||
|
||
shouldResume: function() { | ||
return localStorage.getItem(this.id) < this.steps.length; | ||
}, | ||
|
||
showTour: function() { | ||
if (hopscotch.getState()) { | ||
hopscotch.endTour(); | ||
} | ||
|
||
var step = this.getStatus(); | ||
if (step === null) { | ||
hopscotch.startTour(this); | ||
} else if (this.shouldResume()) { | ||
hopscotch.startTour(this, step); | ||
} | ||
}, | ||
|
||
showTourIfNecessary: function() { | ||
if (App.user.get('guest')) { | ||
this.showTour(); | ||
} else { | ||
var projects = new modelingModels.ProjectCollection(); | ||
projects | ||
.fetch() | ||
.done(_.bind(function() { | ||
if (projects.length > 1) { | ||
// Assume if the user has more than one project, | ||
// they don't need to see the tour | ||
return; | ||
} | ||
|
||
this.showTour(); | ||
}, this)); | ||
} | ||
}, | ||
|
||
initTour: function() { | ||
localStorage.setItem(this.id, 0); | ||
}, | ||
|
||
incrementStep: function() { | ||
localStorage.setItem(this.id, hopscotch.getCurrStepNum()); | ||
}, | ||
|
||
finishTour: function() { | ||
localStorage.setItem(this.id, this.steps.length); | ||
}, | ||
}; | ||
|
||
module.exports = function createTour(tour) { | ||
var tourObject = _.assign(Object.create(Tour), tour); | ||
|
||
// Make sure the hopscotch callbacks bind to the tour object | ||
tourObject.onStart = _.bind(tourObject.initTour, tourObject); | ||
tourObject.onNext = _.bind(tourObject.incrementStep, tourObject); | ||
tourObject.onEnd = _.bind(tourObject.finishTour, tourObject); | ||
tourObject.onClose = _.bind(tourObject.finishTour, tourObject); | ||
return tourObject; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.