-
Notifications
You must be signed in to change notification settings - Fork 122
/
import.html.erb
102 lines (101 loc) · 4.11 KB
/
import.html.erb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
<%
translations = {
add: t('admin.import.enumeration.add'),
chooseAll: t('admin.import.enumeration.choose_all'),
clearAll: t('admin.import.enumeration.clear_all'),
down: t('admin.import.enumeration.down'),
remove: t('admin.import.enumeration.remove'),
search: t('admin.import.enumeration.search'),
up: t('admin.import.enumeration.up')
}
%>
<%= render "results" %>
<%= form_tag import_path(@abstract_model), :multipart => true, class: 'form-horizontal denser', data: { turbo: false } do %>
<input name="send_data" type="hidden" value="true">/</input>
<fieldset>
<legend>
<i class="fas fa-chevron-down"></i>
<%= t('admin.import.legend.fields') %>
</legend>
<%= render "section", section: "model_fields", fields: @import_model.model_fields %>
<%= render "section", section: "association_fields", fields: @import_model.association_fields %>
</fieldset>
<fieldset>
<legend>
<i class="fas fa-chevron-down"></i>
<%= t('admin.import.legend.upload') %>
</legend>
<div class="form-group control-group">
<label class="col-sm-2 control-label" for="file">
<%= t("admin.import.file") %>
</label>
<div class="col-sm-10 controls">
<%= file_field_tag :file, :class => "form-control" %>
<p class="help-block">
<%= t('admin.import.help.file_limit', limit: RailsAdminImport.config.line_item_limit) %>
</p>
</div>
</div>
<div class="form-group control-group">
<label class="col-sm-2 control-label" for="encoding">
<%= t("admin.import.encoding") %>
</label>
<div class="col-sm-10 controls">
<%= select_tag 'encoding', options_for_select(Encoding.name_list.sort), include_blank: true, data: { enumeration: true, options: { regional: translations } } %>
<p class="help-block">
<%= t('admin.import.help.encoding', name: 'UTF-8') %>
</p>
</div>
</div>
<div class="form-group control-group">
<label class="col-sm-2 control-label">
<%= t("admin.import.update_if_exists") %>
</label>
<div class="col-sm-10 controls">
<%= check_box_tag :update_if_exists, '1', RailsAdminImport.config.update_if_exists %>
<p class="help-block">
<%= t('admin.import.help.update_if_exists') %>
</p>
</div>
</div>
<div class="form-group control-group">
<label class="col-sm-2 control-label" for="update_lookup">
<%= t("admin.import.update_lookup") %>
</label>
<div class="col-sm-10 controls">
<%= select_tag 'update_lookup', options_for_select(@import_model.update_lookup_field_names, Array.wrap(@import_model.config.mapping_key).map(&:to_s)), multiple: true, data: { enumeration: true, options: { regional: translations } } %>
</div>
</div>
</fieldset>
<% unless @import_model.association_fields.empty? %>
<fieldset>
<legend>
<i class="fas fa-chevron-down"></i>
<%= t('admin.import.legend.mapping') %>
</legend>
<% @import_model.association_fields.each do |field| %>
<div class="form-group control-group">
<label class="col-sm-2 control-label">
<%= field.label %>
<%= t("admin.import.mapping") %>
</label>
<div class="col-sm-10 controls">
<%= select_tag "associations[#{field.name}]", options_for_select(@import_model.associated_model_fields(field), Array.wrap(@import_model.associated_config(field).mapping_key).first.to_s), data: { enumeration: true, options: { regional: translations } } %>
</div>
</div>
<% end %>
</fieldset>
<% end %>
<br/>
<div class="form-actions">
<input name="return_to" type="<%= :hidden %>" value="<%= (request.params[:return_to].presence || request.referer) %>"></input>
<button class="btn btn-primary" data_disable_with="Uploading..." name="commit" type="submit">
<i class="fas fa-check"></i>
<%= t("admin.form.save") %>
</button>
<button class="btn" name="_continue" type="submit">
<i class="fas fa-times"></i>
<%= t("admin.form.cancel") %>
</button>
</div>
<% end %>