|
@@ -13,8 +13,47 @@
|
13
|
13
|
{% elif field.base_type == 'text' %}
|
14
|
14
|
<textarea class="form-control" name="field_input_{{fieldname}}">{{value}}</textarea>
|
15
|
15
|
{% elif field.base_type == 'datetime' %}
|
16
|
|
- <input class="form-control" type="date" value="{{value}}" name="field_input_{{fieldname}}">
|
|
16
|
+ <!-- Handle date fields - Date format for datepicker is YY/MM/DD - TODO set this format with field.datetime_format (default is '%Y-%m-%d') -->
|
|
17
|
+ <input class="form-control" type="text" id="field_input_{{fieldname}}" name="field_input_{{fieldname}}" />
|
|
18
|
+ <script type="text/javascript">
|
|
19
|
+ $(document).ready(function() {
|
|
20
|
+ $('#field_input_{{fieldname}}')
|
|
21
|
+ .datepicker({
|
|
22
|
+ autoclose: true,
|
|
23
|
+ format: 'yyyy/mm/dd'
|
|
24
|
+ });
|
|
25
|
+ });
|
|
26
|
+ </script>
|
17
|
27
|
{% elif field.base_type == 'ref' %}
|
|
28
|
+ {% set l_classes = field.allowed_classes %}
|
|
29
|
+ {% set ref_objects = dict() %}
|
|
30
|
+ {% for l_class in l_classes %}
|
|
31
|
+ {% set _dummy = ref_objects.update(l_class.get(None)) %}
|
|
32
|
+ {% if 'fullname' in l_class.fieldnames() %}
|
|
33
|
+ {% set displayfield = 'fullname' %}
|
|
34
|
+ {% elif 'name' in l_class.fieldnames() %}
|
|
35
|
+ {% set displayfield = 'name' %}
|
|
36
|
+ {% elif 'title' in l_class.fieldnames() %}
|
|
37
|
+ {% set displayfield = 'title' %}
|
|
38
|
+ {% else %}
|
|
39
|
+ {% set displayfield = l_class.uid_fieldname() %}
|
|
40
|
+ {% endif %}
|
|
41
|
+ {% set uidfield = l_class.uid_fieldname() %}
|
|
42
|
+ {% endfor %}
|
|
43
|
+ <meta id="ref_objects" data-name="{{ ref_objects }}" >
|
|
44
|
+ {% if (field.__class__ == List) %}
|
|
45
|
+ <input id="{{fieldname}}" class="form-control" name="field_input_{{fieldname}}[]" type="text" value="{{sval}}" >
|
|
46
|
+ <script type="text/javascript">
|
|
47
|
+ $(function() {
|
|
48
|
+ $('#{{fieldname}}').magicSuggest({
|
|
49
|
+ data: $('#ref_objects').data(),
|
|
50
|
+ valueField: {{ uidfield }},
|
|
51
|
+ displayField: {{ displayfield }}
|
|
52
|
+ });
|
|
53
|
+ </script>
|
|
54
|
+
|
|
55
|
+ });
|
|
56
|
+ {% endif %}
|
18
|
57
|
{% if value is iterable %}
|
19
|
58
|
{% set sval=value|join(',') %}
|
20
|
59
|
{% else %}
|