Browse Source

Pokus o mockup exitacniho rozhrani pro TreeNody.

export_seznamu_prednasek
parent
commit
d099f70985
  1. 3
      mamweb/templates/base.html
  2. 2
      seminar/templates/seminar/archiv/base.html
  3. 14
      seminar/templates/seminar/treenode.html
  4. 35
      seminar/templates/seminar/treenode_recursive.html
  5. 35
      seminar/templatetags/treenodes.py

3
mamweb/templates/base.html

@ -6,7 +6,8 @@
<title>{% block title %}{% block nadpis1a %}{% endblock %} – Korespondenční seminář M&amp;M{% endblock title %}</title> <title>{% block title %}{% block nadpis1a %}{% endblock %} – Korespondenční seminář M&amp;M{% endblock title %}</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="shortcut icon" href="{% static 'images/MATFYZ_MM_barevne.svg' %}" type="image/x-icon"> <link rel="shortcut icon" href="{% static 'images/MATFYZ_MM_barevne.svg' %}" type="image/x-icon">
{% render_block "css" %} {% render_block css %}
{% block custom_css %}{% endblock %}
<link href="{% static 'css/bootstrap-theme.css' %}" rel="stylesheet"> <link href="{% static 'css/bootstrap-theme.css' %}" rel="stylesheet">
<link href="{% static 'css/bootstrap.css' %}" rel="stylesheet"> <link href="{% static 'css/bootstrap.css' %}" rel="stylesheet">
<link href="{% static 'css/mamweb.css' %}" rel="stylesheet"> <link href="{% static 'css/mamweb.css' %}" rel="stylesheet">

2
seminar/templates/seminar/archiv/base.html

@ -1,6 +1,4 @@
{% extends "base.html" %} {% extends "base.html" %}
{% block menu_archiv %}selected{% endblock %}
{# zmena fotky #}{% block header %}archiv{% endblock %} {# zmena fotky #}{% block header %}archiv{% endblock %}

14
seminar/templates/seminar/treenode.html

@ -1,4 +1,16 @@
{% extends "seminar/archiv/base_ulohy.html" %} {% extends "seminar/archiv/base.html" %}
{% load staticfiles %}
{% load sekizai_tags %}
{# toto z nejakeho duvodu nefunguje #}
{% addtoblock css %}
dfsdfs
<link rel="stylesheet" type="text/css" href="{% static 'css/mamweb-dev.css' %}" />
{% endaddtoblock "css" %}
{% block custom_css %}
<link rel="stylesheet" type="text/css" href="{% static 'css/mamweb-dev.css' %}" />
{% endblock custom_css %}
{% load comments %} {% load comments %}

35
seminar/templates/seminar/treenode_recursive.html

@ -1,6 +1,12 @@
{% load treenodes %} {% load treenodes %}
{# <b>{{depth}}</b> #} {# <b>{{depth}}</b> #}
<div> <div class="borderized parent">
<div class="node_type">
{{obj.node}}
<button>Smazat</button>
<button>O úroveň výš</button>
<button>Podvěsit pod ^</button>
</div>
{% if obj.node|isRocnik %} {% if obj.node|isRocnik %}
<h{{depth}}> Ročník {{obj.node.rocnik}} </h{{depth}}> <h{{depth}}> Ročník {{obj.node.rocnik}} </h{{depth}}>
{% elif obj.node|isCislo %} {% elif obj.node|isCislo %}
@ -17,11 +23,36 @@
Objekt jiného typu {{obj.node}} Objekt jiného typu {{obj.node}}
{% endif %} {% endif %}
{%if obj.children %} {%if obj.children %}
<div> <div class="borderized children">
<div class="pink">Přidat před
<select>
<option value="TextNode">Text</option>
<option value="NadpisNode">Nadpis</option>
<option value="UlohaNode">Úloha</option>
<option value="TemaNode">Téma</option>
</select>
<button>Přídat</button>
</div>
{%for ch in obj.children %} {%for ch in obj.children %}
{%with obj=ch depth=depth|add:"1" template_name="seminar/treenode_recursive.html" %} {%with obj=ch depth=depth|add:"1" template_name="seminar/treenode_recursive.html" %}
{%include template_name%} {%include template_name%}
{%endwith%} {%endwith%}
<div class="pink">
{% if forloop.last %} Přidat za {% else %} Přidat mezi {% endif %}
<select>
<option value="TextNode">Text</option>
<option value="NadpisNode">Nadpis</option>
<option value="UlohaNode">Úloha</option>
<option value="TemaNode">Téma</option>
</select>
<button>Přídat na stejnou úroveň</button>
<button>Přídat jako syna</button>
&nbsp;&nbsp;&nbsp;
{% if not forloop.last %}
<button>Prohodit ^ a v</button>
{% endif %}
</div>
{%endfor%} {%endfor%}
</div> </div>
{%endif%} {%endif%}

35
seminar/templatetags/treenodes.py

@ -3,47 +3,60 @@ import seminar.models as m
register = template.Library() register = template.Library()
@register.filter
def nodeType(value):
if isinstance(value,RocnikNode): return "Ročník"
if isinstance(value,CisloNode): return "Číslo"
if isinstance(value,CastNode): return "Část"
if isinstance(value,TextNode): return "Text"
if isinstance(value,TemaVCisleNode): return "Téma v čísle"
if isinstance(value,KonferaNode): return "Konfera"
if isinstance(value,ClanekNode): return "Článek"
if isinstance(value,UlohaVzorakNode): return "Vzorák"
if isinstance(value,UlohaZadaniNode): return "Zadání úlohy"
if isinstance(value,PohadkaNode): return "Pohádka"
@register.filter @register.filter
def isRocnik(value): def isRocnik(value):
return isinstance(value, m.RocnikNode) return isinstance(value, m.RocnikNode)
@register.filter @register.filter
def isCislo(value): def isCislo(value):
return isinstance(value, m.CisloNode) return isinstance(value, m.CisloNode)
@register.filter @register.filter
def isCast(value): def isCast(value):
return isinstance(value, m.CastNode) return isinstance(value, m.CastNode)
@register.filter @register.filter
def isText(value): def isText(value):
return isinstance(value, m.TextNode) return isinstance(value, m.TextNode)
@register.filter @register.filter
def isTemaVCisle(value): def isTemaVCisle(value):
return isinstance(value, m.TemaVCisleNode) return isinstance(value, m.TemaVCisleNode)
@register.filter @register.filter
def isKonfera(value): def isKonfera(value):
return isinstance(value, m.KonferaNode) return isinstance(value, m.KonferaNode)
@register.filter @register.filter
def isClanek(value): def isClanek(value):
return isinstance(value, m.ClanekNode) return isinstance(value, m.ClanekNode)
@register.filter @register.filter
def isUlohaVzorak(value): def isUlohaVzorak(value):
return isinstance(value, m.UlohaVzorakNode) return isinstance(value, m.UlohaVzorakNode)
@register.filter @register.filter
def isUlohaZadani(value): def isUlohaZadani(value):
return isinstance(value, m.UlohaZadaniNode) return isinstance(value, m.UlohaZadaniNode)
@register.filter @register.filter
def isPohadka(value): def isPohadka(value):
return isinstance(value, m.PohadkaNode) return isinstance(value, m.PohadkaNode)
#@register.filter #@register.filter
#def isOtisteneReseniNode(value): #def isOtisteneReseniNode(value):
# return isinstance(value, m.OtisteneReseniNode) # return isinstance(value, m.OtisteneReseniNode)

Loading…
Cancel
Save