Skip to content

Commit

Permalink
restore css and add referrer to form
Browse files Browse the repository at this point in the history
  • Loading branch information
higs4281 committed Jan 22, 2017
1 parent 2b71cf5 commit 54e4b2b
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 23 deletions.
1 change: 1 addition & 0 deletions paying_for_college/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

class FeedbackForm(forms.Form):
message = forms.CharField(widget=forms.Textarea)
referrer = forms.CharField(widget=forms.HiddenInput)


class EmailForm(forms.Form):
Expand Down
19 changes: 19 additions & 0 deletions paying_for_college/migrations/0012_add_feedback_url.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('paying_for_college', '0011_remove_choices_from_settlement_school_field'),
]

operations = [
migrations.AddField(
model_name='feedback',
name='url',
field=models.TextField(null=True, blank=True),
),
]
1 change: 1 addition & 0 deletions paying_for_college/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -737,6 +737,7 @@ class Feedback(models.Model):
"""
created = models.DateTimeField(auto_now_add=True)
message = models.TextField()
url = models.TextField(blank=True, null=True)


def print_vals(obj, val_list=False, val_dict=False, noprint=False):
Expand Down
15 changes: 7 additions & 8 deletions paying_for_college/templates/feedback.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,20 @@
{% block title %}Paying for College - Compare financial aid and college cost{% endblock %}

{% block page_css %}
<link rel="stylesheet" href="{% static "paying_for_college/feedback/css/comparison-tool.css" %}">
<link rel="stylesheet" href="{% static 'paying_for_college/feedback/css/comparison-tool.css' %}">
{% endblock %}


{% block page_js %}
<script src="{% static "paying_for_college/feedback/js/feedback.js" %}"></script>
<script src="{% static 'paying_for_college/feedback/js/feedback.js' %}"></script>
{% endblock %}

{% block body_class %}page paying-for-college{% endblock %}

{% block content %}
<div id="comparison-tool" class="comparison-tool sub-page-wrapper">
{% block content %}
<div id="comparison-tool" class="comparison-tool sub-page-wrapper">
<header id="comparison-tool-header" class="feedback-header">
<a class="noStyles" href="/{{url_root}}/">
<h1>Paying for College</h1>
</a>
<span>Understanding your financial aid offer</span>
</header><!-- end #comparison-tool-header -->

Expand All @@ -31,15 +29,16 @@ <h2>What do you think about this tool?</h2>
</header>
<div>
<p>The Consumer Financial Protection Bureau is a 21st century agency committed to using technology to empower consumers to take control over their economic lives.</p>
<p>With your help, you can help us design a tool that makes that process a little bit less daunting&ndash; helping families make smarter choices about student debt.</p>
<p>With your help, you can help us design a tool that makes that process a little bit less daunting &ndash; helping families make smarter choices about student debt.</p>
<form method="post" id="feedback-container">
<label for="id_message"><span class="demi">Enter your comments here</span></label>
{% csrf_token %}
<input type="hidden" name="referrer" value="{{ request.META.HTTP_REFERER }}">
<span class="pfc-feedback">{{ form.message }}</span>
<p><button>Submit your feedback</button></p>
</form>
</div>
</div>
</section><!-- end .feedback-section -->
</div><!-- end #comparison-tool .comparison-tool -->
</div>
{% endblock content %}
14 changes: 6 additions & 8 deletions paying_for_college/templates/feedback_thanks.html
Original file line number Diff line number Diff line change
@@ -1,26 +1,24 @@
{% extends "front/base_update.html" %}
{% extends base_template %}
{% load staticfiles %}

{% block title %}Paying for College - Compare financial aid and college cost{% endblock %}

{% block page_css %}
<link rel="stylesheet" href="{{ STATIC_PREFIX }}comparisontool/css/comparison-tool.css">
<link rel="stylesheet" href="{% static 'paying_for_college/feedback/css/comparison-tool.css' %}">
{% endblock %}


{% block page_js %}
<script type="text/javascript" src="{{ STATIC_PREFIX }}comparisontool/js/cfpb-comparison-analytics-min.js"></script>
<script src="{{ STATIC_PREFIX }}comparisontool/js/feedback.js"></script>
<script src="{% static 'paying_for_college/feedback/js/feedback.js' %}"></script>
{% endblock %}

{% block body_class %}page paying-for-college{% endblock %}

{% block content %}
<div id="comparison-tool" class="comparison-tool sub-page-wrapper">
<header id="comparison-tool-header" class="feedback-header">
<a class="noStyles" href="/paying-for-college/">
<h1>Paying for College</h1>
</a>
<span>Compare financial aid and college cost</span>
<span>Understanding your financial aid offer</span>
</header><!-- end #comparison-tool-header -->

<section class="feedback-section clearfix">
Expand All @@ -30,7 +28,7 @@ <h1>Paying for College</h1>
<h2 class="demi">Thank you for your feedback!</h2>
</header>
<div>
<p>We’ll be sure to review your ideas and input, which will help us make the Paying for College cost comparison worksheet even more helpful!</p>
<p>We’ll be sure to review your ideas and input, which will help us make the financial aid tool even more helpful!</p>
<p class="medium">Stay informed about CFPB updates by joining our mailing list.</p>
<form class="signup inlineSignup pfc-signup" action="https://public.govdelivery.com/service/process_ss.xml" method="GET" data-thanks="Thanks!">
<fieldset>
Expand Down
19 changes: 12 additions & 7 deletions paying_for_college/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,9 +164,10 @@ def get(self, request, test=False):
warning = PID_ERROR
PID = ''
if PID:
programs = Program.objects.filter(program_code=PID,
institution=school,
test=test).order_by('-pk')
programs = Program.objects.filter(
program_code=PID,
institution=school,
test=test).order_by('-pk')
if programs:
program = programs[0]
program_data = program.as_json()
Expand Down Expand Up @@ -221,11 +222,15 @@ def get_context_data(self):
def post(self, request):
form = self.form
if form.is_valid():
feedback = Feedback(message=form.cleaned_data['message'][:2000])
base_template = BASE_TEMPLATE
feedback = Feedback(
message=form.cleaned_data['message'][:2000],
url=form.cleaned_data['referrer'])
feedback.save()
return render_to_response("feedback_thanks.html",
locals(),
context_instance=RequestContext(request))
return render_to_response(
"feedback_thanks.html",
locals(),
context_instance=RequestContext(request))
else:
return HttpResponseBadRequest("Invalid form")

Expand Down

0 comments on commit 54e4b2b

Please sign in to comment.