Skip to content

Commit

Permalink
fix(preferences): disable privacy options form
Browse files Browse the repository at this point in the history
  • Loading branch information
theo-o committed Oct 11, 2019
1 parent 60bc4f6 commit ef1c4ef
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 9 deletions.
20 changes: 13 additions & 7 deletions intranet/apps/preferences/views.py
Expand Up @@ -80,13 +80,11 @@ def get_preferred_pic(user):

def save_preferred_pic(request, user):
preferred_pic = get_preferred_pic(user)
logger.debug(preferred_pic)
preferred_pic_form = PreferredPictureForm(user, data=request.POST, initial=preferred_pic)
if preferred_pic_form.is_valid():
logger.debug("Preferred pic form: valid")
if preferred_pic_form.has_changed():
fields = preferred_pic_form.cleaned_data
logger.debug(fields)
if "preferred_photo" in fields:
# These aren't actually the Photos, these are the grade_numbers of the Photos
new_preferred_pic = fields["preferred_photo"]
Expand Down Expand Up @@ -299,12 +297,16 @@ def preferences_view(request):
user = request.user

if request.method == "POST":
logger.debug(dict(request.POST))
phone_formset, email_formset, website_formset, errors = save_personal_info(request, user)
if user.is_student:
preferred_pic_form = save_preferred_pic(request, user)
bus_route_form = save_bus_route(request, user)
privacy_options_form = save_privacy_options(request, user)
"""
The privacy options form is disabled due to the
permissions feature being unused and changes to school policy.
"""
# privacy_options_form = save_privacy_options(request, user)
privacy_options_form = None
else:
preferred_pic_form = None
bus_route_form = None
Expand Down Expand Up @@ -333,21 +335,25 @@ def preferences_view(request):
if user.is_student:
preferred_pic = get_preferred_pic(user)
bus_route = get_bus_route(user)
logger.debug(preferred_pic)
preferred_pic_form = PreferredPictureForm(user, initial=preferred_pic)
bus_route_form = BusRouteForm(initial=bus_route)

"""
The privacy options form is disabled due to the
permissions feature being unused and changes to school policy.
"""
"""
privacy_options = get_privacy_options(user)
logger.debug(privacy_options)
privacy_options_form = PrivacyOptionsForm(user, initial=privacy_options)
"""
privacy_options_form = None
else:
bus_route_form = None
preferred_pic = None
preferred_pic_form = None
privacy_options_form = None

notification_options = get_notification_options(user)
logger.debug(notification_options)
notification_options_form = NotificationOptionsForm(user, initial=notification_options)

dark_mode_form = None
Expand Down
10 changes: 8 additions & 2 deletions intranet/templates/preferences/preferences.html
Expand Up @@ -205,17 +205,22 @@ <h3>Personal Information</h3>

{% if preferred_pic_form %}
<h3>Preferred Picture</h3>
<p>Since the eighth period office and TJ faculty can always see your pictures, it is recommended that you choose your preferred picture even if you disable "Show Pictures" in Privacy Options.</p>
<p>Since the eighth period office and TJ faculty can always see your pictures, it is recommended that you choose your preferred picture.</p>

{% for choice in preferred_pic_form.preferred_photo %}
{{ choice.tag }} {{ choice.choice_label }}<br>
{% endfor %}
<br>
{% endif %}

{% comment %}
The below privacy options form is disabled due to the
permissions feature being unused and changes to school policy.
{% endcomment %}
{% comment %}
{% if privacy_options_form %}
<h3>Privacy Options</h3>
<p>Note that TJ staff members can view all of this information. Want to modify the privacy permissions authorized by your parents? Complete <a href="https://www.tjhsst.edu/studentservices/forms/docs/intranet.pdf">this form</a> and give it to the eighth period office.</p>
<p>Note that TJ staff members can view all of this information.</p>
<table class="privacy-options">
<thead>
{% if request.user.is_student %}
Expand Down Expand Up @@ -247,6 +252,7 @@ <h3>Privacy Options</h3>
</table>
<br>
{% endif %}
{% endcomment %}

{% if dark_mode_form %}
<h3>Dark Mode</h3>
Expand Down

0 comments on commit ef1c4ef

Please sign in to comment.