Bug 31694: (follow-up) Use values for operations to avoid translation issues

To test:
    * Try adding a preset rule that has an operation with different translations
      for the column and the pull down (e.g. Outrepasser for fr-CA)
    * Without the patch it appears as Custom (e.g. Personnalisé)
    * With the patch it appears correctly (e.g. Outrepasser)

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Jan Kissig <jkissig@th-wildau.de>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit e9c7f84896)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit a0db31d75f)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
Kevin Carnes 2023-04-13 15:20:02 +02:00 committed by Lucas Gass
parent 4c83ac6e5c
commit b2f77bd7bb
1 changed files with 6 additions and 13 deletions

View File

@ -258,10 +258,10 @@
</td>
<td>[% rule.tag | html %]</td>
<td class="rule-preset"></td>
<td class="rule-operation-action" data-operation="add">[% IF rule.add %]Add[% ELSE %]Skip[% END %]</td>
<td class="rule-operation-action" data-operation="append">[% IF rule.append %]Append[% ELSE %]Skip[% END %]</td>
<td class="rule-operation-action" data-operation="remove">[% IF rule.remove %]Remove[% ELSE %]Skip[% END %]</td>
<td class="rule-operation-action" data-operation="delete">[% IF rule.delete %]Delete[% ELSE %]Skip[% END %]</td>
<td class="rule-operation-action" data-operation="add" data-value="[% rule.add %]">[% IF rule.add %]Add[% ELSE %]Skip[% END %]</td>
<td class="rule-operation-action" data-operation="append" data-value="[% rule.append %]">[% IF rule.append %]Append[% ELSE %]Skip[% END %]</td>
<td class="rule-operation-action" data-operation="remove" data-value="[% rule.remove %]">[% IF rule.remove %]Remove[% ELSE %]Skip[% END %]</td>
<td class="rule-operation-action" data-operation="delete" data-value="[% rule.delete %]">[% IF rule.delete %]Delete[% ELSE %]Skip[% END %]</td>
<td class="actions">
<a href="?op=remove&id=[% rule.id | uri %]" title="Delete" class="btn btn-default btn-xs"><i class="fa fa-trash"></i> Delete</a>
<a href="?op=edit&id=[% rule.id | uri %]" title="Edit" class="btn btn-default btn-xs"><i class="fa fa-pencil"></i> Edit</a>
@ -425,13 +425,6 @@
'delete': 0
};
var overlay_rules_label_to_value = {};
overlay_rules_label_to_value[_("Add")] = 1;
overlay_rules_label_to_value[_("Append")] = 1;
overlay_rules_label_to_value[_("Remove")] = 1;
overlay_rules_label_to_value[_("Delete")] = 1;
overlay_rules_label_to_value[_("Skip")] = 0;
function hash_config(config) {
return JSON.stringify(config, Object.keys(config).sort());
}
@ -451,10 +444,10 @@
var operations_config = {};
$('.rule-operation-action', $this).each(function() {
var $operation = $(this);
operations_config[$operation.data('operation')] = overlay_rules_label_to_value[$operation.text()];
operations_config[$operation.data('operation')] = $operation.data('value');
});
$('.rule-preset', $this).text(
$('option[value="' + operations_config_overlay_rule_preset(operations_config) + '"]').text() || _("Custom")
$('select[name="preset"] option[value="' + operations_config_overlay_rule_preset(operations_config) + '"]').text()
);
});