mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-09-21 07:26:15 +08:00
Merge pull request #2036 from okriuchykhin/ok_SCI_3815
Improve behavior of inventory items export modal [SCI-3815]
This commit is contained in:
commit
b8a5b1b542
|
@ -314,6 +314,15 @@ 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');
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -887,10 +896,6 @@ var RepositoryDatatable = (function(global) {
|
|||
$('#exportRepositoriesButton').off('click').on('click', function() {
|
||||
$('#exportRepositoryModal').modal('show');
|
||||
});
|
||||
$('#export-repositories').off('click').on('click', function() {
|
||||
animateSpinner(null, true);
|
||||
$('#form-export').submit();
|
||||
});
|
||||
}
|
||||
} else {
|
||||
$('#editRepositoryRecord').prop('disabled', true);
|
||||
|
|
|
@ -289,13 +289,17 @@ class RepositoriesController < ApplicationController
|
|||
end
|
||||
|
||||
def export_repository
|
||||
if params[:row_ids] && params[:header_ids]
|
||||
RepositoryZipExport.generate_zip(params, @repository, current_user)
|
||||
log_activity(:export_inventory_items)
|
||||
else
|
||||
flash[:alert] = t('zip_export.export_error')
|
||||
respond_to do |format|
|
||||
format.json do
|
||||
if params[:row_ids] && params[:header_ids]
|
||||
RepositoryZipExport.generate_zip(params, @repository, current_user)
|
||||
log_activity(:export_inventory_items)
|
||||
render json: { message: t('zip_export.export_request_success') }, status: :ok
|
||||
else
|
||||
render json: { message: t('zip_export.export_error') }, status: :unprocessable_entity
|
||||
end
|
||||
end
|
||||
end
|
||||
redirect_back(fallback_location: root_path)
|
||||
end
|
||||
|
||||
private
|
||||
|
|
|
@ -4,7 +4,8 @@
|
|||
role="dialog"
|
||||
aria-labelledby="modal-export-repository-label">
|
||||
<%= bootstrap_form_tag(url: export_repository_team_path(repository),
|
||||
html: { id: 'form-export' }) do |f| %>
|
||||
html: { id: 'form-export' },
|
||||
remote: true) do |f| %>
|
||||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
|
@ -18,7 +19,7 @@
|
|||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type='button' class='btn btn-default' data-dismiss='modal' id='close-modal-export-repositories'><%= t('general.cancel')%></button>
|
||||
<button type='button' class='btn btn-success' data-dismiss='modal' id='export-repositories'> <%=t 'my_modules.repository.export' %> </button>
|
||||
<%= f.submit t('my_modules.repository.export'), id: "export-repositories", class: "btn btn-success" %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -1035,7 +1035,7 @@ en:
|
|||
can_edit: "Can Edit"
|
||||
all_teams: "All teams (current & new)"
|
||||
all_teams_tooltip: "This will disable individual team settings"
|
||||
success_message: “Selected sharing options for the Inventory %{inventory_name} have been saved.”
|
||||
success_message: "Selected sharing options for the Inventory %{inventory_name} have been saved."
|
||||
table:
|
||||
id: 'ID'
|
||||
assigned: "Assigned"
|
||||
|
@ -1998,11 +1998,11 @@ en:
|
|||
notification_title: 'Your requested export package is ready!'
|
||||
expired_title: 'Looks like your link has expired.'
|
||||
expired_description: 'Please export the data again in order to receive a new link.'
|
||||
modal_label: 'Export request received'
|
||||
modal_html: "<p>Your export request is being processed.</p><p>When completed we will <strong>send an email to %{email}</strong> inbox with a link to your exported samples. Note that the link will expire in 7 days.</p>"
|
||||
repository_header_html: 'You are about to export selected items in inventory %{repository}.'
|
||||
files_alert: 'Files uploaded to inventory items will not be exported. Only filenames will be exported.'
|
||||
repository_footer_html: 'Inventory will be exported in a .csv file format. You will receive <strong>email with a link</strong> where you can download it.'
|
||||
export_request_success: "Export request received!"
|
||||
export_error: "Error when creating zip export."
|
||||
|
||||
# This section contains general words that can be used in any parts of
|
||||
|
|
Loading…
Reference in a new issue