codeRIT/hackathon_manager

View on GitHub
app/views/rsvps/show.html.haml

Summary

Maintainability
Test Coverage
- title "RSVP"
.form-container
  - if @questionnaire.unaccepted_agreements.any?
    = render partial: 'unaccepted_agreements_notice'
  - if @questionnaire.country.blank?
    = render partial: 'missing_country_notice'
= simple_form_for @questionnaire, url: url_for(controller: "rsvps", action: "update"), html: { "data-validate" => "form" } do |f|
  .form-container
    #disclaimer
      %h1.section-title
        RSVP
        %span.emphasized Preferences
      %p
        - if @questionnaire.checked_in?
          %strong
            %span.fa.fa-check.icon-space-r-half
            You have been checked in
        - elsif @questionnaire.acc_status == "rsvp_confirmed"
          %strong
            %span.fa.fa-check.icon-space-r-half
            YOU ARE ATTENDING!
          - if HackathonConfig['thanks_for_rsvp_message'].present?
            %br
            = markdown(HackathonConfig['thanks_for_rsvp_message'])
          - else
            %br
        - else
          %strong
            - if @questionnaire.acc_status == "accepted"
              %span.fa.fa-clock-o.icon-space-r-half
            - elsif @questionnaire.acc_status == "rsvp_denied"
              %span.fa.fa-close.icon-space-r-half
            = current_user.questionnaire.verbal_status.upcase
          - if @questionnaire.acc_status == "rsvp_denied"
            %p Sorry to hear you won't be with us this year.
          - else
            %p You've been accepted to #{HackathonConfig['name']}!
            %p Will you be attending?

      .form-inputs
        = f.input :acc_status, as: :radio_buttons, collection: { " Attending!" => "rsvp_confirmed", " Not Attending." => "rsvp_denied" }, label: "Attendance:", required: true

        .hide-if-not-attending{ style: @questionnaire.acc_status == "rsvp_denied" ? "display: none;" : "" }
          = f.input :phone, input_html: { "data-validate" => "presence" }, label: "Please verify your phone number:"

      = f.button :submit, value: "Update", disabled: @questionnaire.invalid?

  - if BusList.any? && !HackathonConfig['digital_hackathon']
    .form-container.hide-if-not-attending{ style: @questionnaire.acc_status == "rsvp_denied" ? "display: none;" : "" }
      #disclaimer
        %h1.section-title
          Bus
          %span.emphasized Sign-up
        - if @questionnaire.acc_status == "rsvp_confirmed" || @questionnaire.checked_in?
          %strong
            - if @questionnaire.bus_list_id
              %span.fa.fa-check.icon-space-r-half
              YOU ARE RIDING THE BUS
            - else
              %span.fa.fa-close.icon-space-r-half
              YOU ARE NOT RIDING BUS
          %br

        %p
          We are providing free, sponsored busses. Will you be riding?
          %br
          %em
            %strong You must sign up here if you want to ride.

        .form-inputs
          - bus_list_options = ([OpenStruct.new({ name_maybe_full: 'Not riding a sponsored bus', id: '' })] + BusList.all.to_a)
          = f.association :bus_list, as: :radio_buttons, collection: bus_list_options, label_method: :name_maybe_full, value_method: :id, label: false, wrapper_html: { class: 'radio_buttons_vertical' }
          - if BusList.where(needs_bus_captain: true).any?
            = f.input :bus_captain_interest, as: :radio_buttons, collection: { " Yes!" => true, " No, thank you." => false }, label: "Would you be interested in being a bus captain?"
        %p
          %small Busses will pick up the morning of, arriving in time for opening ceremony. They will depart shortly after closing ceremony, dropping off to the same pick-up locations.
        %p
          %small If you sign up for a bus not stopping at your school, you are responsible for transportation to & from a pick-up location.

        = f.button :submit, value: "Update", disabled: @questionnaire.invalid?
        %br
        - if @questionnaire.bus_list_id && @questionnaire.is_bus_captain?
          %p= link_to "Bus Captain Dashboard »".html_safe, bus_list_path

        - if @questionnaire.bus_list_id
          = render partial: 'bus_list_info', locals: { bus_list: @questionnaire.bus_list }
  - else
    = f.input :bus_list_id, as: :hidden, value: ''