Browse Source

Added a get_component_html function to get an HTML code for a given gui component type

Roland Haroutiounian 8 years ago
parent
commit
7aa9c214a8
1 changed files with 8 additions and 0 deletions
  1. 8
    0
      plugins/webui/interface/controllers/base.py

+ 8
- 0
plugins/webui/interface/controllers/base.py View File

@@ -11,6 +11,14 @@ def get_response(tpl='empty.html', tpl_vars={}, mimetype='text/html', status_cod
11 11
     response.status_code = status_code
12 12
     return response
13 13
 
14
+## @brief gets the html template corresponding to a given component type
15
+# @param type str : name of the component type
16
+# @param params dict : extra parameters to customize the template
17
+def get_component_html(type='text', params={}):
18
+    params['type'] = type
19
+    template_loader = TemplateLoader()
20
+    return template_loader.render_to_html(template_file='components/components.html', template_vars=params)
21
+
14 22
 def index(request):
15 23
     return get_response('index/index.html')
16 24
 

Loading…
Cancel
Save