Add display of validation errors to TinyMCE [SCI-8246]

This commit is contained in:
Martin Artnik 2023-04-03 15:34:59 +02:00
parent 91c32e415f
commit 79b4f0d03d
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 render json: protocol, serializer: ProtocolSerializer, user: current_user
rescue ActiveRecord::RecordInvalid rescue ActiveRecord::RecordInvalid
head :unprocessable_entity render json: protocol.errors, status: :unprocessable_entity
end end
def results def results

View file

@ -343,6 +343,8 @@ window.TinyMCE = (() => {
editor.setProgressState(0); editor.setProgressState(0);
if (data.status === 403) { if (data.status === 403) {
HelperModule.flashAlertMsg(I18n.t('general.no_permissions'), 'danger'); 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');
} }
}); });