| 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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71 | 2×
2×
2×
2×
2×
2×
2×
2×
2×
2×
2×
2×
2×
2×
2×
2×
2×
60×
61×
61×
61×
61×
60×
60×
54×
2×
| var COURSES, COURSE_SETTINGS, DASHBOARD, EXTERNAL_BUILDER, HOMEWORK_BUILDER, PERFORMANCE_FORECAST, PLAN_REVIEW, PLAN_STATS, PRACTICE, READING_BUILDER, REMEMBERED_ROUTES, SCORES, STEP, TASK, _, destinationHelpers;
_ = require('underscore');
COURSE_SETTINGS = 'Course Settings';
COURSES = 'Courses';
DASHBOARD = 'Dashboard';
EXTERNAL_BUILDER = 'External Assignment';
HOMEWORK_BUILDER = 'Homework Builder';
PERFORMANCE_FORECAST = 'Performance Forecast';
SCORES = 'Scores';
PLAN_REVIEW = 'Plan Review';
PLAN_STATS = 'Plan Stats';
PRACTICE = 'Practice';
READING_BUILDER = 'Reading Builder';
STEP = 'Step';
TASK = 'Task';
REMEMBERED_ROUTES = {
dashboard: DASHBOARD,
viewStudentDashboard: DASHBOARD,
viewPerformanceForecast: PERFORMANCE_FORECAST,
viewTeacherDashboard: DASHBOARD,
viewScores: SCORES,
viewTeacherPerformanceForecast: PERFORMANCE_FORECAST,
viewStudentTeacherPerformanceForecast: PERFORMANCE_FORECAST,
taskplans: DASHBOARD,
calendarByDate: DASHBOARD,
calendarViewPlanStats: DASHBOARD,
courseSettings: COURSE_SETTINGS,
viewStats: PLAN_STATS,
reviewTask: PLAN_REVIEW,
reviewTaskPeriod: PLAN_REVIEW,
reviewTaskStep: PLAN_REVIEW
};
destinationHelpers = {
getDestinationName: function(routeName) {
return REMEMBERED_ROUTES[routeName];
},
routeFromPath: function(path, matchRoutes) {
var matchedRoute, ref;
matchedRoute = matchRoutes(path);
Eif (matchedRoute != null ? (ref = matchedRoute.routes) != null ? ref.length : void 0 : void 0) {
return _.last(matchedRoute.routes);
}
},
destinationFromPath: function(path, matchRoutes) {
var ref;
return this.getDestinationName((ref = this.routeFromPath.apply(this, arguments)) != null ? ref.name : void 0);
},
shouldRememberRoute: function(routeName, router) {
return !!this.destinationFromPath(routeName.path, router.match);
}
};
module.exports = destinationHelpers;
|