Made javascript code nicer

This commit is contained in:
Zanz2 2017-09-26 13:31:24 +02:00
parent 055746bfd9
commit 3074acbc0d
2 changed files with 5 additions and 9 deletions

View file

@ -2,15 +2,12 @@
<% if @protocolsio_too_big %>
alert('<%= I18n.t('my_modules.protocols.load_from_file_size_error',
size: Constants::FILE_MAX_SIZE_MB ) %>');
<% 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 %>
$('#protocolsio-preview-modal-target').html("<%= j "#{render(:partial => 'protocols/import_export/import_json_protocol_preview_modal')}" %>");
$('#protocolsio-preview-modal-target').html("<%= j "#{render(:partial => 'protocols/import_export/import_json_protocol_preview_modal')}" %>");
<% else %>
$('#protocolsio-preview-modal-target').html("<%= j render(:partial => 'protocols/import_export/import_json_protocol_preview_modal') %>");
$('#protocolsio-preview-modal-target').html("<%= j render(:partial => 'protocols/import_export/import_json_protocol_preview_modal') %>");
<% end %>
$('#modal-import-json-protocol-preview').modal('show');
<% end %>

View file

@ -1,7 +1,6 @@
<% if @protocolsio_general_error %>
alert('<%= I18n.t('my_modules.protocols.load_from_file_protocol_general_error', max: Constants::NAME_MAX_LENGTH, min: Constants::NAME_MIN_LENGTH) %>');
alert('<%= I18n.t('my_modules.protocols.load_from_file_protocol_general_error', max: Constants::NAME_MAX_LENGTH, min: Constants::NAME_MIN_LENGTH) %>');
<% else %>
$('#modal-import-json-protocol-preview').modal('hide');
protocolsDatatable.ajax.reload();
$('#modal-import-json-protocol-preview').modal('hide');
protocolsDatatable.ajax.reload();
<% end %>