PHRAS-4138 empty field restricted thesaurus (#4592)

* add erase button

* PHRAS-4139

* always display erase button
This commit is contained in:
Aina Sitraka
2025-03-10 20:08:47 +03:00
committed by GitHub
parent 3e63da14d2
commit ebca916b9c
15 changed files with 1342 additions and 1043 deletions

View File

@@ -22528,6 +22528,17 @@ var recordEditorService = function recordEditorService(services) {
var currentField = options.fieldCollection.getActiveField();
onUserInputComplete(event, $searchThesaurus.val(), currentField);
}).on('click', '.empty-field', function (event) {
event.preventDefault();
var fieldIndex = options.fieldCollection.getActiveFieldIndex();
var field = options.fieldCollection.getFieldByIndex(fieldIndex);
if (field.multi) {
if (!confirm(localeService.t('empty_field_confirm'))) {
return false;
}
}
emptyField();
});
};
@@ -23726,6 +23737,22 @@ var recordEditorService = function recordEditorService(services) {
refreshFields(null);
}
function emptyField() {
var records = options.recordCollection.getRecords();
var fieldIndex = options.fieldCollection.getActiveFieldIndex();
for (var recordIndex in records) {
var currentRecord = options.recordCollection.getRecordByIndex(recordIndex);
if (!currentRecord._selected) {
continue;
}
options.recordCollection.emptyRecordField(recordIndex, fieldIndex);
}
refreshFields(null);
}
/**
* Add a value into a multivalued field
* @param params
@@ -61874,6 +61901,11 @@ var RecordCollection = function () {
this.records[recordIndex].fields[fieldIndex].addValue(value, merge, vocabularyId);
}
}, {
key: 'emptyRecordField',
value: function emptyRecordField(recordIndex, fieldIndex) {
this.records[recordIndex].fields[fieldIndex].empty();
}
/* options.recordCollection.removeRecordFieldValue(r, currentFieldId, {
value, vocabularyId

View File

@@ -22528,6 +22528,17 @@ var recordEditorService = function recordEditorService(services) {
var currentField = options.fieldCollection.getActiveField();
onUserInputComplete(event, $searchThesaurus.val(), currentField);
}).on('click', '.empty-field', function (event) {
event.preventDefault();
var fieldIndex = options.fieldCollection.getActiveFieldIndex();
var field = options.fieldCollection.getFieldByIndex(fieldIndex);
if (field.multi) {
if (!confirm(localeService.t('empty_field_confirm'))) {
return false;
}
}
emptyField();
});
};
@@ -23726,6 +23737,22 @@ var recordEditorService = function recordEditorService(services) {
refreshFields(null);
}
function emptyField() {
var records = options.recordCollection.getRecords();
var fieldIndex = options.fieldCollection.getActiveFieldIndex();
for (var recordIndex in records) {
var currentRecord = options.recordCollection.getRecordByIndex(recordIndex);
if (!currentRecord._selected) {
continue;
}
options.recordCollection.emptyRecordField(recordIndex, fieldIndex);
}
refreshFields(null);
}
/**
* Add a value into a multivalued field
* @param params
@@ -61874,6 +61901,11 @@ var RecordCollection = function () {
this.records[recordIndex].fields[fieldIndex].addValue(value, merge, vocabularyId);
}
}, {
key: 'emptyRecordField',
value: function emptyRecordField(recordIndex, fieldIndex) {
this.records[recordIndex].fields[fieldIndex].empty();
}
/* options.recordCollection.removeRecordFieldValue(r, currentFieldId, {
value, vocabularyId

View File

@@ -222,6 +222,18 @@ const recordEditorService = services => {
onUserInputComplete(event, $searchThesaurus.val(), currentField);
})
.on('click', '.empty-field', event => {
event.preventDefault();
let fieldIndex = options.fieldCollection.getActiveFieldIndex();
let field = options.fieldCollection.getFieldByIndex(fieldIndex);
if (field.multi) {
if (!confirm(localeService.t('empty_field_confirm'))) {
return false;
}
}
emptyField();
})
;
};
@@ -1596,6 +1608,27 @@ const recordEditorService = services => {
refreshFields(null);
}
function emptyField() {
let records = options.recordCollection.getRecords();
let fieldIndex = options.fieldCollection.getActiveFieldIndex();
for (let recordIndex in records) {
let currentRecord = options.recordCollection.getRecordByIndex(
recordIndex
);
if (!currentRecord._selected) {
continue;
}
options.recordCollection.emptyRecordField(
recordIndex,
fieldIndex,
);
}
refreshFields(null);
}
/**
* Add a value into a multivalued field
* @param params

View File

@@ -183,6 +183,10 @@ class RecordCollection {
this.records[recordIndex].fields[fieldIndex].addValue(value, merge, vocabularyId);
}
emptyRecordField(recordIndex, fieldIndex) {
this.records[recordIndex].fields[fieldIndex].empty();
}
/* options.recordCollection.removeRecordFieldValue(r, currentFieldId, {
value, vocabularyId
})*/

View File

@@ -169,6 +169,7 @@ class LanguageController
'Chapters' => $translator->trans('prod:edit: chapters'),
'No hover to chapter' => $translator->trans('prod:edit: no overlaps for chapters'),
'suggested_values' => $translator->trans('prod:edit: suggested_values'),
'empty_field_confirm' => $translator->trans('prod:edit: Are you sure, this will remove all values if exist!'),
'title notice' => $translator->trans('prod:mapboxgl: title notice'),
'description notice' => $translator->trans('prod:mapboxgl: description notice'),
'title-map-dialog' => $translator->trans('prod:mapboxgl: title map dialog'),

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" xmlns:jms="urn:jms:translation" version="1.2">
<file date="2025-03-03T17:36:11Z" source-language="en" target-language="de" datatype="plaintext" original="not.available">
<file date="2025-03-10T14:09:01Z" source-language="en" target-language="de" datatype="plaintext" original="not.available">
<header>
<tool tool-id="JMSTranslationBundle" tool-name="JMSTranslationBundle" tool-version="1.1.0-DEV"/>
<note>The source node in most cases contains the sample message as written by the developer. If it looks like a dot-delimitted string such as "form.label.firstname", then the developer has not provided a default message.</note>

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" xmlns:jms="urn:jms:translation" version="1.2">
<file date="2025-03-03T17:36:26Z" source-language="en" target-language="en" datatype="plaintext" original="not.available">
<file date="2025-03-10T14:09:18Z" source-language="en" target-language="en" datatype="plaintext" original="not.available">
<header>
<tool tool-id="JMSTranslationBundle" tool-name="JMSTranslationBundle" tool-version="1.1.0-DEV"/>
<note>The source node in most cases contains the sample message as written by the developer. If it looks like a dot-delimitted string such as "form.label.firstname", then the developer has not provided a default message.</note>

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" xmlns:jms="urn:jms:translation" version="1.2">
<file date="2025-03-03T17:36:44Z" source-language="en" target-language="fr" datatype="plaintext" original="not.available">
<file date="2025-03-10T14:09:38Z" source-language="en" target-language="fr" datatype="plaintext" original="not.available">
<header>
<tool tool-id="JMSTranslationBundle" tool-name="JMSTranslationBundle" tool-version="1.1.0-DEV"/>
<note>The source node in most cases contains the sample message as written by the developer. If it looks like a dot-delimitted string such as "form.label.firstname", then the developer has not provided a default message.</note>

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" xmlns:jms="urn:jms:translation" version="1.2">
<file date="2025-03-03T17:37:05Z" source-language="en" target-language="nl" datatype="plaintext" original="not.available">
<file date="2025-03-10T14:10:01Z" source-language="en" target-language="nl" datatype="plaintext" original="not.available">
<header>
<tool tool-id="JMSTranslationBundle" tool-name="JMSTranslationBundle" tool-version="1.1.0-DEV"/>
<note>The source node in most cases contains the sample message as written by the developer. If it looks like a dot-delimitted string such as "form.label.firstname", then the developer has not provided a default message.</note>

View File

@@ -254,6 +254,7 @@
<input id="fusion" type="button" value="{{ 'boutton::ajouter' | trans }}" class="btn btn-inverse commit-field-action" data-mode="fusion">
<input id="cancel" type="button" value="{{ 'boutton::annuler' | trans }}" class="btn btn-inverse commit-field-action" data-mode="cancel">
</div>
<button class="btn-danger empty-field" style="position: absolute; bottom: 20px; right: 5px;">{{ 'erase' | trans }}</button>
<div id="idExplain" class="PNB"></div>
</div>
</div>

View File

@@ -25,7 +25,7 @@
</form>
<div class="form_submit">
<button class="formsubmiter" data-form_selector="#report-connections-form">Download</button>
<button class="formsubmiter" data-form_selector="#report-connections-form">{{'Download' | trans}}</button>
</div>
</div>
@@ -50,7 +50,7 @@
<div class="form2 form_content">
<div class="form_titre">{{ "report:: Permalink" | trans }}</div>
<select name="permalink">
<option value>{{ "report:: choose subdef permalink" }}</option>
<option value>{{ "report:: choose subdef permalink" | trans }}</option>
{% for sbas_id,subdefs in availableSubdefName %}
{% for subdefName in subdefs %}
<option class="subdeflist subdeflist-{{ sbas_id }}" value="{{ subdefName }}">{{ subdefName }}</option>
@@ -62,7 +62,7 @@
</form>
<div class="form_submit">
<button class="formsubmiter" data-form_selector="#report-downloads-form">Download</button>
<button class="formsubmiter" data-form_selector="#report-downloads-form">{{'Download' | trans}}</button>
</div>
</div>
@@ -108,7 +108,7 @@
<div class="form2 form_content">
<div class="form_titre">{{ "report:: Permalink" | trans }}</div>
<select name="permalink">
<option value>{{ "report:: choose subdef permalink" }}</option>
<option value>{{ "report:: choose subdef permalink" | trans }}</option>
{% for sbas_id,subdefs in availableSubdefName %}
{% for subdefName in subdefs %}
<option class="subdeflist subdeflist-{{ sbas_id }}" value="{{ subdefName }}">{{ subdefName }}</option>
@@ -121,7 +121,7 @@
</form>
<div class="form_submit">
<button class="formsubmiter" data-form_selector="#report-records-form">Download</button>
<button class="formsubmiter" data-form_selector="#report-records-form">{{'Download' | trans}}</button>
</div>
</div>