mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-09-21 07:26:15 +08:00
Submit image as FormData [SCI-2879]
This commit is contained in:
parent
7315db73f1
commit
af94f79f0d
|
@ -135,15 +135,17 @@
|
||||||
$('.tui-image-editor-header').hide();
|
$('.tui-image-editor-header').hide();
|
||||||
|
|
||||||
$('.file-save-link').off().click(function(ev) {
|
$('.file-save-link').off().click(function(ev) {
|
||||||
|
var dataUpload = new FormData();
|
||||||
ev.preventDefault();
|
ev.preventDefault();
|
||||||
ev.stopPropagation();
|
ev.stopPropagation();
|
||||||
|
dataUpload.append('image', imageEditor.toDataURL());
|
||||||
animateSpinner(null, true);
|
animateSpinner(null, true);
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: 'POST',
|
type: 'POST',
|
||||||
url: '/files/' + data.id + '/update_image',
|
url: '/files/' + data.id + '/update_image',
|
||||||
data: {
|
data: dataUpload,
|
||||||
image: imageEditor.toDataURL()
|
contentType: false,
|
||||||
},
|
processData: false,
|
||||||
success: function(res) {
|
success: function(res) {
|
||||||
$('#modal_link' + data.id).parent().html(res.html);
|
$('#modal_link' + data.id).parent().html(res.html);
|
||||||
setupAssetsLoading();
|
setupAssetsLoading();
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# Be sure to restart your server when you modify this file.
|
# Be sure to restart your server when you modify this file.
|
||||||
|
|
||||||
# Configure sensitive parameters which will be filtered from the log file.
|
# Configure sensitive parameters which will be filtered from the log file.
|
||||||
Rails.application.config.filter_parameters += [:password]
|
Rails.application.config.filter_parameters += %i(password image)
|
||||||
|
|
Loading…
Reference in a new issue