swchoi727/LEP

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

Summary

Maintainability
Test Coverage
-# = form_for :user, url: {action: "create"}, :class => "field_with_errors" do |f|
= form_for(@user) do |f|

  -# PRINT 2
  - flash.each do |type, message|
    %div.field_with_errors
      - message.each do |msg|
        = msg
        %br

  -# SET UP OPTIONS ARRAYS
  - languages = ["Arabic", "Cantonese", "English", "French", "German", "Indonesian", "Italian", "Japanese", "Korean", "Mandarin", "Portuguese", "Russian", "Spanish", "Swedish", "Tagalog", "Thai", "Vietnamese", "Other"]
  - days_of_week = ["Monday","Tuesday","Wednesday","Thursday","Friday"]
  - language_options = [["Arabic", "arabic"], ["Cantonese", "cantonese"], ["English", "english"], ["French", "french"], ["German", "german"], ["Indonesian", "indonesian"], ["Italian","italian"], ["Japanese", "japanese"], ["Korean", "korean"], ["Mandarin", "mandarin"], ["Portuguese", "portuguese"], ["Russian", "russian"], ["Spanish", "spanish"], ["Swedish", "swedish"], ["Tagalog", "tagalog"], ["Thai", "thai"], ["Vietnamese", "vietnamese"], ["Other", "other"]]

  -# BEGIN FORM
  %div.question
    = f.label :first_name, "First Name"
    = f.text_field :first_name

  %div.question
    = f.label :last_name, "Last Name"
    = f.text_field :last_name

  %div.question
    = f.label :sid, "Student ID Number"
    = f.text_field :sid

  %div.question
    = f.label :email, "Berkeley Email"
    = f.text_field :email

  %div.question
    = f.label :academic_title, "Academic Title"
    = f.select :academic_title, [["Undergraduate", "undergraduate"], ["Graduate", "graduate"], ["Staff", "staff"], ["Scholar", "scholar"], ["Instructor", "instructor"], ["Other", "other"]]

  %div.question
    = f.label :major, "Major(s)"
    = f.text_field :major

  %div.question
    = f.label :residency, "Residency"
    = f.select :residency, [["Domestic", "domestic"], ["International", "international"]]

  %div.question
    = f.label :gender, "Self-Identified Gender (For matching purpose only)"
    = f.select :gender, [["Male", "male"], ["Female", "female"], ["Both or neither", "both_or_neither"]]

  %div.question
    = f.label :gender_preference, "Gender Preference (For matching purpose only)"
    = f.select :gender, [["Male", "male"], ["Female", "female"], ["Indifferent", "indifferent"]]

  %div.question
    = f.label :fluent_languages, "Language(s) you speak with native fluency"
    - languages.each do |language|
      - if language == "Other"
        = f.check_box :fluent_languages, { :multiple => true, :id => "fluent_languages", :class => "fluent_languages"}, language.downcase
      - else
        = f.check_box :fluent_languages, { :multiple => true}, language.downcase
      = language
      %br
    = f.text_field :fluent_languages_other, {:id => "fluent_languages_other", :class => "fluent_languages_other"}
    %br
    

  %div.question
    = f.label :first_lang_preference, "1. Language you are interested in practicing"
    -#= f.select :first_lang_preference, languages, :multiple => true
    = f.select :first_lang_preference, language_options, {:class => "first_lang_preference"}, :id => "first_lang_preference"
    = text_field_tag "first_lang_preference_other", nil, {:id => "first_lang_preference_other"}

  %div.question
    = f.label :first_lang_proficiency, "How proficient are you in this language?"
    = f.select :first_lang_proficiency, [["Elementary proficiency", "elementary"],["Limited proficiency", "limited"], ["Intermediate proficiency","intermediate"], ["Nearly-full professional proficiency", "nearly_proficient"]]

  %div.question
    = f.label :second_lang_preference, "2. Language you are interested in practicing"
    -#= f.select :second_lang_preference, languages, :multiple => true
    = f.select :second_lang_preference, language_options, {:class => "second_lang_preference"}, :id => "second_lang_preference"
    = text_field_tag "second_lang_preference_other", nil, {:id => "second_lang_preference_other"}

  %div.question
    = f.label :second_lang_proficiency, "How proficient are you in this language?"
    = f.select :second_lang_proficiency, [["Elementary proficiency", "elementary"],["Limited proficiency", "limited"], ["Intermediate proficiency","intermediate"], ["Nearly-full professional proficiency", "nearly_proficient"]]

  %div.question
    = f.label :group_leader, "Do you want to lead a language group?"
    = f.select :group_leader, [["No"],["Yes"]]

  %div.question
    = f.label :group_language, "If you answered yes to the previous question, what language would you like to lead a language group in?"
    = f.select :group_language, language_options, {:class => "group_language"}, :id => "group_language"
    = text_field_tag "group_language_other", nil, {:id => "group_language_other"}


  %div.question
    = f.label :lang_additional_info, "Additional information you would like us to know"
    = f.text_field :lang_additional_info

  %div.question
    = f.label :time_preference, "Times you could meet with your partner(s)"
    -#= f.select :time_preference, grouped_options_for_select([['Monday',meeting_times],['Tuesday',meeting_times],['Wednesday',meeting_times],['Thursday',meeting_times], ['Friday',meeting_times]]), {}, :multiple => true
    - days_of_week.each do |day|
      = f.check_box(:time_preference, {:multiple => true }, day)
      = day
      %br

  %div.question
    = f.label :hours_per_week, "How many hours per week do you wish to practice with your partner(s)?"
    = f.text_field :hours_per_week

  %div.question
    = f.label :user_motivation, "What do you hope to gain from the SLC’s Language Exchange Program?"
    = f.text_field :user_motivation

  %div.question
    = f.label :user_plan, "How do you plan to maintain your motivation to meet with your partner(s) weekly?"
    = f.text_field :user_plan

  %div.question
    %p
    = f.submit 'Submit'