Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision f37d6ef1

Von Moritz Bunkus vor mehr als 10 Jahren hinzugefügt

  • ID f37d6ef107f6a2ef0302cc02d0e2cc210c997f1f
  • Vorgänger 54fc0d08
  • Nachfolger e8880baa

CVar-Render als Block: Unterstützung für Übergabe von RDBO-CustomVariableConfig-Instanzen

…und von beliebigen Parametern für die Form-Tags via Block-Parameter
»cvar_tag_options«.

Unterschiede anzeigen:

templates/webpages/amcvar/render_inputs_block.html
1 1
[%- USE T8 %]
2 2
[%- USE HTML %]
3 3
[%- USE L %]
4
[%- USE LxERP %]
5
[%- BLOCK cvar_name %][% HTML.escape(cvar.name_prefix) _ "cvar_" _ HTML.escape(cvar.var.name) _ HTML.escape(cvar.name_postfix) -%][% END %]
4
[%- USE LxERP %][%- USE P -%]
6 5
[%- BLOCK cvar_inputs %]
7
[% render_input_blocks__cvar_name = PROCESS cvar_name %]
8
[%- %]
6
[%- SET render_cvar_tag_options = {};
7
    render_cvar_tag_options.import(cvar_tag_options) IF cvar_tag_options;
8
    SET cvar_tag_name = HTML.escape(cvar.name_prefix) _ "cvar_" _ HTML.escape(cvar.var.name) _ HTML.escape(cvar.name_postfix);
9
    IF !render_cvar_tag_options.id && (cvar.var.type != 'select');
10
      SET render_cvar_tag_options.no_id = 1;
11
    END;
12
%]
9 13
[%- IF cvar.hide_non_editable && !cvar.var.flag_editable %]
10
<input type="hidden" name="[% PROCESS cvar_name %]" value="[% HTML.escape(cvar.var.value) %]">
14
[%- L.hidden_tag(cvar_tag_name, cvar.var.value, render_cvar_tag_options) %]
11 15
[%- ELSIF !cvar.valid %]
12 16
  [%- IF show_disabled_message %]
13 17
<i>[% 'Element disabled' | $T8 %]</i>
14 18
  [%- END %]
19

  
15 20
[%- ELSIF cvar.var.type == 'bool' %]
16
<input type="checkbox" name="[% PROCESS cvar_name %]" value="1"[% IF cvar.value %] checked[% END %]>
21
[%- render_cvar_tag_options.import(checked=cvar.value, value=1);
22
    L.checkbox_tag(cvar_tag_name, render_cvar_tag_options) %]
23

  
17 24
[%- ELSIF cvar.var.type == 'textfield' %]
18
[% L.textarea_tag(render_input_blocks__cvar_name, cvar.value, cols=cvar.var.width, rows=cvar.var.height) %]
25
[% render_cvar_tag_options.import(cols=cvar.var.width, rows=cvar.var.height);
26
   L.textarea_tag(cvar_tag_name, cvar.value, render_cvar_tag_options) %]
27

  
19 28
[%- ELSIF cvar.var.type == 'date' %]
20
[%- L.date_tag(render_input_blocks__cvar_name, cvar.value) %]
29
[%- L.date_tag(cvar_tag_name, cvar.value, render_cvar_tag_options) %]
21 30

  
22 31
[%- ELSIF cvar.var.type == 'timestamp' %]
23
<input name="[% PROCESS cvar_name %]" value="[% HTML.escape(cvar.value) %]">
32
[%- L.input_tag(cvar_tag_name, cvar.value, render_cvar_tag_options) %]
33

  
24 34
[%- ELSIF cvar.var.type == 'select' %]
25
<select name="[% PROCESS cvar_name %]">
26
 [%- FOREACH option = cvar.var.OPTIONS %]
27
 <option[% IF option.value == cvar.value %] selected[% END %]>[% HTML.escape(option.value) %]</option>
35
[%- render_cvar_tag_options.name=cvar_tag_name %]
36
<select [% P.stringify_attributes(render_cvar_tag_options) %]>
37
 [%- IF LxERP.is_rdbo(cvar.var, 'CustomVariableConfig') %]
38
  [%- FOREACH option = cvar.var.processed_options %]
39
   [%- SET render_cvar_opts = {
40
        value = option
41
       };
42
       render_cvar_opts.selected = 'selected' IF option == cvar.value;
43
       L.html_tag('option', option, render_cvar_opts) %]
44
  [%- END %]
45
 [%- ELSE %]
46
  [%- FOREACH option = cvar.var.OPTIONS %]
47
   [%- SET render_cvar_opts = {
48
        value = option.value
49
       };
50
       render_cvar_opts.selected = 'selected' IF option.value == cvar.value;
51
       L.html_tag('option', option.value, render_cvar_opts) %]
52
  [%- END %]
28 53
 [%- END %]
29 54
</select>
55

  
30 56
[%- ELSIF cvar.var.type == 'customer' %]
31
[%- L.customer_picker(render_input_blocks__cvar_name, cvar.value) %]
57
[%- L.customer_picker(cvar_tag_name, cvar.value, render_cvar_tag_options) %]
32 58

  
33 59
[%- ELSIF cvar.var.type == 'vendor' %]
34
[% L.vendor_selector(render_input_blocks__cvar_name, cvar.value) %]
60
[% L.vendor_selector(cvar_tag_name, cvar.value, render_cvar_tag_options) %]
35 61

  
36 62
[%- ELSIF cvar.var.type == 'part' %]
37
[% L.part_selector(render_input_blocks__cvar_name, cvar.value) %]
63
[% L.part_selector(cvar_tag_name, cvar.value, render_cvar_tag_options) %]
38 64

  
39 65
[%- ELSIF cvar.var.type == 'number' %]
40
[%- L.input_tag(render_input_blocks__cvar_name, LxERP.format_amount(cvar.value, -2)) %]
66
[%- L.input_tag(cvar_tag_name, LxERP.format_amount(cvar.value, -2), render_cvar_tag_options) %]
41 67

  
42 68
[%- ELSE %]
43
<input name="[% PROCESS cvar_name %]" value="[% HTML.escape(cvar.value) %]" [%- IF cvar.var.maxlength %] maxlength="[% HTML.escape(cvar.var.maxlength) %]"[% END -%]>
69
[% render_cvar_tag_options.maxlength=cvar.var.maxlength IF cvar.var.maxlength;
70
   L.input_tag(cvar_tag_name, cvar.value, render_cvar_tag_options) %]
44 71
[%- END %]
45 72
[%- END %]

Auch abrufbar als: Unified diff