noesya/osuny

View on GitHub
app/views/admin/university/people/imports/new.html.erb

Summary

Maintainability
Test Coverage
<% content_for :title, Import.model_name.human %>

<div class="row">
  <div class="col-md-6">
    <p>
      <%= t('imports.hint_html') %>
      <br>
      <%= t('university.person.import_hint_html') %>
    </p>
    <%= simple_form_for @import,
                        url: admin_university_people_imports_path do |f| %>

      <%= f.error_notification %>
      <%= f.error_notification message: f.object.errors[:base].to_sentence if f.object.errors[:base].present? %>

      <%# as file can be empty the global object can be unset. To prevent crash in controller add an (unused) hidden field %>
      <%= f.input :id, as: :hidden %>

      <%= f.input :file %>

      <% content_for :action_bar_right do %>
        <%= submit f %>
      <% end %>

      <small>
        <%= t('imports.example_file_html', link: asset_url('people-example.xlsx')) %>
      </small>
    <% end %>

  </div>
  <div class="col-md-6">
    <div class="table-responsive">
      <table class="<%= table_classes %>">
        <tbody>
          <%= render 'admin/university/people/imports/base_infos' %>
        </tbody>
      </table>
    </div>
  </div>
</div>