Procházet zdrojové kódy

Listing of classes and their instances

prieto před 8 roky
rodič
revize
4ebd9078d8

+ 15
- 2
plugins/webui/interface/controllers/listing.py Zobrazit soubor

@@ -1,6 +1,19 @@
1
+# -*- coding: utf-8 -*-
1 2
 from .base import get_response
2 3
 import leapi_dyncode as dyncode
4
+
3 5
 def list_classes(request):
4
-    # TODO Add the method to get the classes list
5 6
     template_vars = {'my_classes': dyncode.dynclasses}
6
-    return get_response('listing/list_classes.html', tpl_vars=template_vars)
7
+    return get_response('listing/list_classes.html', tpl_vars=template_vars)
8
+
9
+def show_class(request):
10
+    templates_var = {
11
+        'params': request.GET
12
+    }
13
+    return get_response('listing/show_class.html', tpl_vars=template_vars)
14
+
15
+def show_object(request):
16
+    templates_var = {
17
+        'params': request.GET
18
+    }
19
+    return get_response('listing/show_object.html', tpl_vars=template_vars)

+ 6
- 2
plugins/webui/interface/urls.py Zobrazit soubor

@@ -1,3 +1,4 @@
1
+# -*- coding: utf-8 -*-
1 2
 from .controllers import *
2 3
 
3 4
 urls = (
@@ -7,6 +8,9 @@ urls = (
7 8
     (r'/test/(?P<id>.*)$', test),
8 9
     (r'^/test/?$', test),
9 10
     (r'/show/(?P<id>.*)$', show_document),
10
-    (r'^/list_classes/(.+)$', list_classes),
11
-    (r'^/list_classes/?$', list_classes)
11
+    (r'^/list_classes', list_classes),
12
+    (r'^/show_object/(.+)$', show_object),
13
+    (r'^/show_object/?$', show_object),
14
+    (r'^/show_class/(.+)$', show_class),
15
+    (r'^/show_class/?$', show_class)
12 16
 )

+ 2
- 2
plugins/webui/templates/listing/list_classes.html Zobrazit soubor

@@ -3,8 +3,8 @@
3 3
 {% block content %} 
4 4
 <h1>Lodel 2 - List of Classes</h1>
5 5
 <ul>
6
-{% for class in my_classes %}
7
-    <li> {{ class.__name__ }} </li>
6
+{% for classe in my_classes %}
7
+    <li> <a href="show_class/?classe={{ classe }}&name={{ classe.__name__ }}" target="_blank">{{ classe.__name__ }} </a></li>
8 8
     {% endfor %}
9 9
 </ul>
10 10
 {% endblock %}

+ 8
- 0
plugins/webui/templates/listing/show_class.html Zobrazit soubor

@@ -0,0 +1,8 @@
1
+{% extends "base.html" %}
2
+{% block title %}Lodel 2 - Class {{ name }} {% endblock %}
3
+{% block content %} 
4
+<h1>Lodel 2 - Class {{ name }} </h1>
5
+<ul>
6
+   
7
+</ul>
8
+{% endblock %} 

+ 11
- 0
plugins/webui/templates/listing/show_object.html Zobrazit soubor

@@ -0,0 +1,11 @@
1
+{% extends "base.html" %}
2
+{% block title %}Lodel 2 - Object {{ name }} {% endblock %}
3
+{% block content %} 
4
+<h1>Lodel 2 - Object {{ name }} </h1>
5
+<ul>
6
+    {% my_object = params['classe'].get('lodel_id=' + id) %}
7
+{% for field in my_object.fieldnames() %}
8
+    <li> {{ fieldnames[field] }} </li>
9
+    {% endfor %}
10
+</ul>
11
+{% endblock %}

Loading…
Zrušit
Uložit