mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-02-02 21:20:08 +08:00
Add display of validation errors to TinyMCE [SCI-8246]
This commit is contained in:
parent
91c32e415f
commit
79b4f0d03d
2 changed files with 3 additions and 1 deletions
|
@ -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
|
||||
|
|
2
app/javascript/packs/tiny_mce.js
vendored
2
app/javascript/packs/tiny_mce.js
vendored
|
@ -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');
|
||||
}
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in a new issue