This repository was archived by the owner on May 20, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcontroller.js
More file actions
42 lines (33 loc) · 1.28 KB
/
controller.js
File metadata and controls
42 lines (33 loc) · 1.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
(function() {
define([
'backbone.marionette',
'app',
'entities/lessons'
],
function(Marionette, App){
// Define our Sub Module under App
var List = App.module("LessonApp.LearnApp.StructureApp.List");
/*
** Attach a public Controller object which allows our parent app (module) to call into
*/
List.Controller = {
listStructure: function(slideIndex) {
var deferred = App.request('lesson:learn:setup:deferred');
var state = deferred.state();
var indexModifier = App.request('lesson:learn:views:index', 'structure');
slideIndex = (parseInt(slideIndex) + parseInt(indexModifier) - 1);
// If the deferred object is still pending add it to the queue
// If not, go to the proper slide
if (state === 'pending') {
deferred.then(function() {
App.trigger('lesson:learn:start:slide', slideIndex);
});
} else if (state === 'resolved') {
App.trigger('lesson:learn:goTo:slide', slideIndex);
}
}
};
// Return the module
return List;
});
}).call(this);