-
Notifications
You must be signed in to change notification settings - Fork 18
/
workbench.html
100 lines (81 loc) · 2.79 KB
/
workbench.html
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
<!DOCTYPE html>
<html>
<head>
<title>Workbench</title>
<script type="text/javascript" src="src/Card.js"></script>
<script type="text/javascript" src="src/CardView.js"></script>
<link rel="stylesheet" title="default" type="text/css" href="styles/ticket-default.css">
<link rel="alternate stylesheet" title="new" type="text/css" href="styles/ticket-new.css">
<script type="text/javascript" src="src/styleswitcher.js"></script>
</head>
<body>
Style:
<a href="#" onclick="setActiveStyleSheet('default');return false;">default</a>
<a href="#" onclick="setActiveStyleSheet('new');return false;">new</a>
<div data-ticket='{
"issueId": "PCTCUT-547",
"issueUrl": "https://jira.caplin.com/browse/PCTCUT-547",
"issueType": "Story",
"checkBoxes": ["Doc", "Demo", "Review"],
"estimate": 2,
"summary": "A marvelous summary.",
"component": "COMP",
"tag": "TAG",
"parentIssueId": "PCTCUT-444",
"parentSummary": "A parent summary",
"parentEnabled": true,
"componentEnabled": true,
"tagEnabled": true,
"colorEnabled": true,
"qrCodeEnabled": true
}'></div>
<div data-ticket='{
"issueId": "PCTCUT-523",
"issueUrl": "https://jira.caplin.com/browse/PCTCUT-523",
"issueType": "Story",
"checkBoxes": ["Doc", "Demo", "Review"],
"estimate": 2,
"summary": "A marvelous summary.",
"component": "COMP",
"tag": "TAG",
"parentIssueId": "PCTCUT-444",
"parentSummary": "A parent summary",
"componentEnabled": true,
"tagEnabled": true
}'></div>
<div data-ticket='{
"issueId": "PCTCUT-511",
"issueUrl": "https://jira.caplin.com/browse/PCTCUT-511",
"issueType": "Technical task",
"checkBoxes": ["Rel Note", "Wiki", "Review"],
"estimate": 3,
"summary": "A tech task.",
"component": "COMP",
"tag": "TAG",
"componentEnabled": true,
"tagEnabled": true,
"colorEnabled": true,
"qrCodeEnabled": true
}'></div>
<script type="text/javascript">
var elementMap = {};
var parentMap = {};
var viewMap = {};
var tickets = document.querySelectorAll('[data-ticket]');
for (var i = 0; i < tickets.length; ++i) {
var ticketElement = tickets[i];
var data = JSON.parse(ticketElement.getAttribute('data-ticket') || "{}");
var ticket = new Card(card.issueId, card.issueUrl, card.issueType, card.estimate, card.summary, card.component, card.tag, 6, card.parentIssueId);
var view = new CardView(ticket, parentMap, card.checkBoxes, card.parentEnabled, card.componentEnabled, card.tagEnabled, card.colorEnabled, card.qrCodeEnabled);
// fake up a parent.
parentMap[ticket.parentIssueId] = {summary: card.parentSummary};
elementMap[ticket.issueId] = ticketElement;
viewMap[ticket.issueId] = view;
}
for (var issueId in viewMap) {
var view = viewMap[issueId];
elementMap[issueId].appendChild(view.getElement());
}
</script>
</body>
</html>