Sha256: 48f228fbf2dd27c2d8a719d880bf19b4cfddcf4715d5c4ffe1046712b37be780

Contents?: true

Size: 1.96 KB

Versions: 7

Compression:

Stored size: 1.96 KB

Contents

<% columns = @importer.importable_columns(@importer.parser).map { |column| [@importer.source_klass.human_attribute_name(column), column] }.unshift([t('csv_import_magic.views.importers.edit.ignore_column_label'), :ignore]) %>

<h3 class='page-title'>
  <%= t('csv_import_magic.views.importers.edit.title') %>
  </br>
  <small><%= t('csv_import_magic.views.importers.edit.description') %></small>
</h3>

<%= simple_form_for @importer, url: importer_path(@importer) do |f| %>
  <div class="row csv_import">
    <% import_file_csv.headers.each_with_index do |header, i| %>
    <div class="column">
      <div class="portlet light bordered">
        <div class="portlet-body form">
          <header>
            <%= t('csv_import_magic.views.importers.edit.column') %> <b><%= header %></b>
          </header>

          <% selected = columns.find { |c| c.join(' ').match(/#{header}/i) }.try(:last).presence || :ignore %>
          <%= f.input "columns][", as: :select, collection: columns, label: false, hint: t('csv_import_magic.views.importers.edit.hint'), include_blank: false, selected: f.object.columns[i] || selected %>

          <header class="examples"><%= t('csv_import_magic.views.importers.edit.example_of_values') %></header>
          <table>
            <tbody>
              <% import_file_csv.first(5).each_with_index do |row, c| %>
                <tr>
                  <td class="number"><%= c + 1 %></td>
                  <td><%= row[header] || t('csv_import_magic.views.importers.edit.empty_values') %></td>
                </tr>
              <% end %>
            </tbody>
          </table>
        </div>
      </div>
    </div>
    <% end %>
  </div>

  <div class="form-row actions">
    <%= link_to t('csv_import_magic.views.importers.edit.buttons.cancel'), 'javascript:history.back()', class: 'button button--secondary' %>
    <%= f.submit t('csv_import_magic.views.importers.edit.buttons.import', count: import_file_csv.count), class: 'button button--primary' %>
  </div>
<% end %>

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
csv_import_magic-0.0.7 app/views/csv_import_magic/importers/edit.html.erb
csv_import_magic-0.0.6 app/views/csv_import_magic/importers/edit.html.erb
csv_import_magic-0.0.5 app/views/csv_import_magic/importers/edit.html.erb
csv_import_magic-0.0.4 app/views/csv_import_magic/importers/edit.html.erb
csv_import_magic-0.0.3 app/views/csv_import_magic/importers/edit.html.erb
csv_import_magic-0.0.2 app/views/csv_import_magic/importers/edit.html.erb
csv_import_magic-0.0.1 app/views/csv_import_magic/importers/edit.html.erb