Browse Source

Added a template for a search page

Roland Haroutiounian 8 years ago
parent
commit
97418cbeaa

+ 12
- 2
plugins/webui/interface/controllers/admin.py View File

308
     #    return get_response('users/signin.html')
308
     #    return get_response('users/signin.html')
309
     return get_response('admin/admin.html')
309
     return get_response('admin/admin.html')
310
 
310
 
311
-        
312
-            
311
+
312
+def search_object(request):
313
+    if request.method == 'POST':
314
+        classname = request.POST['classname']
315
+        searchstring = request.POST['searchstring']
316
+        try:
317
+            target_leo = dyncode.Object.name2class(classname)
318
+        except LeApiError:
319
+            raise HttpException(400)
320
+
321
+    return get_response('admin/admin_search.html', my_classes = dyncode.dynclasses)
322
+
313
 
323
 

+ 1
- 0
plugins/webui/interface/urls.py View File

12
     (r'^/admin/object_delete', delete_object),
12
     (r'^/admin/object_delete', delete_object),
13
     (r'^/admin/class_admin$', admin_class),
13
     (r'^/admin/class_admin$', admin_class),
14
     (r'^/admin/class_delete$', delete_in_class),
14
     (r'^/admin/class_delete$', delete_in_class),
15
+    (r'^/admin/search$', search_object),
15
     (r'/test/(?P<id>.*)$', test),
16
     (r'/test/(?P<id>.*)$', test),
16
     (r'^/test/?$', test),
17
     (r'^/test/?$', test),
17
     (r'^/list_classes', list_classes),
18
     (r'^/list_classes', list_classes),

+ 1
- 0
plugins/webui/templates/admin/admin.html View File

9
     <li><a href="admin/classes_admin">Edit an object</a></li>
9
     <li><a href="admin/classes_admin">Edit an object</a></li>
10
     <li><a href="admin/object_create">Create an object</a></li>
10
     <li><a href="admin/object_create">Create an object</a></li>
11
     <li><a href="admin/object_delete">Delete an object</a></li>
11
     <li><a href="admin/object_delete">Delete an object</a></li>
12
+    <li><a href="admin/search">Search an object</a></li>
12
 </ul>
13
 </ul>
13
 
14
 
14
 {% endblock %}
15
 {% endblock %}

+ 25
- 0
plugins/webui/templates/admin/admin_search.html View File

1
+{% extends "base_backend.html" %}
2
+
3
+{% block title %}- Search{% endblock %}
4
+{% block body %}
5
+<ol class="breadcrumb">
6
+    <li><a href="/{{ root_url }}/admin">Home</a></li>
7
+    <li><a href="/{{ root_url }}/admin/object_create">Search</a></li>
8
+</ol>
9
+{% if msg is not none %}
10
+    {% block msg %} <p style="color: red; font-size:20pt; font-weight:bold">{{ msg }}</p> {% endblock %}
11
+{% endif %}
12
+<h1 class="h1_lodel">Searching</h1>
13
+<form class="form-horizontal" action="" method="post">
14
+    <select id="classname" name="classname">
15
+        {% for classe in my_classes %}
16
+            {% if not classe.is_abstract()%}
17
+                <option value="{{ classe.__name__ }}">{{ classe.__name__ }}</option>
18
+            {% endif %}
19
+        {% endfor %}
20
+    </select>
21
+    <input type="text" name="searchstring" id="searchstring" value="" />
22
+    <p>&nbsp;</p>
23
+    <button type="submit" class="btn btn-primary">Search</button>
24
+</form>
25
+{% endblock %}

Loading…
Cancel
Save