Permalink
Browse files

[bug 970325] Add product picker page

* add product picker page
* create feedback/base.html template for feedback form related templates

This doesn't completely solve 970325, but gets us a step of the way
there.
  • Loading branch information...
1 parent 57de006 commit 7c4e6ddd9b3b68d6b4562618a71ae37c9984b5e5 @willkg willkg committed Feb 26, 2014
@@ -0,0 +1,14 @@
+{% extends "base.html" %}
+
+{% block extra_headers %}
+ <meta name="viewport" content="height=480, width=320, initial-scale=1, maximum-scale=1, minimum-scale=1">
+{% endblock %}
+
+{% block site_css %}
+ {{ css('generic_feedback') }}
+{% endblock %}
+
+{% block site_js %}
+ <script src="{{ settings.STATIC_URL }}js/lib/brick-1.0beta8.byob.min.js"></script>
+ {{ js('generic_feedback') }}
+{% endblock %}
@@ -0,0 +1,35 @@
+{% extends "feedback/base.html" %}
+{# Note: This is not l10n-ized since it's a prototype. #}
+
+{% block page_title %}Which product?{% endblock %}
+
+{% block body %}
+ <x-deck>
+ <x-card id="picker">
+ <x-appbar>
+ <header>Which product?</header>
+ </x-appbar>
+
+ <section>
+ <p>
+ Here's a list of products you can leave feedback for:
+ </p>
+
+ <div class="content">
+ {% for prod in products %}
+ <p>
+ <a href="{{ url('feedback', product=prod.slug) }}">{{ prod.display_name }}</a>
+ </p>
+ {% endfor %}
+ </div>
+
+ <aside>
+ <div>
+ Note: This is a prototype page and thus is not localized so as
+ to reduce l10n work.
+ </div>
+ </aside>
+ </section>
+ </x-card>
+ </x-deck>
+{% endblock %}
@@ -1,25 +1,8 @@
-{% extends "base.html" %}
-
-{% block extra_headers %}
- <meta name="viewport" content="height=480, width=320, initial-scale=1, maximum-scale=1, minimum-scale=1">
-{% endblock %}
-
-{% block site_css %}
- {{ css('generic_feedback') }}
-{% endblock %}
-
-{% block site_js %}
- <script src="{{ settings.STATIC_URL }}js/lib/brick-1.0beta8.byob.min.js"></script>
- {{ js('generic_feedback') }}
-{% endblock %}
+{% extends "feedback/base.html" %}
{% block page_title %}{{ _('Submit Your Feedback') }}{% endblock %}
{% block body %}
-{#
- FIXME - This form tag causes it to not display. Need to move the
- form elsewhere.
-#}
<form id="responseform" action="" method="post">
<x-deck>
<x-card id="intro">
@@ -21,6 +21,29 @@ def test_sad_redirect(self):
self.assertRedirects(r, reverse('feedback') + '#sad')
+class TestCYOA(TestCase):
+ client_class = LocalizingClient
+
+ def test_cyoa(self):
+ # Test with no products
+ resp = self.client.get(reverse('cyoa'))
+
+ eq_(resp.status_code, 200)
+ self.assertTemplateUsed(resp, 'feedback/cyoa.html')
+
+ # Test with products
+ product(display_name=u'ProductFoo', slug=u'productfoo', save=True)
+ product(display_name=u'ProductBar', slug=u'productbar', save=True)
+
+ resp = self.client.get(reverse('cyoa'))
+
+ eq_(resp.status_code, 200)
+ self.assertContains(resp, 'ProductFoo')
+ self.assertContains(resp, 'productfoo')
+ self.assertContains(resp, 'ProductBar')
+ self.assertContains(resp, 'productbar')
+
+
class TestFeedback(TestCase):
client_class = LocalizingClient
View
@@ -14,8 +14,11 @@
r'/?$',
'feedback_router', name='feedback'),
- url(r'^thanks/$', 'thanks', name='thanks'),
- url(r'^downloadfirefox/$', 'download_firefox', name='download-firefox'),
+ url(r'^cyoa/?$', 'cyoa', name='cyoa'),
+ url(r'^chooseyourownadventure/?$', 'cyoa', name='cyoa_long'),
+
+ url(r'^thanks/?$', 'thanks', name='thanks'),
+ url(r'^downloadfirefox/?$', 'download_firefox', name='download-firefox'),
# These are redirects for backwards compatibility with old urls
# used for Firefox feedback
View
@@ -320,5 +320,14 @@ def feedback_router(request, product=None, version=None, channel=None,
*args, **kwargs)
+def cyoa(request):
+ template = 'feedback/cyoa.html'
+
+ products = models.Product.objects.all()
+ return render(request, template, {
+ 'products': products
+ })
+
+
class PostFeedbackAPI(generics.CreateAPIView):
serializer_class = models.ResponseSerializer

0 comments on commit 7c4e6dd

Please sign in to comment.