Merge pull request #5244 from artoscinote/ma_SCI_8246

Add display of validation errors to TinyMCE [SCI-8246]
This commit is contained in:
artoscinote 2023-04-04 10:30:43 +02:00 committed by GitHub
commit cc38619514
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 1 deletions

View file

@ -348,7 +348,7 @@ class MyModulesController < ApplicationController
render json: protocol, serializer: ProtocolSerializer, user: current_user
rescue ActiveRecord::RecordInvalid
head :unprocessable_entity
render json: protocol.errors, status: :unprocessable_entity
end
def results

View file

@ -343,6 +343,8 @@ window.TinyMCE = (() => {
editor.setProgressState(0);
if (data.status === 403) {
HelperModule.flashAlertMsg(I18n.t('general.no_permissions'), 'danger');
} else if (data.status === 422) {
HelperModule.flashAlertMsg(data.responseJSON ? Object.values(data.responseJSON).join(', ') : I18n.t('errors.general'), 'danger');
}
});