signup_modal.html 5.62 KB
Newer Older
Galen Frechette committed
1
<%namespace name='static' file='static_content.html'/>
2
<%! from django.core.urlresolvers import reverse %>
Matthew Mongeau committed
3
<%! from django_countries.countries import COUNTRIES %>
4
<%! from student.models import UserProfile %>
Matthew Mongeau committed
5
<%! from datetime import date %>
Matthew Mongeau committed
6
<%! import calendar %>
Galen Frechette committed
7

8
<section id="signup-modal" class="modal signup-modal">
Galen Frechette committed
9
  <div class="inner-wrapper">
10
    <div id="register">
11
      <header>
12
        <h2>Sign Up for <span class="edx">edX</span></h2>
13 14
        <hr>
      </header>
Galen Frechette committed
15

16
      <form id="register_form" class="register_form" method="post" data-remote="true" action="/create_account">
Matthew Mongeau committed
17
        <div class="notice"></div>
18 19
        <div id="register_error" class="modal-form-error" name="register_error"></div>
        <div id="register_error" name="register_error"></div>
20 21

        <div class="input-group">
ichuang committed
22
	  % if has_extauth_info is UNDEFINED:
23 24 25 26 27 28 29 30 31 32 33
          <label data-field="email" for="signup_email">E-mail *</label>
	    <input id="signup_email" type="email" name="email" placeholder="e.g. yourname@domain.com" required />
	  
          <label data-field="password" for="signup_password">Password *</label>
	    <input id="signup_password" type="password" name="password" placeholder="&bull;&bull;&bull;&bull;&bull;&bull;&bull;&bull;" required />
          
	  <label data-field="username" for="signup_username">Public Username *</label>
	    <input id="signup_username" type="text" name="username" placeholder="e.g. yourname (shown on forums)" required />
	  
          <label data-field="name" for="signup_fullname">Full Name *</label>
	    <input id="signup_fullname" type="text" name="name" placeholder="e.g. Your Name (for certificates)" required />
ichuang committed
34 35 36
	  % else:
	  <p><i>Welcome</i> ${extauth_email}</p><br/>
	  <p><i>Enter a public username:</i></p>
37 38 39
	  
          <label data-field="username" for="signup_username">Public Username *</label>
	    <input id="signup_username" type="text" name="username" value="${extauth_username}" placeholder="e.g. yourname (shown on forums)" required />
ichuang committed
40
	  % endif
41 42 43 44
        </div>

        <div class="input-group">
          <section class="citizenship">
45
            <label data-field="level_of_education" for="signup_ed_level">Ed. Completed</label>
46
            <div class="input-wrapper">
47
              <select id="signup_ed_level" name="level_of_education">
48
                  <option value="">--</option>
49 50
                  %for code, ed_level in UserProfile.LEVEL_OF_EDUCATION_CHOICES:
                      <option value="${code}">${ed_level}</option>
51 52 53 54 55 56
                  %endfor
              </select>
            </div>
          </section>

          <section class="gender">
57
            <label data-field="gender" for="signup_gender">Gender</label>
58
            <div class="input-wrapper">
59
              <select id="signup_gender" name="gender">
60
                  <option value="">--</option>
61 62 63 64 65 66 67
                  %for code, gender in UserProfile.GENDER_CHOICES:
                      <option value="${code}">${gender}</option>
                  %endfor
              </select>
            </div>
          </section>

68
          <section class="date-of-birth">
69
            <label data-field="date-of-birth" for="signup_birth_year">Year of birth</label>
70
            <div class="input-wrapper">
71
              <select id="signup_birth_year" name="year_of_birth">
72 73 74 75 76 77
                <option value="">--</option>
                %for year in UserProfile.VALID_YEARS:
                  <option value="${year}">${year}</option>
                %endfor
              </select>
              ##<input name="year_of_birth" type="text" placeholder="Year of birth">
78 79
            </div>
          </section>
80

81 82 83 84 85
          <label data-field="mailing_address" for="signup_mailing_address">Mailing address</label>
	    <textarea id="signup_mailing_address" name="mailing_address"></textarea>
	  
          <label data-field="goals" for="signup_goals">Goals in signing up for edX</label>
	    <textarea name="goals" id="signup_goals"></textarea>
86

87 88 89
        </div>

        <div class="input-group">
90 91
          <label data-field="terms_of_service" class="terms-of-service" for="signup_tos">
            <input id="signup_tos" name="terms_of_service" type="checkbox" value="true">
92
            I agree to the
93
            <a href="${reverse('tos')}" target="_blank">Terms of Service</a>*
94 95
          </label>

96 97
          <label data-field="honor_code" class="honor-code" for="signup_honor">
            <input id="signup_honor" name="honor_code" type="checkbox" value="true">
98
            I agree to the
99
            <a href="${reverse('honor')}" target="_blank">Honor Code</a>*
100 101
          </label>
        </div>
Galen Frechette committed
102

103 104 105 106 107
        <div class="submit">
          <input name="submit" type="submit" value="Create My Account">
        </div>
      </form>

ichuang committed
108
      % if has_extauth_info is UNDEFINED:
109 110
      <section class="login-extra">
        <p>
111
          <span>Already have an account? <a href="#login-modal" class="close-signup" rel="leanModal">Login.</a></span>
112 113
        </p>
      </section>
ichuang committed
114
      % endif
115 116

    </div>
Galen Frechette committed
117

118
    <a href="#" class="close-modal" title="Close Modal">
Galen Frechette committed
119 120 121
      <div class="inner">
        <p>&#10005;</p>
      </div>
122
    </a>
Galen Frechette committed
123 124
  </div>
</section>
Matthew Mongeau committed
125 126 127

<script type="text/javascript">
  (function() {
128
   $(document).delegate('#register_form', 'ajax:success', function(data, json, xhr) {
129
     if(json.success) {
130
       location.href="${reverse('dashboard')}";
131
     } else {
132
       $(".field-error").removeClass('field-error');
133
       $('#register_error').html(json.value).stop().css("display", "block");
134
       $("[data-field='"+json.field+"']").addClass('field-error')
135
     }
Matthew Mongeau committed
136
    });
137 138 139 140 141
   
   // removing close link's default behavior
   $('#login-modal .close-modal').click(function(e) {
    e.preventDefault();
   });
Matthew Mongeau committed
142 143
  })(this)
</script>