aboutsummaryrefslogtreecommitdiff
path: root/roadmap/templates/roadmap/roadmap.html
blob: 9355503985a67d31ad6aa1545e01a739d592e387 (plain)
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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
{% extends 'roadmap/base.html' %}

{% block title %}
{{ current.name }} Roadmap
{% endblock %}

{% block headertitle %}
{{ current.name }} Roadmap
{% endblock %}

{% block feature %}
{% include "roadmap/_roadmap_legend.html" %}
{% endblock %}

{% block js_include %}
{{ block.super }}
<script type="text/javascript">
    google.load("visualization", "1");

    // Set callback to run when API is loaded
    google.setOnLoadCallback(drawVisualization);
    var zoomin = 10*2629740000;
    var startDate = new Date({{ roadmap_start.year }}, {{ roadmap_start.month }}, {{ roadmap_start.day }});
    var endDate = new Date({{ roadmap_end.year }}, {{ roadmap_end.month }}, {{ roadmap_end.day }});
    {% if epics %}
        {% for epic in epics %}
            {% if epic.is_valid_swimlane %}
                var vis{{ forloop.counter0 }};
                function createTimeline{{ forloop.counter0 }}() {
                    var data = [];
                    options = {
                        "width":  "100%",
                        "height": "auto",
                        "minHeight": "80",
                        "style": "dot", // optional
                        {% if forloop.first %}
                            "axisOnTop": true,
                        {% endif %}
                        "animate": false,
                        "animateZoom": false,
                        {% if not forloop.first and not forloop.last %}
                            "showMajorLabels": false,
                            "showMinorLabels" : false,
                        {% endif %}
                        "zoomMin": zoomin,
                        "min": startDate,
                        "max": endDate,
                        "selectable": false
                    };
                    {% if forloop.last and other_cards %}
                        options["showMajorLabels"] = false;
                        options["showMinorLabels"] = false;
                    {% endif %}
                    
                    // Instantiate our timeline object.
                    vis{{ forloop.counter0 }} = new links.Timeline(document.getElementById('{{ epic.key }}'));
                    {% for card in epic.implementedby.all %}
                        {% if card.is_valid %}
                            data.push({
                                "start": new Date("{{ card.start_date|date:'c' }}"),
                                {% if card.event_type == 'ONGOING' %}
                                    {% if card.end_date %}
                                        "end": new Date("{{ card.end_date|date:'c' }}"),
                                    {% else %}
                                        "end": endDate,
                                    {% endif %}
                                {% endif %}
                                "content": "<a class=\"confirm\" href=\"{{ card.url }}\">{{ card.summary }}</a>", 
                                "editable": false,
                                "className": "{{ card.style }}",
                            });
                        {% endif %}
                    {% endfor %}
                    google.visualization.events.addListener(vis{{ forloop.counter0 }}, 'rangechange', onrangechange{{ forloop.counter0 }});
                    google.visualization.events.addListener(vis{{ forloop.counter0 }}, 'ready', onready{{ forloop.counter0 }});
                    
                    // Draw our timeline with the created data and options
                    vis{{ forloop.counter0 }}.draw(data, options);
                }
                
                function onrangechange{{ forloop.counter0 }}() {
                    var range = vis{{ forloop.counter0 }}.getVisibleChartRange();
                    {% for e in epics %}
                        {% if e.is_valid_swimlane %}
                            {% if forloop.counter0 != forloop.parentloop.counter0 %}
                                vis{{ forloop.counter0 }}.setVisibleChartRange(range.start, range.end);
                            {% endif %}
                            {% if forloop.last and other_cards %}
                                vis{{ forloop.counter }}.setVisibleChartRange(range.start, range.end);
                            {% endif %}
                        {% endif %}
                    {% endfor %}
                }

                function onready{{ forloop.counter0 }}() {
                    $(".confirm").click(function (e) {
                        e.preventDefault();
                        var hrefAttribute = $(this).attr("href");
                        $("#dialog-confirm").dialog('option', 'buttons', {
                          "OK": function () {
                            window.location.href = hrefAttribute;
                          },
                          "Cancel": function () {
                            $(this).dialog("close");
                          }
                        });
                        $("#dialog-confirm").dialog("open");
                    });
                }

                {% if forloop.last and other_cards %}
                    var vis{{ forloop.counter }};
                    function createTimeline{{ forloop.counter }}() {
                        var data = [];
                        options = {
                            "width":  "100%",
                            "height": "auto",
                            "minHeight": "80",
                            "style": "dot", // optional
                            "animate": false,
                            "animateZoom": false,
                            "zoomMin": zoomin,
                            "min": startDate,
                            "max": endDate,
                            "selectable": false
                        };
                        
                        // Instantiate our timeline object.
                        vis{{ forloop.counter }} = new links.Timeline(document.getElementById('other-cards'));
                        {% for card in other_cards %}
                            {% if card.is_valid %}
                                data.push({
                                    "start": new Date("{{ card.start_date|date:'c' }}"),
                                    {% if card.event_type == 'ONGOING' %}
                                    "end": new Date(2015, 1, 1),
                                    {% endif %}
                                    "content": "<a class=\"confirm\" href=\"{{ card.url }}\">{{ card.summary }}</a>", 
                                    "editable": false,
                                    "className": "{{ card.style }}",
                                });
                            {% endif %}
                        {% endfor %}
                        google.visualization.events.addListener(vis{{ forloop.counter }}, 'rangechange', onrangechange{{ forloop.counter }});
                        google.visualization.events.addListener(vis{{ forloop.counter }}, 'ready', onready{{ forloop.counter }});
                        
                        // Draw our timeline with the created data and options
                        vis{{ forloop.counter }}.draw(data, options);
                    }
                    
                    function onrangechange{{ forloop.counter }}() {
                        var range = vis{{ forloop.counter }}.getVisibleChartRange();
                        {% for e in epics %}
                            {% if e.is_valid_swimlane %}
                                vis{{ forloop.counter0 }}.setVisibleChartRange(range.start, range.end);
                            {% endif %}
                        {% endfor %}
                    }

                    function onready{{ forloop.counter }}() {
                        $(".confirm").click(function (e) {
                            e.preventDefault();
                            var hrefAttribute = $(this).attr("href");
                            $("#dialog-confirm").dialog('option', 'buttons', {
                              "OK": function () {
                                window.location.href = hrefAttribute;
                              },
                              "Cancel": function () {
                                $(this).dialog("close");
                              }
                            });
                            $("#dialog-confirm").dialog("open");
                        });
                    }

                {% endif %}
            {% endif %}
        {% endfor %} // endfor epic
        
        function drawVisualization() {
            {% for epic in epics %}
                {% if epic.is_valid_swimlane %}
                    createTimeline{{ forloop.counter0 }}();
                    {% if forloop.last and other_cards %}
                        createTimeline{{ forloop.counter }}();
                    {% endif %}
                {% endif %}
            {% endfor %}
            {% for epic in epics %}
                {% if epic.is_valid_swimlane %}
                    onrangechange{{ forloop.counter0 }}();
                    {% if forloop.last and other_cards %}
                        onrangechange{{ forloop.counter }}();
                    {% endif %}
                {% endif %}
            {% endfor %}
        }
    {% else %}
        <!-- No epics, but other cards present -->
        function drawVisualization() {
            var data = [];
            options = {
                "width":  "100%",
                "height": "auto",
                "minHeight": "80",
                "style": "dot", // optional
                "axisOnTop": true,
                "animate": false,
                "animateZoom": false,
                "zoomMin": 33*2629740000, // 33* month in miliseconds
                "min": new Date(2011, 1, 1),
                "max": new Date(2015, 1, 1),
                "selectable": false
            };
            
            // Instantiate our timeline object.
            timeline = new links.Timeline(document.getElementById('other-cards'));
            {% for card in other_cards %}
                {% if card.is_valid %}
                    data.push({
                    "start": new Date("{{ card.start_date|date:'c' }}"),
                    {% if card.event_type == 'ONGOING' %}
                        "end": new Date(2015, 1, 1),
                    {% endif %}
                    "content": "<a class=\"confirm\" ref=\"{{ card.url }}\">{{ card.summary }}</a>", 
                    "editable": false,
                    "className": "{{ card.style }}",
                    });
                {% endif %}
            {% endfor %}
            google.visualization.events.addListener(timeline, 'ready', onready);
            timeline.draw(data, options);
        }
        function onready() {
            $(".confirm").click(function (e) {
                e.preventDefault();
                var hrefAttribute = $(this).attr("href");
                $("#dialog-confirm").dialog('option', 'buttons', {
                  "OK": function () {
                    window.location.href = hrefAttribute;
                  },
                  "Cancel": function () {
                    $(this).dialog("close");
                  }
                });
                $("#dialog-confirm").dialog("open");
            });
        }

    {% endif %}
   </script>
   <script type="text/javascript">
   $(document).ready(function() {
      $( "#close-sidebar" ).click( function() {
        $( "#sidebar" ).toggleClass("nosidebar");
        $( "#content" ).toggleClass("stdcontent");
        $( "#content" ).toggleClass("fullcontent");
        drawVisualization();
      });
   });
   </script>
   <script type="text/javascript" src="{{ STATIC_URL }}js/html2canvas.js"></script>
   <script type="text/javascript" src="{{ STATIC_URL }}js/FileSaver.js"></script>
   <script type="text/javascript" src="{{ STATIC_URL }}js/canvas-toBlob.js"></script>
   <script type="text/javascript">
   $(document).ready(function() {
      $( "#print-timeline" ).click( function() { 
        html2canvas($('#content'), {
          onrendered: function(canvas) {
            canvas.toBlob(function(blob) {
              saveAs(blob, "roadmap.png");
            });
          }
        });
      });
   });
   </script>

{% endblock %}

{% block sidebar %}
{% if cards %}
<div class="sidebarbox">
    <h2>No FixVersion</h2>
    <ul class="sidemenu">
    {% for card in cards %}
        {% if not card.is_valid and not card.fix_version %}
        <li><a class="confirm" href="{{ card.url }}">{{ card.status.name}} - {{ card.summary }}</a></li>
        {% endif %}
    {% endfor %}
    </ul>
</div>
{% endif %}
{% if epics %}
<div class="sidebarbox">
    <h2>Broken Epics</h2>
    <ul class="sidemenu">
    {% for card in epics %}
        {% if not card.is_valid_swimlane %}
        <li><a class="confirm" href="{{ card.url }}">{{ card.summary }}</a></li>
        {% endif %}
    {% endfor %}
    </ul>
</div>
{% endif %}
{% endblock %}

{% block main_content %}
<div id="tl_container" style="overflow-x: hidden; border-right: solid #444 1px;">
{% for epic in epics %}
  {% if epic.is_valid_swimlane %}
    {% if forloop.counter|divisibleby:2 %}
      <div style="background-color: #CCC;">
    {% else %}
      <div style="background-color: #FFF;">
    {% endif %}
      <div style="z-index: 1000; float: left; width: 150px; overflow: hidden;">
        <a class="confirm" style="white-space:nowrap;" href="{{ epic.url }}">{{ epic.summary }}</a> 
        {% if epic.is_v7 %} 
        <br/>
        <img src="{{ STATIC_URL }}img/32bit.png" title="ARMv7-A"/>
        {% endif %}
        {% if epic.is_v8 %}
        <img src="{{ STATIC_URL }}img/64bit.png" title="ARMv8-A"/>
        {% endif %}
      </div>
      <div style="margin-left:151px" id="{{ epic.key }}"></div>
    </div>
  {% endif %}
{% endfor %}
{% if other_cards %}
    <div style="background-color: #ff9999;">
       <div style="z-index: 1000; float: left; width: 150px; overflow: hidden;">Other</div>
       <div style="margin-left:151px" id="other-cards"></div>
    </div>
{% endif %}
</div>
{% endblock %}

{% block tools %}
{{ block.super }}
&gt; <a href="/component/{{ current.id }}"> Project ({{ current.name }}) </a> &gt; <a href="/component/{{ current.id }}/roadmap"> Roadmap ({{ current.name }}) </a>
{% endblock %}