0003-add-custom-option-via-template.patch
combo/apps/wcs/templates/combo/wcs/manager/card-infos-cell-form.html | ||
---|---|---|
41 | 41 |
<p> |
42 | 42 |
<label> |
43 | 43 |
{% trans "Field" %} |
44 |
<select name="card_field_varname"></select> |
|
44 |
<select name="card_field_varname"> |
|
45 |
<option value="@custom@">{% trans "Custom" %}</option> |
|
46 |
</select> |
|
45 | 47 |
</label> |
46 | 48 |
</p> |
47 | 49 |
<p> |
combo/manager/static/js/combo.manager.js | ||
---|---|---|
477 | 477 |
this.grid_cell_form.display_mode = this.grid_cell_form[2]; |
478 | 478 |
this.grid_cell_form.size = this.grid_cell_form[3]; |
479 | 479 |
const varname_select = this.grid_cell_form.varname; |
480 |
this.cardSchema.fields.forEach(function(el, id) { |
|
480 |
this.cardSchema.fields.reverse().forEach(function(el, id) {
|
|
481 | 481 |
if (el.varname) { |
482 | 482 |
$('<option />') |
483 | 483 |
.attr('value', el.varname) |
484 | 484 |
.text(el.label) |
485 |
.appendTo(varname_select);
|
|
485 |
.prependTo(varname_select);
|
|
486 | 486 |
} |
487 | 487 |
}) |
488 |
// add a field 'Custom', so the user can define a template |
|
489 |
$('<option />') |
|
490 |
.attr('value', '@custom@') |
|
491 |
.text(gettext('Custom')) |
|
492 |
.appendTo(varname_select); |
|
493 | 488 | |
494 | 489 |
// hide or show template, change mode options, depending on selected field |
495 | 490 |
const _label_and_value_option = this.grid_cell_form.display_mode[0]; |
496 |
- |