wcs: fix custom field template display when not defined (#59595)

This commit is contained in:
Lauréline Guérin 2021-12-17 18:36:36 +01:00 committed by Frédéric Péters
parent 4db81d3fce
commit c2cb07c2cc
1 changed files with 2 additions and 2 deletions

View File

@ -550,7 +550,7 @@ Card_cell_custom.prototype = {
let schema_field = _self.field_with_varname(schema_cell.varname);
let cell_text = "";
if (schema_field || schema_cell.varname == '@custom@') {
const cell_content = schema_cell.varname == '@custom@' ? schema_cell.template + ' (' + gettext('Custom') + ')' : schema_field.label;
const cell_content = schema_cell.varname == '@custom@' ? (schema_cell.template || '') + ' (' + gettext('Custom') + ')' : schema_field.label;
cell_text += $('<span/>').addClass(schema_cell.display_mode).text(cell_content).html();
cell_text += '<span class="cell-meta">';
let cell_display_mode_label = $(this.grid_cell_form).find('select[name="display_mode"] option[value="' + schema_cell.display_mode + '"]').text();
@ -582,7 +582,7 @@ Card_cell_custom.prototype = {
grid_cell__edit: function(grid_cell) {
const _self = this;
this.grid_cell_form.varname.value = grid_cell.dataset.varname;
this.grid_cell_form.template.value = grid_cell.dataset.template;
this.grid_cell_form.template.value = grid_cell.dataset.template || '';
this.grid_cell_form.size.value = grid_cell.dataset.cell_size;
this.grid_cell_form.display_mode.value = grid_cell.dataset.display_mode;
const cell_id = $(grid_cell).index();