Refactored to PR, deleted unrelated things

This commit is contained in:
Zanz2 2018-02-06 09:06:33 +01:00
parent 0607579d06
commit dac59cf4d0
3 changed files with 0 additions and 16 deletions

View file

@ -601,17 +601,8 @@ class ProtocolsController < ApplicationController
def protocolsio_import_create
@protocolsio_too_big = false
@protocolsio_invalid_file = false
@protocolsio_no_file = false
if params[:json_file].nil?
@protocolsio_no_file = true
respond_to do |format|
format.js {}
end
return 0 # return 0 stops the rest of the controller code from executing
end
extension = File.extname(params[:json_file].path)
file_size = File.size(params[:json_file].path)
if extension != '.txt' && extension != '.json'
@protocolsio_invalid_file = true
respond_to do |format|

View file

@ -18,7 +18,6 @@
<div class="modal-body">
<%= file_field_tag 'json_file', accept: '.txt,.json' %>
<div id="pio_no_file_error_span"></div>
</div>
<div class="modal-footer">

View file

@ -1,6 +1,3 @@
$('#modal-import-json-protocol').on('hidden.bs.modal', function () {
$('#pio_no_file_error_span').empty();
})
<% if @protocolsio_too_big %>
$('#modal-import-json-protocol').modal('hide');
HelperModule.flashAlertMsg(' <%= t('my_modules.protocols.load_from_file_size_error',
@ -8,9 +5,6 @@ HelperModule.flashAlertMsg(' <%= t('my_modules.protocols.load_from_file_size_err
<% elsif @protocolsio_invalid_file %>
$('#modal-import-json-protocol').modal('hide');
HelperModule.flashAlertMsg(' <%= t('my_modules.protocols.load_from_file_invalid_error') %>','danger');
<% elsif @protocolsio_no_file %>
$('#pio_no_file_error_span').addClass('has-error').html('<span class="help-block"> <%= t('teams.parse_sheet.errors.no_file_selected') %></span>');
<% @protocolsio_no_file = false %>
<% else %>
$('#modal-import-json-protocol').modal('hide');
<% if remotipart_submitted? %> <%# a workaround to a bug with remotipart, that caused alot of headache, courtesy of github.com/dhampik %>