expertiza/expertiza

View on GitHub
app/views/import_file/_participant.html.erb

Summary

Maintainability
Test Coverage
<%= form_tag( { :controller => 'import_file', :action => 'import' },
              { :method => 'post', :name => 'column_form', :id => 'column_form' } ) do %>

    <table class="table table-bordered table-striped">

      <thead>
      <tr>

        <% if @has_header == 'true' %>

            <th style="text-align:center">
              <%= @contents_hash[:header][0].to_s.capitalize %>
            </th>
            <th style="text-align:center">
              <%= @contents_hash[:header][1].to_s.capitalize %>
            </th>
            <th style="text-align:center">
              <%= @contents_hash[:header][2].to_s.capitalize %>
            </th>
            <th style="text-align:center">
              <%= @contents_hash[:header][3].to_s.capitalize %>
            </th>
        <% else %>

            <th>
              <select name="select1" id="select1" class="form-control" style="background-color:lightgrey">
                <option value="username">Username</option>
                <option value="fullname">Fullname</option>
                <option value="email">Email</option>
                <option value="password">Password</option>
              </select>
            </th>
            <th>
              <select name="select2" id="select2" class="form-control" style="background-color:lightgrey">
                <option value="fullname">Fullname</option>
                <option value="username">Username</option>
                <option value="email">Email</option>
                <option value="password">Password</option>
              </select>
            </th>
            <th>
              <select name="select3" id="select3" class="form-control" style="background-color:lightgrey">
                <option value="email">Email</option>
                <option value="username">Username</option>
                <option value="fullname">Fullname</option>
                <option value="password">Password</option>
              </select>
            </th>
            <th>
              <select name="select4" id="select4" class="form-control" style="background-color:lightgrey">
                <option value="password">Password</option>
                <option value="username">Username</option>
                <option value="fullname">Fullname</option>
                <option value="email">Email</option>
              </select>
            </th>
        <% end %>

      </tr>
      </thead>

      <tbody>

      <% @contents_hash[:body].each do |row| %>
          <tr>
            <% row.each do |column| %>
                <td align="center"><%= column %></td>
            <% end %>
          </tr>
      <% end %>

      </tbody>
    </table>

    <%= hidden_field_tag('contents_hash', @contents_hash) %>
    <%= hidden_field_tag('has_header', @has_header) %>
    <%= hidden_field_tag('model', @model) %>
    <%= hidden_field_tag('id', @id) %>

    <div style="text-align:center">
      <% if @has_header == 'true' %>
          <button type="button" class="btn btn-primary" onclick="column_form.submit()">Import Participants</button>
      <% else %>
          <button type="button" class="btn btn-primary" onclick="checkForParticipantColumnDuplicate()">Import Participants</button>
      <% end %>
    </div>

<% end %>