OfficeMomsandDads/scheduler

View on GitHub
app/views/shift_surveys/_form_fields.html.haml

Summary

Maintainability
Test Coverage
:css
  .survey-text-area {
    display:none;
  }
- if f.object.errors.any?
  #error_explanation
    %h5
      = pluralize(f.object.errors.count, "error")
      prohibited this task from being saved:
    %ul
      - f.object.errors.full_messages.each do |msg|
        %li= msg
.grid-x
  .cell
    = f.label :supplies do
      Did you have adequate supplies to care for the child(ren) during your time at the office?
      <br/>
      .survey-radio{data: {controller: 'shift-survey'}}
        = f.radio_button :supplies, true, data: { target: 'shift-survey.true', action: 'click->shift-survey#handleRadioClick' }
        Yes 
        <br/>
        = f.radio_button :supplies, false , data: { target: 'shift-survey.false', action: 'click->shift-survey#handleRadioClick' }
        No
        = f.text_area :supplies_text, class: "survey-text-area", :rows => 4, placeholder: "Please explain why you answered 'No'", data: { target: 'shift-survey.noTextBox'}
    %hr
    = f.label :response_time do
      Did the assigned social worker respond to questions or concerns in a timely manner?
      <br/>
      .survey-radio{data: {controller: 'shift-survey'}}
        = f.radio_button :response_time, true, data: { target: 'shift-survey.true', action: 'click->shift-survey#handleRadioClick' }
        Yes 
        <br/>
        = f.radio_button :response_time, false, data: { target: 'shift-survey.false', action: 'click->shift-survey#handleRadioClick' }
        No
        = f.text_area :response_time_text, class: "survey-text-area", :rows => 4, placeholder: "Please explain why you answered 'No'", data: { target: 'shift-survey.noTextBox'}
    %hr
    = f.label :hours_match do
      Did the hours you signed up for match the hours you volunteered?
      <br/>
      .survey-radio{data: {controller: 'shift-survey'}}
        = f.radio_button :hours_match, true, data: { target: 'shift-survey.true', action: 'click->shift-survey#handleRadioClick' }
        Yes 
        <br/>
        = f.radio_button :hours_match, false, data: { target: 'shift-survey.false', action: 'click->shift-survey#handleRadioClick' }
        No
        = f.text_area :hours_match_text, class: "survey-text-area", :rows => 4, placeholder: "Please explain why you answered 'No'", data: { target: 'shift-survey.noTextBox'}
    %hr
      How are you feeling after your shift at the child welfare office? (check all that apply)
    = f.label :ratings do
      = f.collection_check_boxes(:ratings, {'Happy': 'Happy', 'Contented': 'Contented', 'Excited': 'Excited', 'Restless': 'Restless', 'Sad': 'Sad', 'Worried': 'Worried', 'Angry': 'Angry'}, :last, :first)
    = f.label :ratings_text do
      Would you like to elaborate? (Optional)
      = f.text_area :ratings_text, :rows => 4, :placeholder => 'Optionally elaborate'
    %hr
    = f.label :comments do
      Your feedback is important to us, and we love hearing from our volunteers! Do you have any comments or kudos you’d like to pass along? (Optional)
      = f.text_area :comments, :rows => 4, :placeholder => 'Enter comments or kudos here'
    %hr
    = f.label :questions do
      Any questions for your Volunteer Coordinator? (Optional)
      = f.text_area :questions, :rows => 4, :placeholder => 'Enter notes for your Volunteer Coordinator here'