Skip to content
Snippets Groups Projects
Commit ba37e822 authored by tuhe's avatar tuhe
Browse files

Knowledgemap + task list + notepad list + threaded comments first issue

parent a96ba747
Branches
No related tags found
No related merge requests found
Showing
with 189 additions and 92 deletions
......@@ -31,6 +31,18 @@
<!-- We use a workaround here to be able to debug real world files in local by keeping json content as js variable. -->
<script type="text/javascript" src="{% block kmap_url %}{% static 'js/uwsn.js'%}{% endblock %}"></script> <!-- actual data etc. -->
<!-- now try to add mouseover stuff.
Context menus and mouseover.
https://ivis-at-bilkent.github.io/cytoscape.js-context-menus/demo-customized.html
https://stackoverflow.com/questions/54547927/show-and-hide-node-info-on-mouseover-in-cytoscape
-->
<!-- <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1, maximum-scale=1">-->
<!-- <script src="https://unpkg.com/cytoscape/dist/cytoscape.min.js"></script>-->
<script src="https://unpkg.com/popper.js@1.14.7/dist/umd/popper.js"></script>
<script src="https://cdn.jsdelivr.net/npm/cytoscape-popper@1.0.4/cytoscape-popper.min.js"></script>
<script src="https://unpkg.com/tippy.js@4.0.1/umd/index.all.min.js"></script>
<link rel="stylesheet" href="https://unpkg.com/tippy.js@4.0.1/index.css" />
<style>
body {
font-family: helvetica neue, helvetica, liberation sans, arial, sans-serif;
......@@ -171,6 +183,8 @@
}
</style>
</head>
<body>
<h1> Knowledge Map </div>
......
......@@ -3,11 +3,30 @@
{% load extras %}
{% load formatting %}
{% block content %}
{% load render_table from django_tables2 %}
<h3>Notepads</h3>
{% if table %}
{% render_table table %}
{% else %}
No notepads have been created yet. To create a notepad, you need to have an uncompleted task assigned to you at a meeting.
{% endif %}
{% endblock %}
{% block bar %}
{% box "Actions"%}
{% include "notepad/notepad_action_add_partial.html" %}
{% endbox %}
{% endblock %}
<!--- crap goes here
{% comment %}
<table>
{% include "common/table_th.html"%}
{% for row in table.rows %}
<tr>
{% for value in row %}
<td>
......@@ -17,7 +36,6 @@
{% case 3 %}{% user row.data.creator 16 %}
{% case 4 %}{{value|date}} ({{value|timesince}} ago)
{% endswitch %}
</td>
{% endfor %}
</tr>
......@@ -26,11 +44,5 @@
No notepads has been created.
{% endfor %}
</table>
{% endblock %}
{% block bar %}
{% box "Actions"%}
{% include "notepad/notepad_action_add_partial.html" %}
{% endbox %}
{% endblock %}
{% endcomment %}
-->
\ No newline at end of file
......@@ -9,12 +9,17 @@
{% block content %}
<h3>Tasks</h3>
{% if table %}
{% render_table table %}
{% else %}
No tasks have been created yet. First schedule a meeting. After the meeting has been held, the red leader can delegate tasks.
{% endif %}
<!--
Tue 2022: I copy-pasted the code from herE:
https://github.com/jieter/django-tables2/blob/8cd3470496b564c78ca94298b3588e1e79f5600f/django_tables2/templates/django_tables2/table.html#L24-L38
Necesary because I did not want to mix in tmeplatetags with the Table class, and don't have time for a better solution.
-->
{% comment %}
<table{% if table.attrs %} {{ table.attrs.as_html }}{% endif %}>
{% block table.thead %}
{% if table.show_header %}
......@@ -73,9 +78,7 @@ No task has been added yet. You must first create and complete a meeting before
{% endif %}
</table>
{% endcomment %}
{% endblock %}
{% block bar %}
<p>
......
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
import django_tables2 as tables
# from pages.models import *
from django_tables2.utils import A
class NotepadTable(tables.Table):
id = tables.Column(visible=False)
title = tables.Column(verbose_name='Title')
task = tables.Column(verbose_name="Task")
creator = tables.Column(verbose_name="Created by", accessor='creator')
created = tables.Column(verbose_name="Date")
title = tables.LinkColumn("notepad", args=[A("pk")])
task = tables.LinkColumn(viewname="task", args=[A("task.pk")])
creator = tables.TemplateColumn(template_code='{% load information %} {% user record.creator 16 %}', verbose_name='Created by', accessor='creator')
created = tables.TemplateColumn(template_code='{{value|date}} ({{value|timesince}} ago)', verbose_name="Date")
class TaskTable(tables.Table):
id = tables.Column(visible=False)
title = tables.Column(verbose_name='Title')
creator = tables.Column(verbose_name="Created by", accessor='creator')
title = tables.LinkColumn("task", args=[A("pk")])
# title = tables.Column(verbose_name='Title')
creator = tables.TemplateColumn(template_code='{% load information %} {% user record.creator 16 %}', verbose_name='Created by', accessor='creator')
# creator = tables.Column(verbose_name="Created by", accessor='creator')
status = tables.Column(verbose_name="Status", accessor='status')
meeting = tables.Column(verbose_name="meeting")
created = tables.Column(verbose_name="Date")
# meeting = tables.Column(verbose_name="meeting")
meeting = tables.LinkColumn(viewname="meeting", args=[A("meeting.pk")])
# created = tables.Column(verbose_name="Date")
created = tables.TemplateColumn(template_code='{{value|date}} ({{value|timesince}} ago)', verbose_name="Date")
class MeetingTable(tables.Table):
......
......@@ -71,7 +71,9 @@ urlpatterns = [
re_path(r'^meetings/$', views_meeting.meeting_list, name="meeting_list"),
re_path(r'^meetings/create/$', CreateView.as_view(template_name="meeting/meeting_create.html",form_class=MeetingStage0Form),name="meeting_create"),
re_path(r'^meetings/(?P<meeting_id>\d+)/$', views_meeting.meeting, name='meeting'),
# re_path(r'^meetings/(?P<pk>\d+)/stage5$', views_meeting.MeetingStage5Detail.as_view(), name='meeting_stage5'),
re_path(r'^meetings/(?P<pk>\d+)/$', views_meeting.meeting, name='meeting'),
# re_path(r'^meetings/(?P<pk>\d+)/$', views_meeting.meeting, name='meeting'),
re_path(r'^meetings/(?P<pk>\d+)/stage/1/update/$', views_meeting.MeetingStage1UpdateView.as_view(), name="meeting_stage1_update"),
re_path(r'^meetings/(?P<meeting_id>\d+)/stage/2/update/$', views_meeting.meeting_stage2_update, name="meeting_stage2_update"),
......
......@@ -31,7 +31,7 @@ def kmap2_static(request):
import json
# from django.http import JsonResponse
def node(id,label="Surface Boi", x=155,y=230, parent=None, style_class='nucleic acid feature', href=None):
def node(id,label="Surface Boi", x=155,y=230, parent=None, style_class='nucleic acid feature', href=None, mouseover=''):
n = dict()
data = dict(id=id,
bbox=dict(x=x, y=y, w=100, h=25),
......@@ -48,7 +48,7 @@ def node(id,label="Surface Boi", x=155,y=230, parent=None, style_class='nucleic
data['parent'] = parent
if href is not None:
data['href'] = href
data['mouseover'] = mouseover
data['border-color']="#555555"
data['background-color']="#f40582"
......@@ -137,29 +137,77 @@ def get_base():
"selector": "node[class = 'preject']",
"style": {
"shape": "ellipse",
"background-color": "#f7f7f7"
'padding': 10,
"background-color": "#f7f7f7",
'border-width': 1,
}
},
{
"selector": "node[class='preject create']",
"style": {
'padding': '4px',
'font-size': 10,
'font-weight': 'bold',
'color': '#003822',
"background-color": "#E6EFC2",
'border-width': '1px',
'border-color': 'black',
# 'border-width': 1px
}
},
{
"selector": 'task', #"node[class = 'task']", # This has no effect.
"selector": "node[class='root']",
"style": {
"shape": "ellipse",
'padding': '5px',
"shape": "rectangle",
"background-color": "#f7f7f7"
'font-size': 25,
'padding': 20,
'font-weight': 'bold',
'color': '#EEEEEE',
"background-color": "#666666",
'border-width': 2,
'border-color': 'black'
}
},
# {
# "selector": 'task', #"node[class = 'task']", # This has no effect.
# "style": {
# 'padding': '5px',
# "shape": "rectangle",
# "background-color": "#f7f7f7"
# }
# },
{
"selector": "node[class='task uncompleted']",
"style": {
'padding': '5px',
'border-width': 1,
"background-color": "#FFF6BF"
}
},
{
"selector": "node[class='task completed']",
"style": {
'padding': '5px',
'border-width': 1,
"background-color": "#E6EFC2"
}
},
{
"selector": "node[class='task.uncompleted']",
"selector": "node[class='task abandoned']",
"style": {
'padding': '5px',
"background-color": "#EEEE33"
'border-width': 1,
"background-color": "#FBE3E4"
}
},
{
"selector": "node[class='task.completed']",
"selector": "node[class='notepad']",
"style": {
'padding': '5px',
"background-color": "#33EE33"
'shape': 'barrel',
'border-width': 1,
"background-color": "#ADD8E6"
}
},
{
......@@ -171,10 +219,20 @@ def get_base():
"background-color": "#f4a582",
}
},
{
"selector": "node[class = 'submap']",
"style": {
# "shape": "ellipse",
# "font-size": 26,
# "font-weight": 'bold',
"background-color": "#EEEEFF",
'background-opacity': 0.9,
}
},
{
"selector": ":parent",
"style": {
"background-opacity": "0.333",
"background-opacity": "0.633",
"text-valign": "bottom",
"shape": "barrel",
"text-margin-y": "2px",
......@@ -268,7 +326,7 @@ def mm2(request, presentation_mode=0):
constrains = []
edges = []
delta = 200
constrain_nodes_ids = {}
constrains.append(constraint("root", "c0", gap=delta))
constrains.append(constraint("root", "c1", gap=delta))
......@@ -281,32 +339,6 @@ def mm2(request, presentation_mode=0):
#
constrains.append(constraint("root", "c2", horizontal=False, gap=delta))
constrains.append(constraint("c3", "root", horizontal=False, gap=delta))
# nodes.append(node("box0"))
# for i in range(4):
# print(models.CORNERS[i])
# constrains.append(constraint("root", "c1", gap=300))
# constrains.append(constraint("c3", "root", gap=300))
# constrains.append(constraint("c4", "root", gap=300))
#
# for i in range(3):
# c = constraint(f'c{i}', f'c{i+1}', horizontal=True, gap=100)
# constrains.append(c)
#
# for i in range(3):
# c = constraint(f'c3', f'c2', horizontal=False, gap=100)
# constrains.append(c)
# c1 = constraint('c1', 'c3', horizontal=True, gap=100)
# c2 = constraint('c0', 'c2', horizontal=True, gap=100)
# constrains.append(c1)
# constrains.append(c2)
data = get_base()
# data['elements']['nodes'].append(node('n01', label="Some stuff") )
......@@ -314,24 +346,26 @@ def mm2(request, presentation_mode=0):
# data['elements']['nodes'].append()
x0 = 0
y0 = 0
root = node('root', label="Project 4", x=0, y=0)
root = node('root', label=models.get_current_project().title, x=0, y=0,style_class='root')
nodes.append(root)
for c in [0, 3, 1, 2]:
cor = models.CORNERS[c]
# n = node(f'c{c}', label=cor[1], style_class='submap', x=x0-100, y=x0+100)
cx, cy = -400 if c in [2,3] else 400, 400 if c in [1,2] else -400
# n =
nodes.append(node(f'c{c}', parent=f'cc{c}', label=cor[1], x=cx,y=cy))
nodes.append(node(f'cc{c}', label=cor[1], x=cx+1,y=cy+1, style_class='submap'))
from django.urls.base import reverse_lazy
url = str(reverse_lazy("preject_create"))
# from django.urls.base import reverse_lazy
# url = str(reverse_lazy("preject_create"))
# cor[1]
nodes.append(node(f'c{c}', parent=f'cc{c}', label='Create new item', x=cx,y=cy,style_class="preject create",href=url))
nodes.append(node(f'cc{c}', label=cor[1], x=cx+1,y=cy+1, style_class='submap'))
# edges.append(edge('root', f'c{c}'))
# node = create_node(doc, cor[1], bubble=True, background_color="#d5d57f", color="#787805")
# node = font(doc, node, 16, bold=True)
# node = edge(doc, node, 8)
prejects = models.preject_in_project().filter(arena=cor[0])
# import math
# u = np.random.rand()
for p in prejects:
# continue
......@@ -340,12 +374,28 @@ def mm2(request, presentation_mode=0):
nodes.append(node(f'p{p.id}', p.title, parent=f'cc{c}', x=cx + np.random.rand()*ns, y=cy - np.random.rand()*ns,style_class='preject'))
# edges.append(edge(f"c{c}", f'p{p.id}'))
# nodes.append(n)
# if c not in constrain_nodes_ids:
# constrain_nodes_ids[c] = f'p{p.id}'
# if c not in constrain_nodes_ids:
# constrain_nodes_ids[c] = f'cn{c}'
# # from django.http import
#
# # print(url)
# nodes.append(node(f'cn{c}', "Add preject item", parent=f'cc{c}', x=cx + np.random.rand() * ns, y=cy - np.random.rand() * ns, style_class='preject create', href=url))
import textwrap
for t in models.task_in_project():
# continue
url = t.get_absolute_url()
nodes.append(node(f"t{t.id}", label=t.title, x=np.random.rand()*200, y=-np.random.rand()*200, href=url, style_class='task.uncompleted'))
nodes.append(node(f"t{t.id}", label=t.title, x=np.random.rand()*200, y=-np.random.rand()*200, href=url, style_class='task uncompleted',
mouseover=textwrap.shorten(t.text, 200, placeholder='...') ))
edges.append(edge(f'p{t.preject.id}', f"t{t.id}"))
for n in models.notepad_in_project():
# url = t.get_absolute_url()
nodes.append(node(f"n{n.id}", label=n.title, x=np.random.rand()*200, y=-np.random.rand()*200, href=n.get_absolute_url(), style_class='notepad',
mouseover=textwrap.shorten(n.text, 200, placeholder='...')))
edges.append(edge(f't{n.task.id}', f"n{n.id}"))
for n in models.notepad_in_project():
......
......@@ -147,11 +147,12 @@ def get_shalit_for_meeting(request, meeting):
class MeetingStage5Detail(DetailView):
# print("Fucking stage 5")
# meeting = Meeting.objects.get(id=meeting_id)
def get_queryset(self):
return meeting_in_project()
template_name = 'meeting/meeting_stage5_details.html',
template_name = 'meeting/meeting_stage5_details.html'
template_object_name = 'meeting'
# extra_context = vars,
......@@ -239,7 +240,7 @@ def meeting_process(request, meeting_id):
from django.views.generic import ListView, View, DetailView
from django.shortcuts import render
def meeting(request, meeting_id, stage='0', do_update=None):
def meeting(request, pk, stage='0', do_update=None):
"""
# MEETING is like this:
# Stage 0: The "hello and welcome-part: basic meeting view.
......@@ -248,6 +249,7 @@ def meeting(request, meeting_id, stage='0', do_update=None):
# Stage 3: The log items part.
# Stage 4: Last part of wizzard.
"""
meeting_id = pk
req_stage = int(stage)
meeting = meeting_in_project().get(pk=meeting_id)
stage_cur = meeting.stage()
......@@ -260,12 +262,22 @@ def meeting(request, meeting_id, stage='0', do_update=None):
# print("Now in meeting a...")
if req_stage > 0 and eval("meeting.stage%i == None"%(req_stage-1)): # Tue 2022: This line is absolute garbage but don't want to fix.
print("Exit 1.")
meeting.advance_stage()
# now we have req_state, which is correct. if
# we are in process, go to update (allway). if now, to go
# details (1 or 5, who cares.)
print("Stage of meeting is", req_stage, isinstance(req_stage, str))
if req_stage == 5:
MeetingStage5Detail.as_view()
# MeetingStage5Detail.as_view
# MeetingStage5Detail.pk_url_kwarg=meeting_id)
v = MeetingStage5Detail.as_view()
return v(request, pk=meeting_id)
print(request.GET)
w = v(request)
print(w)
return MeetingStage5Detail.as_view(kwarg={'pk': meeting_id, 'pk_url_kwarg': meeting_id})(request)
# return meeting_stage5(request, meeting_id)
print("Now in meeting b...", req_stage)
......
No preview for this file type
......@@ -135,7 +135,7 @@ class PublicThreadedCommentManager(ThreadedCommentManager):
(in other words, ``is_public = True``).
"""
def get_query_set(self):
return super(ThreadedCommentManager, self).get_query_set().filter(
return super(ThreadedCommentManager, self).get_queryset().filter(
Q(is_public = True) | Q(is_approved = True)
)
......
......@@ -23,8 +23,8 @@ def jqtree(request, content_type, object_id):
object = object_model.objects.get(id=object_id)
#get_object_for_this_type(username='Guido')
return render_to_response('threadedcomments/jqtree.html',locals())
# oh fuck.
return render('threadedcomments/jqtree.html',locals())
def _adjust_max_comment_length(form, field_name='comment'):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment