diff --git a/frontend/forms.py b/frontend/forms.py index 20747ee3..71f8fa00 100644 --- a/frontend/forms.py +++ b/frontend/forms.py @@ -200,4 +200,23 @@ class EmailShareForm(forms.Form): # allows us to return user to original page by passing it as hidden form input # we can't rely on POST or GET since the emailshare view handles both # and may iterate several times as it catches user errors, losing URL info - next = forms.CharField(widget=forms.HiddenInput()) \ No newline at end of file + next = forms.CharField(widget=forms.HiddenInput()) + +class FeedbackForm(forms.Form): + sender = forms.EmailField(widget=forms.TextInput(attrs={'size':50})) + subject = forms.CharField(max_length=500, widget=forms.TextInput(attrs={'size':50})) + message = forms.CharField(widget=forms.Textarea()) + page = forms.CharField(widget=forms.HiddenInput()) + notarobot = forms.IntegerField(label="Please prove you're not a robot") + answer = forms.IntegerField(widget=forms.HiddenInput()) + num1 = forms.IntegerField(widget=forms.HiddenInput()) + num2 = forms.IntegerField(widget=forms.HiddenInput()) + + def clean(self): + cleaned_data = self.cleaned_data + notarobot = str(cleaned_data.get("notarobot")) + answer = str(cleaned_data.get("answer")) + if notarobot!=answer: + raise forms.ValidationError(_("Whoops, try that sum again.")) + + return cleaned_data diff --git a/frontend/templates/base.html b/frontend/templates/base.html index 7b2fbc16..8e1a7e6b 100644 --- a/frontend/templates/base.html +++ b/frontend/templates/base.html @@ -25,6 +25,9 @@
+Love something? Hate something? Found something broken or confusing? We're so glad you're telling us!
+ + To: support@gluejar.com(161 x 70)
(44 x 30)
Thanks for helping us make Unglue.It better!
+ +Would you like to go back to the page you were on?
+
+{% endblock %}
\ No newline at end of file
diff --git a/frontend/urls.py b/frontend/urls.py
index 471402a5..125d7dc5 100644
--- a/frontend/urls.py
+++ b/frontend/urls.py
@@ -59,4 +59,8 @@ urlpatterns = patterns(
url('^500testing/$', direct_to_template, {'template': '500.html'}),
url('^robots.txt$', direct_to_template, {'template': 'robots.txt'}),
url(r"^emailshare/$", "emailshare", name="emailshare"),
+ url(r"^feedback/$", "feedback", name="feedback"),
+ url(r"^feedback/thanks/$", TemplateView.as_view(template_name="thanks.html")),
+ url(r"^press/$", TemplateView.as_view(template_name="press.html"),
+ name="press"),
)
diff --git a/frontend/views.py b/frontend/views.py
index eeb026c9..4d9274f3 100755
--- a/frontend/views.py
+++ b/frontend/views.py
@@ -4,6 +4,7 @@ import json
import urllib
import logging
import datetime
+from random import randint
from re import sub
from itertools import islice
from decimal import Decimal as D
@@ -39,7 +40,7 @@ from regluit.core.search import gluejar_search
from regluit.core.goodreads import GoodreadsClient
from regluit.frontend.forms import UserData, ProfileForm, CampaignPledgeForm, GoodreadsShelfLoadingForm
from regluit.frontend.forms import RightsHolderForm, UserClaimForm, LibraryThingForm, OpenCampaignForm
-from regluit.frontend.forms import ManageCampaignForm, DonateForm, CampaignAdminForm, EmailShareForm
+from regluit.frontend.forms import ManageCampaignForm, DonateForm, CampaignAdminForm, EmailShareForm, FeedbackForm
from regluit.payment.manager import PaymentManager
from regluit.payment.parameters import TARGET_TYPE_CAMPAIGN, TARGET_TYPE_DONATION
from regluit.payment.paypal import Preapproval, IPN_PAY_STATUS_ACTIVE, IPN_PAY_STATUS_INCOMPLETE, IPN_PAY_STATUS_COMPLETED, IPN_PAY_STATUS_CANCELED
@@ -1080,3 +1081,39 @@ def emailshare(request):
form = EmailShareForm(initial={'next':next, 'message':"I'm ungluing books at unglue.it. Here's one of my favorites: "+next, "sender":sender})
return render(request, "emailshare.html", {'form':form})
+
+def feedback(request):
+ num1 = randint(0,10)
+ num2 = randint(0,10)
+ sum = num1 + num2
+
+ if request.method == 'POST':
+ form=FeedbackForm(request.POST)
+ if form.is_valid():
+ subject = form.cleaned_data['subject']
+ message = form.cleaned_data['message']
+ sender = form.cleaned_data['sender']
+ recipient = 'support@gluejar.com'
+ page = form.cleaned_data['page']
+ message = "<<