fablabbcn/fablabs

View on GitHub
app/views/academics/_form.html.haml

Summary

Maintainability
Test Coverage
= title "Fab Academy Student Form"

= simple_form_for [lab,academic] do |f|

  %fieldset
    %legend My Details
    = render "form_errors", resource: academic
    = f.association :lab, disabled: true
    = f.input :started_in, as: 'select', collection: (2009..2014)
    = f.input :graduated_in, as: 'select', collection: (2009..2014), hint: "Have you graduated yet? If so, when? Leave blank if you have not yet graduated."
    = f.input :url, hint: "What is your archive website URL?", placeholder: "http://academy.cba.mit.edu/2013/students/my.name", label: "Academy Website/Blog URL"

  %fieldset
    %legend Final Project Details
    = f.input :fp_name, placeholder: "Musical Box", label: "Final Project Name"
    = f.input :fp_description, placeholder: "A press-fit box that can synthesize sound.", label: "Description", as: 'text'

    .row
      .col-lg-3= image_tag academic.fp_photo
      .col-lg-9= f.input :fp_photo, input_html: { class: 'fp', data: { fp_store_location: 'S3', fp_store_path: 'final_projects/', fp_store_container: ENV['S3_BUCKET'] } }, label: 'Project Photo'

    = f.input :fp_url, label: "Project URL", hint: "A direct link to details about your final project"

  %fieldset
    %legend Feedback
    %label Disciplines
    %p.hint What were your favourite subjects? Drag the titles from the right, to the left column.

    %table.disciplines
      %thead
        %th.discipline Discipline
        %th <span>Disliked</span>
        %th <span>Didn't enjoy</span>
        %th <span>No Opinion</span>
        %th <span>Liked</span>
        %th <span>Loved</span>
      - Academic::Disciplines.each do |discipline|
        %tr
          %th= discipline.to_s.humanize.titleize.gsub('Three D', '3D')
          -(1..5).each do |i|
            %td= radio_button_tag :rating, i

    -# %table.disciplines
    -#   %thead
    -#     %tr
    -#       %td= fa_icon "thumbs-up", text: "Favourite"
    -#       %td= fa_icon "arrow-left", text: "Drag"
    -#   - Academic::Disciplines.sort.each_with_index do |discipline, index|
    -#     %tr
    -#       %td
    -#         #{index+1}. #{Academic::Favourites[index].to_s.humanize.gsub('Three d', '3D')}
    -#       %td
    -#         %span.discipline= discipline.to_s.humanize.gsub('Three d', '3D')
    -#   %tfoot
    -#     %tr
    -#       %td= fa_icon "thumbs-down", text: "Least Favourite"
    -#       %td= fa_icon "arrow-left", text: "Drag"

    = f.input :comments, label: "Comments / Suggestions / Feedback", as: 'text', hint: "Anything else you have to say about the course, or how it could be improved"

  = f.submit "Submit", class: 'btn btn-primary btn-lg mt-4'