2016-12-21 21:34:53 +08:00
|
|
|
<div class="modal-dialog modal-lg" role="document">
|
2016-02-12 23:52:43 +08:00
|
|
|
<div class="modal-content">
|
|
|
|
<div class="modal-header">
|
|
|
|
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
|
2017-01-25 19:01:23 +08:00
|
|
|
<h4 class="modal-title"><%= t('samples.modal_import.title') %></h4>
|
2016-02-12 23:52:43 +08:00
|
|
|
</div>
|
2017-01-25 19:01:23 +08:00
|
|
|
<%= bootstrap_form_tag(url: import_samples_team_path(@team, format: :json),
|
|
|
|
html: {'data-type' => 'json', id: 'form-import'},
|
|
|
|
remote: true) do |f|%>
|
2016-02-12 23:52:43 +08:00
|
|
|
<div class="modal-body">
|
2017-01-25 19:01:23 +08:00
|
|
|
<h4><%= t("teams.parse_sheet.help_text") %></h4>
|
2016-02-12 23:52:43 +08:00
|
|
|
<div style="overflow-x: scroll">
|
2016-12-21 21:34:53 +08:00
|
|
|
<table class="table" style="display: block">
|
2016-02-12 23:52:43 +08:00
|
|
|
<thead>
|
|
|
|
<th style="min-width: 100px">
|
2017-01-25 19:01:23 +08:00
|
|
|
<p><%= t("teams.parse_sheet.scinote_columns_html") %></p>
|
|
|
|
<p style="margin-bottom: 0px"><%= t("teams.parse_sheet.file_columns") %></p>
|
2016-02-12 23:52:43 +08:00
|
|
|
</th>
|
|
|
|
<% @header.each.with_index do |th, index| %>
|
2016-12-21 21:34:53 +08:00
|
|
|
<th style="min-width: 150px" title="<%= th %>">
|
2017-01-25 19:01:23 +08:00
|
|
|
<%= f.select("mappings[#{index.to_s}]",
|
|
|
|
options_from_collection_for_select(@available_fields,
|
|
|
|
:first,
|
|
|
|
:last),
|
|
|
|
include_blank: t('teams.parse_sheet.do_not_include_column'),
|
|
|
|
hide_label: true) %>
|
2016-02-12 23:52:43 +08:00
|
|
|
<br />
|
2017-07-18 20:54:35 +08:00
|
|
|
<% if th.nil? %>
|
|
|
|
<i><%= t('samples.modal_import.no_header_name') %></i>
|
2016-12-21 21:34:53 +08:00
|
|
|
<% else %>
|
2017-07-18 20:54:35 +08:00
|
|
|
<% if th.length > Constants::NAME_TRUNCATION_LENGTH_DROPDOWN %>
|
|
|
|
<div class="modal-tooltip">
|
|
|
|
<%= truncate(th, length: Constants::NAME_TRUNCATION_LENGTH_DROPDOWN) %>
|
|
|
|
</div>
|
|
|
|
<% else %>
|
|
|
|
<%= th %>
|
|
|
|
<% end %>
|
2016-12-21 21:34:53 +08:00
|
|
|
<% end %>
|
2016-02-12 23:52:43 +08:00
|
|
|
</th>
|
|
|
|
<% end %>
|
|
|
|
</thead>
|
|
|
|
<tbody>
|
2017-07-18 20:54:35 +08:00
|
|
|
<tr>
|
|
|
|
<td>
|
|
|
|
<p><%= t('teams.parse_sheet.example_value') %></p>
|
|
|
|
</td>
|
|
|
|
<% @columns.each do |td| %>
|
2016-02-12 23:52:43 +08:00
|
|
|
<td>
|
2017-07-18 20:54:35 +08:00
|
|
|
<%= td %>
|
2016-02-12 23:52:43 +08:00
|
|
|
</td>
|
2017-07-18 20:54:35 +08:00
|
|
|
<% end %>
|
|
|
|
</tr>
|
2016-02-12 23:52:43 +08:00
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
</div>
|
2017-01-25 19:01:23 +08:00
|
|
|
<%= hidden_field_tag 'file_id', @temp_file.id %>
|
2016-02-12 23:52:43 +08:00
|
|
|
|
|
|
|
<div id="import-errors-container">
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="modal-footer">
|
2017-01-25 19:01:23 +08:00
|
|
|
<button type="button" class="btn btn-default" data-dismiss="modal"><%= t('general.cancel')%></button>
|
|
|
|
<input type="submit" class="btn btn-primary" value="<%= t('teams.parse_sheet.import_samples') %>"</input>
|
2016-02-12 23:52:43 +08:00
|
|
|
</div>
|
|
|
|
<% end %>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
2017-01-25 19:01:23 +08:00
|
|
|
<%= javascript_include_tag('samples/samples_importer') %>
|