hotfix (dataset): enhance dataset editing and validation
- Modified the TableKeywords component to remove the external_key reset when the type is updated, only resetting the value. - Updated the DatasetController to pass authorization checks (`can.edit`, `can.delete`) to the edit view. - Updated the arrayContainsTypes validation rule to improve the error messages for titles and descriptions, clarifying the requirements for main and translated entries. - Updated the Dataset Edit view to: - Remove unused code and comments. - Add authorization checks to the save button. - Add a release button. - Add icons to the save and release buttons. - Add a computed property `hasUnsavedChanges` to determine if there are unsaved changes in the form.
This commit is contained in:
parent
2cb33a779c
commit
c3ae4327b7
4 changed files with 83 additions and 55 deletions
|
@ -44,20 +44,20 @@ async function arrayContainsTypes(value: unknown, options: Options, field: Field
|
|||
if (field.getFieldPath() === 'titles') {
|
||||
// For titles we expect one main and minimum one translated title.
|
||||
if (!hasTypeA && !hasTypeB) {
|
||||
errorMessage = 'For titles, define one main title and minimum one translated title.';
|
||||
errorMessage = 'For titles, define at least one main title and at least one Translated title as MAIN TITLE.';
|
||||
} else if (!hasTypeA) {
|
||||
errorMessage = 'For titles, define one main title.';
|
||||
errorMessage = 'For titles, define at least one main title.';
|
||||
} else if (!hasTypeB) {
|
||||
errorMessage = 'For titles, define minimum one translated title.';
|
||||
errorMessage = 'For Titles, define at least one Translated title as MAIN TITLE.';
|
||||
}
|
||||
} else if (field.getFieldPath() === 'descriptions') {
|
||||
// For descriptions we expect one abstracts description and minimum one translated description.
|
||||
if (!hasTypeA && !hasTypeB) {
|
||||
errorMessage = 'For descriptions, define one abstract description and minimum one translated description.';
|
||||
errorMessage = 'For descriptions, define at least one abstract and at least one Translated description as MAIN ABSTRACT.';
|
||||
} else if (!hasTypeA) {
|
||||
errorMessage = 'For descriptions, define one abstract description.';
|
||||
errorMessage = 'For descriptions, define at least one abstract.';
|
||||
} else if (!hasTypeB) {
|
||||
errorMessage = 'For descriptions, define minimum one translated description.';
|
||||
errorMessage = 'For Descriptions, define at least one Translated description as MAIN ABSTRACT.';
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
editor.link_modal.header
Reference in a new issue