SMERM/EMUForm

View on GitHub
app/views/works/attach_file.html.erb

Summary

Maintainability
Test Coverage
<%= form_for(@work, url: upload_file_work_path(@work), method: :post, multipart: true) do |f| %>

        <h3>Upload files for <%= @work.title -%></h3>

  <div class="entry-content">
        <!-- Redirect browsers with JavaScript disabled to the origin page -->
        <noscript><%= f.hidden_field :redirect, :value => works_path %></noscript>
        <!-- The fileupload-buttonbar contains buttons to add/delete files and start/cancel the upload -->
        <div class="row fileupload-buttonbar">
            <div class="col-lg-7">
              <!-- The fileinput-button span is used to style the file input field as button -->
              <span class="btn btn-success fileinput-button">
                <i class="glyphicon gliphicon-plus">
                <%= f.file_field 'Add files', value: 'Add files...', :name => 'work[submitted_files_attributes][][http_request]', :multiple => true %>
              </span>
              <!-- <button type="submit" class="btn btn-primary start">
                  <i class="glyphicon glyphicon-upload"></i>
                  <span>Start upload</span>
              </button> -->
              <%= f.button('Cancel upload', :type => 'reset', :class => 'btn btn-warning cancel') %>
              <%= f.button('Delete upload', :type => 'reset', :class => 'btn btn-danger delete') %> <%# don't know how to deal with this yet %>
              <%# f.check_box(:toggle, { value: 'delete' }, { class: 'toggle' }) %><%# removed because I can't make it to work :-( %>
              <!-- The global file processing state -->
              <span class="fileupload-process"></span>
            </div>
            <!-- The global progress state -->
            <div class="col-lg-5 fileupload-progress fade">
                <!-- The global progress bar -->
                <div class="progress progress-striped active" role="progressbar" aria-valuemin="0" aria-valuemax="100">
                    <div class="progress-bar progress-bar-success" style="width:0%;"></div>
                </div>
                <!-- The extended global progress state -->
                <div class="progress-extended">&nbsp;</div>
            </div>
        </div>
        <!-- The table listing the files available for upload/download -->
        <table role="presentation" class="table table-striped"><tbody class="files"></tbody></table>

</div>
  <div class="actions">
    <%= f.submit 'Upload files' %>
  </div>
<% end %>
<br>
<h3 class="panel-title">Upload Instructions</h3>
<ul>
  <li>The maximum file size for uploads is <strong>1 GB</strong>.</li>
  <li>Only <strong>PDF, WAV, AIF, ZIP</strong> files are allowed.</li>
  <li>If your browser does not suck you can <strong>drag &amp; drop</strong> files from your desktop on this webpage.
  If it does, you won't be able to drag &amp; drop (there's a story to be learned here).</li>
</ul>