rubyforgood/casa

View on GitHub
app/views/imports/_volunteers.html.erb

Summary

Maintainability
Test Coverage
<div class="mb-3">
  <h4>
    1.
    <%= link_to "/volunteers.csv", format: :csv, download: "volunteers.csv" do %>
      Download and reference example Volunteer CSV file
      <i class="lni lni-download"></i>
    <% end %>
  </h4>
</div>

<div class="mb-3">
  <h4>
    2. Upload your CSV file
    <i class="lni lni-upload" aria-hidden="true"></i>
  </h4>
  <%= form_with(url: imports_path, local: :true, id: "volunteer-import-form") do |f| %>
    <%= f.hidden_field :import_type, value: "volunteer" %>
    <%= f.hidden_field :sms_opt_in, value: false %>
    <ul style="list-style-type: disc;" class="mx-4">
      <li>Click the choose file button and navigate to the saved file and select it.</li>
      <li><strong>Do not</strong> change any of the values in the first line of the example csv file.</li>
      <li>Then click the "Import Volunteers CSV" button to import your volunteers. <strong>This will email the new volunteers asking them to log in!</strong></li>
    </ul>
    <%= f.file_field :file,
                     id: 'volunteer-file',
                     accept: 'text/csv',
                     class: 'form-control mt-4',
                     type: 'file',
                     style: "margin: auto;" %>
    </div>

    <%= render "sms_opt_in_modal", { form: f } if @sms_opt_in_warning == "volunteer" %>
    <%= button_tag id: "volunteer-import-button", class: "main-btn primary-btn btn-hover pull-right",
      disabled: true, data: { disable_with: "<div class='spinner-border spinner-border-sm'></div> Importing File" } do %>
      <i class="lni lni-upload"></i> Import Volunteers CSV
    <% end %>
  <% end %>