diff --git a/seminar/templates/seminar/treenode.html b/seminar/templates/seminar/treenode.html index c8e542d6..eddb6243 100644 --- a/seminar/templates/seminar/treenode.html +++ b/seminar/templates/seminar/treenode.html @@ -16,7 +16,9 @@ dfsdfs {% block content %} +<form> {%with obj=tnldata depth=1 template_name="seminar/treenode_recursive.html" %} {%include template_name%} {%endwith%} +</form> {% endblock content %} diff --git a/seminar/templates/seminar/treenode_add_stub.html b/seminar/templates/seminar/treenode_add_stub.html index e53c070b..b4318d07 100644 --- a/seminar/templates/seminar/treenode_add_stub.html +++ b/seminar/templates/seminar/treenode_add_stub.html @@ -6,6 +6,6 @@ <option value="{{chld.0}}">{{chld.1}}</option> {% endfor %} </select> - <button>Přídat</button> + <button action="submit" formaction="{%url 'treenode_pridat' obj.node.id%}">Přidat</button> </div> {% endif %}{# appendablebleChildren #} diff --git a/seminar/templates/seminar/treenode_recursive.html b/seminar/templates/seminar/treenode_recursive.html index 81011cc5..1fad8d80 100644 --- a/seminar/templates/seminar/treenode_recursive.html +++ b/seminar/templates/seminar/treenode_recursive.html @@ -4,16 +4,16 @@ <div class="node_type"> {{obj.node}} {% if obj.node|deletable %} - <button>Smazat</button> + <button type="submit" formaction="{%url 'treenode_smazat' obj.node.id%}">Smazat</button> {% endif %} {% if obj.parent and obj.parent|editableSiblings %} - <button>Odvěsit na úroveň {{obj.parent.node}}</button> + <button type="submit" formaction="{%url 'treenode_odvesit' obj.node.id%}">Odvěsit na úroveň {{obj.parent.node}}</button> {% endif %} {% if obj|canPodvesitPred %} - <button>Podvěsit pod předchozí</button> - nejsou testovací data + <button type="submit" formaction="{%url 'treenode_podvesit_predchozi' obj.node.id%}">Podvěsit pod předchozí</button> - nejsou testovací data {% endif %} {% if obj|canPodvesitZa %} - <button>Podvěsit pod následující</button> - nejsou testovací data + <button type="submit" formaction="{%url 'treenode_podvesit_nasledujici' obj.node.id%}">Podvěsit pod následující</button> - nejsou testovací data {% endif %} @@ -42,7 +42,7 @@ {# ----------- Prohazujeme sousedy ----------#} <div class="pink"> {% if not forloop.last and ch|editableSiblings %} - <button>Prohodit ^ a v</button> + <button type="submit" formaction="{%url 'treenode_prohodit' ch.node.id%}">Prohodit ^ a v</button> {% endif %} </div> {% endfor %} diff --git a/seminar/urls.py b/seminar/urls.py index adf2cea5..6fa9a559 100644 --- a/seminar/urls.py +++ b/seminar/urls.py @@ -26,6 +26,12 @@ urlpatterns = [ path('cislo/<int:rocnik>.<int:cislo>/', views.CisloView.as_view(), name='seminar_cislo'), # odkomentované jenom kvůli testování archivu path('problem/<int:pk>/', views.ProblemView.as_view(), name='seminar_problem'), path('treenode/<int:pk>/', views.TreeNodeView.as_view(), name='seminar_treenode'), + path('treenode/editor/pridat/<int:pk>', views.TreeNodeView.as_view(), name='treenode_pridat'), + path('treenode/editor/smazat/<int:pk>', views.TreeNodeView.as_view(), name='treenode_smazat'), + path('treenode/editor/odvesit/<int:pk>', views.TreeNodeView.as_view(), name='treenode_odvesit'), + path('treenode/editor/podvesit/predchozi/<int:pk>', views.TreeNodeView.as_view(), name='treenode_podvesit_predchozi'), + path('treenode/editor/podvesit/nasledujici/<int:pk>', views.TreeNodeView.as_view(), name='treenode_podvesit_nasledujici'), + path('treenode/editor/prohodit/<int:pk>', views.TreeNodeView.as_view(), name='treenode_prohodit'), #path('problem/(?P<pk>\d+)/(?P<prispevek>\d+)/', views.PrispevekView.as_view(), name='seminar_problem_prispevek'), # Soustredeni