updateStudent.html 9.93 KB
Newer Older
1
2
{% extends 'layouts/base.html' %}

3
{% block title %} SRCT Roomlist | Student | {{ request.user.student.get_full_name_or_uname }} | Update {% endblock %}
4

Daniel W Bond's avatar
Daniel W Bond committed
5
{% block message_queue %}
6
7
8
{% endblock %}

{% block content %}
9
10
{% load cache %}
{% cache 4 student_update request.user.username %}
11

12
13
{% include 'room_change_warning.html' %}

14
15
{% include 'messages.html' %}

16
17
{% load accounts_extras %}

18
19
20
<div class="page-header" id="banner">
  <div class="row">
    <div class="col-md-12 text-center">
21
      <h1><strong>SRCT</strong>ROOMLIST</a></strong> Student Update</h1>
22
23
24
25
26
    </div>
  </div>
</div>

<div class="row">
27
  <div class="col-md-12 text-center">
28
    <h2><strong>Welcome, {{ request.user.student.get_first_name_or_uname }}!</strong></h2>
29
30
31
32
33
  </div>
</div>

<br />

34
{% load socialaccount %}
35

36
37
{% get_social_accounts request.user as accounts %}

38
39
40
41
42
43
44
45
46
47
48
<div class="row">
  <div class="col-md-4">
    <div class="panel panel-default">
      <div class="panel-heading">
        <h1 class="panel-title text-center"><strong>Social Media Settings</strong></h1>
      </div>
      <div class="panel-body">
        <p class="text-center">Verify your social media accounts to link them to other students.</p>
        <div class="row text-center">
          <div class="col-md-6">
          {% if accounts.facebook %}
49
50
51
52
53
          <p><i class="fa fa-check-square-o"></i> Verified!</p>
            <h4><i class="fa fa-facebook fa-2x"></i></h4>
            <h4>Facebook</h4>
          {% else %}
          <a href="{% provider_login_url 'facebook' process='connect' %}">
54
55
56
            <h4><i class="fa fa-facebook fa-2x"></i></h4>
            <h4>Facebook</h4>
          </a>
57
          {% endif %}
58
59
60
61
          </div>
          <div class="col-md-6">
          {% if accounts.google %}
            <p><i class="fa fa-check-square-o"></i> Verified!</p>
62
63
64
65
            <h4><i class="fa fa-google fa-2x"></i></h4>
            <h4>Google</h4>
          {% else %}
          <a href="{% provider_login_url 'google' process='connect' %}">
66
67
68
            <h4><i class="fa fa-google fa-2x"></i></h4>
            <h4>Google</h4>
          </a>
69
          {% endif %}
70
71
72
73
74
75
76
          </div>
        </div>
        <br />
        <div class="row text-center">
          <div class="col-md-6">
          {% if accounts.twitter %}
            <p><i class="fa fa-check-square-o"></i> Verified!</p>
77
78
79
80
            <h4><i class="fa fa-twitter fa-2x"></i></h4>
            <h4>Twitter</h4>
          {% else %}
          <a href="{% provider_login_url 'twitter' process='connect' %}">
81
82
83
            <h4><i class="fa fa-twitter fa-2x"></i></h4>
            <h4>Twitter</h4>
          </a>
84
          {% endif %}
85
86
87
88
          </div>
          <div class="col-md-6">
          {% if accounts.instagram %}
            <p><i class="fa fa-check-square-o"></i> Verified!</p>
89
90
91
92
            <h4><i class="fa fa-instagram fa-2x"></i></h4>
            <h4>Instagram</h4>
          {% else %}
          <a href="{% provider_login_url 'instagram' process='connect' %}">
93
94
95
            <h4><i class="fa fa-instagram fa-2x"></i></h4>
            <h4>Instagram</h4>
          </a>
96
          {% endif %}
97
98
          </div>
        </div>
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
        <br />
        <div class="row text-center">
          <div class="col-md-6">
          {% if accounts.tumblr %}
            <p><i class="fa fa-check-square-o"></i> Verified!</p>
            <h4><i class="fa fa-tumblr fa-2x"></i></h4>
            <h4>Tumblr</h4>
          {% else %}
          <a href="{% provider_login_url 'tumblr' process='connect' %}">
            <h4><i class="fa fa-tumblr fa-2x"></i></h4>
            <h4>Tumblr</h4>
          </a>
          {% endif %}
          </div>
          <div class="col-md-6">
          {% if accounts.github %}
            <p><i class="fa fa-check-square-o"></i> Verified!</p>
            <h4><i class="fa fa-github fa-2x"></i></h4>
            <h4>Github</h4>
          {% else %}
          <a href="{% provider_login_url 'github' process='connect' %}">
            <h4><i class="fa fa-github fa-2x"></i></h4>
            <h4>Github</h4>
          </a>
          {% endif %}
          </div>
        </div>
        <br />
        {% if accounts %}
          <div class="row text-center">
            <a href="{% url 'remove_social' request.user.username %}">
              <button class="btn btn-xs btn-danger">Disconnect Accounts</button>
            </a>
          </div>
        {% endif %}
134
135
136
137
138
      </div>
    </div>
  </div>

  <div class="col-md-8">
139
140
141

    <div class="panel panel-default">
      <div class="panel-heading">
142
        <h1 class="panel-title text-center"><strong>Student Settings</strong></h1>
143
144
145
      </div>

      <div class="panel-body">
146
        <p class="text-center">A select number of locations <a href="{% url 'list_buildings'%}#Unsupported">on campus</a> aren't currently supported. You are still welcome to use Roomlist as a limited directory until we add support.</p>
147
148
149
150
151
        <p class="text-center">
          If you have a <a href="https://en.gravatar.com/">Gravatar profile</a> associated
          with your <a href="https://masonlive.gmu.edu/">Masonlive email</a> address, your
          default profile picture on this service will that Gravatar profile picture.
        </p>
152
153
154
155
156
157
158
159
160
        <hr />
        {% if my_form.non_field_errors %}
        <ul class="text-center">
          {% for error in form.non_field_errors %}
            <li>{{ error }}</li>
          {% endfor %}
        </ul>
        <hr />
        {% endif %}
161
        {% spaceless %}
162
        <form class="form-horizontal" autocomplete="off" action="" method="post">{% csrf_token %}
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
          <fieldset>
          <div class="form-group">
            <label for="{{ my_form.first_name.id_for_label }}" class="col-md-2">First Name</label>
              <div class="col-md-4">
                {% if not my_form.first_name.errors %}
                  {{ my_form.first_name }}
                {% else %}
                  <div class="has-error">
                    {{ my_form.first_name }}
                    <p>{{ form.first_name.errors }}</p>
                  </div>
                {% endif %}
              </div>
            <label for="{{ my_form.last_name.id_for_label }}" class="col-md-2">Last Name</label>
              <div class="col-md-4">
                {% if not my_form.last_name.errors %}
                  {{ my_form.last_name }}
                {% else %}
                  <div class="has-error">
                    {{ my_form.last_name }}
                    <p>{{ form.last_name.errors }}</p>
                  </div>
                {% endif %}
              </div>
          </div>
          <div class="form-group">
            <label for="{{ my_form.gender.id_for_label }}" class="col-md-3">
              Gender Identity<br />(choose all that apply)
            </label>
              {% for checkbox in my_form.gender %}
                <div class="checkbox col-md-3">
                  <label for="{{ checkbox.id_for_label }}">
                    {{ checkbox.choice_label|gender_icon }}
                    {{ checkbox.tag }}
                  </label>
                </div>
              {% endfor %}
          </div>
          <div class="form-group">
            <label for="{{ my_form.show_gender.id_for_label }}" class="col-md-3">
              Show Gender on Profile?
            </label>
              {% for option in my_form.show_gender %}
                <label class="radio-inline">{{ option.choice_label }}{{ option.tag }}</label>
              {% endfor %}
          </div>
          <div class="form-group">
            <label for="{{ my_form.major.id_for_label }}" class="col-md-2">
              Major<br />(select one)
            </label>
            <div class="col-md-4">
              {{ my_form.major }}
            </div>
          </div>
          <div class="form-group">
            <label for="{{ my_form.graduating_year.id_for_label }}" class="col-md-2">
              Graduating Year
            </label>
              <div class="col-md-2">
                {{ my_form.graduating_year }}
              </div>
          </div>
          {% if not request.user.student.recent_changes > 2 %}
          <hr />
          <div class="form-group">
            <label for="{{ my_form.on_campus.id_for_label }}" class="col-md-3">
              Do You Live on Campus?
            </label>
              {% for option in my_form.on_campus %}
                <label class="radio-inline">{{ option.choice_label }}{{ option.tag }}</label>
              {% endfor %}
          </div>
          <div id="lives-on-campus">
            <div class="form-group">
              <div class="col-md-12">
                {{ my_form.room }}
              </div>
            </div>
            <div class="form-group">
              <label for="{{ my_form.privacy.id_for_label }}" class="col-md-2">
                Privacy
              </label>
                {{ my_form.privacy }}
            </div>
          </div>
          {% endif %}
          <hr />
250
          <input type="submit" value="Save" class="btn btn-primary"/>
251
        </fieldset>
252
        </form>
253
        {% endspaceless %}
254
255
256
257
258
259
      </div>
    </div>

  </div>
</div>

260
{% endcache %}
Daniel W Bond's avatar
Daniel W Bond committed
261
262
263
264
265
{% endblock content %}

{% block javascript %}
  <script type="text/javascript" src="/static/js/jquery.chained.min.js"></script>
  <script>
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
    // toggle room selection availability
    // can see if on campus, cannot see if not on campus
    $(document).ready(function() {
      var $radio = $('input:radio[name=on_campus]');
      // when first rendering the page
      if($radio.filter('[value=False]').is(':checked')) {
        $("#lives-on-campus").hide();
      } else {
        $("#lives-on-campus").show();
      }
      // if student changes the value
      $($radio.filter('[value=False]').click(function(){
        $("#lives-on-campus").slideUp();
      }));
      $($radio.filter('[value=True]').click(function(){
        $("#lives-on-campus").slideDown();
      }));
    });
    $("#lives-on-campus").hide();

    // room selection
Daniel W Bond's avatar
Daniel W Bond committed
287
288
289
290
291
    $("#building").chained("#neighborhood");
    $("#floor").chained("#building");
    $("#room").chained("#floor");
  </script>
{% endblock javascript %}