johnrees/fablabs

View on GitHub
app/views/projects/_media.html.haml

Summary

Maintainability
Test Coverage
.row
  .col-lg-3
    %span#file-input-name
  .col-lg-9
    = f.label :images_files
    = f.fields_for :documents_attributes, project.documents do |d|
      %span#file-click.btn.btn-primary.button-file
        Pick file
        = d.file_field "photo", name: "project[documents_attributes][][photo]", class: "document_photo", multiple: true
%hr/
.row
  .col-lg-3
  .col-lg-9
    - if @project.documents.present?
      = f.label "Thumbnails"
      %p
        Select the image that you would like to use as cover image.
      %ul
        - @project.documents.each do |document|
          %li.thumbs
            %div
              = f.radio_button :cover, document.id
              %label.radio
                = document.id
            %h4
              = link_to icon('trash-o'), document_path(document), method: :delete
            - if document.photo.present?
              = image_tag document.photo.thumb("200x200").url