Skip to content

Commit 3be3d39

Browse files
committed
update
1 parent 4f5b302 commit 3be3d39

File tree

2 files changed

+34
-6
lines changed

2 files changed

+34
-6
lines changed

tasks/templates/index.html

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
}
1414

1515
#gantt {
16-
overflow:scroll;
1716
}
1817
.popup-wrapper .title, .popup-wrapper .subtitle {
1918
color:white;
@@ -27,11 +26,36 @@
2726
<body>
2827
<section class="section">
2928
<div class="container">
30-
<div id="gantt" style="overflow:scroll;"></div>
29+
<div class="columns">
30+
<div class="column is-2">
31+
<div class="">
32+
33+
<h3>Projects</h3>
34+
<hr>
35+
36+
<ul class="">
37+
{%for p in projects %}
38+
{% if p.tasks.count > 0 %}
39+
40+
<li>
41+
<a href="?p={{p.id}}">
42+
{{p.name}}
43+
</a>
44+
</li>
45+
{% endif %}
46+
{% endfor %}
47+
</ul>
48+
</div>
49+
</div>
50+
<div class="column is-10">
51+
<div id="gantt" ></div>
3152
<button class="button" onclick="change(this)">Day</button>
3253
<button class="button" onclick="change(this)">Week</button>
3354
<button class="button" onclick="change(this)">Month</button>
34-
</div>
55+
56+
</div>
57+
</div>
58+
</div>
3559
</section>
3660
<script>
3761
var tasks;

tasks/views.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
from __future__ import unicode_literals
33
from django.shortcuts import render
44
from django.views.generic import TemplateView
5-
from tasks.models import Task
5+
from tasks.models import Task, Project
66
import json
77

88
class TaskView(TemplateView):
@@ -19,8 +19,12 @@ def process(self, t):
1919

2020
def get_context_data(self, **kwargs):
2121
ctx = super(TaskView, self).get_context_data(**kwargs)
22-
tasks = Task.objects.all()
23-
22+
id = self.request.GET.get("id",None)
23+
if not id:
24+
tasks = Task.objects.all()
25+
else:
26+
tasks = Task.objects.filter(project__id=id)
27+
ctx["projects"] = Project.objects.all()
2428
ctx["tasks"] = json.dumps([ self.process(t) for t in tasks])
2529
return ctx
2630

0 commit comments

Comments
 (0)