mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-04-01 18:02:27 +08:00
Fix repository row import/export
This commit is contained in:
parent
73020043a4
commit
09e3b7c80b
3 changed files with 22 additions and 4 deletions
app
assets/javascripts/repositories
controllers
services
|
@ -335,7 +335,20 @@ var RepositoryDatatable = (function(global) {
|
|||
appendInput(form, rowId, 'row_ids[]');
|
||||
});
|
||||
}
|
||||
});
|
||||
})
|
||||
.on('ajax:beforeSend', function() {
|
||||
animateSpinner(null, true);
|
||||
})
|
||||
.on('ajax:complete', function() {
|
||||
$('#exportRepositoryModal').modal('hide');
|
||||
animateSpinner(null, false);
|
||||
})
|
||||
.on('ajax:success', function(ev, data) {
|
||||
HelperModule.flashAlertMsg(data.message, 'success');
|
||||
})
|
||||
.on('ajax:error', function(ev, data) {
|
||||
HelperModule.flashAlertMsg(data.responseJSON.message, 'danger');
|
||||
});
|
||||
}
|
||||
|
||||
function disableCheckboxToggleOnAssetDownload() {
|
||||
|
|
|
@ -22,6 +22,6 @@ class ZipExportsController < ApplicationController
|
|||
|
||||
def load_var
|
||||
@zip_export = current_user.zip_exports.find_by_id(params[:id])
|
||||
redirect_to(file_expired_url, status: 301) and return unless @zip_export&.zip_file&.exists?
|
||||
redirect_to(file_expired_url, status: :moved_permanently) and return unless @zip_export&.zip_file&.attached?
|
||||
end
|
||||
end
|
||||
|
|
|
@ -3,8 +3,13 @@
|
|||
class SpreadsheetParser
|
||||
# Based on file's extension opens file (used for importing)
|
||||
def self.open_spreadsheet(file)
|
||||
filename = file.original_filename
|
||||
file_path = file.path
|
||||
if file.class == ActionDispatch::Http::UploadedFile
|
||||
filename = file.original_filename
|
||||
file_path = file.path
|
||||
else
|
||||
filename = file.filename.to_s
|
||||
file_path = file.service_url
|
||||
end
|
||||
|
||||
case File.extname(filename)
|
||||
when '.csv'
|
||||
|
|
Loading…
Add table
Reference in a new issue