Repository navigation
Expand file tree
/
Copy pathBoardController.js
More file actions
59 lines (51 loc) · 1.63 KB
/
Copy pathBoardController.js
File metadata and controls
59 lines (51 loc) · 1.63 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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
/**
* BoardController
*
* @module :: Controller
* @description :: Contains logic for handling requests.
*/
"use strict";
module.exports = {
/**
* Overrides for the settings in `config/controllers.js`
* (specific to BoardController)
*/
_config: {
blueprints: {
actions: true,
rest: false,
shortcuts: false
}
},
/**
* Taskboard main action.
*
* @param {Request} request Request object
* @param {Response} response Response object
*/
index: function(request, response) {
var projectId = parseInt(request.route.params.projectId, 10);
var sprintId = parseInt(request.route.params.sprintId, 10);
projectId = isNaN(projectId) ? 0 : projectId;
sprintId = isNaN(sprintId) ? 0 : sprintId;
// Project id not given, but user has cookie that contains last selected project
if (projectId === 0 && request.cookies.projectId) {
projectId = request.cookies.projectId;
}
// Project id given and sprint id not, check cookie for sprint id
if (sprintId === 0 && projectId > 0) {
var sprintCookie = "sprintId_" + projectId;
// Cookie founded
if (request.cookies[sprintCookie]) {
sprintId = request.cookies[sprintCookie];
}
}
projectId = isNaN(parseInt(projectId, 10)) ? 0 : projectId;
sprintId = isNaN(parseInt(sprintId, 10)) ? 0 : sprintId;
// Make view
response.view({
projectId: projectId,
sprintId: sprintId
});
}
};