Skip to content
This repository was archived by the owner on Jan 31, 2018. It is now read-only.

Commit 7c4e6dd

Browse files
committed
[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.
1 parent 57de006 commit 7c4e6dd

File tree

6 files changed

+87
-20
lines changed

6 files changed

+87
-20
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{% extends "base.html" %}
2+
3+
{% block extra_headers %}
4+
<meta name="viewport" content="height=480, width=320, initial-scale=1, maximum-scale=1, minimum-scale=1">
5+
{% endblock %}
6+
7+
{% block site_css %}
8+
{{ css('generic_feedback') }}
9+
{% endblock %}
10+
11+
{% block site_js %}
12+
<script src="{{ settings.STATIC_URL }}js/lib/brick-1.0beta8.byob.min.js"></script>
13+
{{ js('generic_feedback') }}
14+
{% endblock %}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
{% extends "feedback/base.html" %}
2+
{# Note: This is not l10n-ized since it's a prototype. #}
3+
4+
{% block page_title %}Which product?{% endblock %}
5+
6+
{% block body %}
7+
<x-deck>
8+
<x-card id="picker">
9+
<x-appbar>
10+
<header>Which product?</header>
11+
</x-appbar>
12+
13+
<section>
14+
<p>
15+
Here's a list of products you can leave feedback for:
16+
</p>
17+
18+
<div class="content">
19+
{% for prod in products %}
20+
<p>
21+
<a href="{{ url('feedback', product=prod.slug) }}">{{ prod.display_name }}</a>
22+
</p>
23+
{% endfor %}
24+
</div>
25+
26+
<aside>
27+
<div>
28+
Note: This is a prototype page and thus is not localized so as
29+
to reduce l10n work.
30+
</div>
31+
</aside>
32+
</section>
33+
</x-card>
34+
</x-deck>
35+
{% endblock %}

fjord/feedback/templates/feedback/generic_feedback.html

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,8 @@
1-
{% extends "base.html" %}
2-
3-
{% block extra_headers %}
4-
<meta name="viewport" content="height=480, width=320, initial-scale=1, maximum-scale=1, minimum-scale=1">
5-
{% endblock %}
6-
7-
{% block site_css %}
8-
{{ css('generic_feedback') }}
9-
{% endblock %}
10-
11-
{% block site_js %}
12-
<script src="{{ settings.STATIC_URL }}js/lib/brick-1.0beta8.byob.min.js"></script>
13-
{{ js('generic_feedback') }}
14-
{% endblock %}
1+
{% extends "feedback/base.html" %}
152

163
{% block page_title %}{{ _('Submit Your Feedback') }}{% endblock %}
174

185
{% block body %}
19-
{#
20-
FIXME - This form tag causes it to not display. Need to move the
21-
form elsewhere.
22-
#}
236
<form id="responseform" action="" method="post">
247
<x-deck>
258
<x-card id="intro">

fjord/feedback/tests/test_views.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,29 @@ def test_sad_redirect(self):
2121
self.assertRedirects(r, reverse('feedback') + '#sad')
2222

2323

24+
class TestCYOA(TestCase):
25+
client_class = LocalizingClient
26+
27+
def test_cyoa(self):
28+
# Test with no products
29+
resp = self.client.get(reverse('cyoa'))
30+
31+
eq_(resp.status_code, 200)
32+
self.assertTemplateUsed(resp, 'feedback/cyoa.html')
33+
34+
# Test with products
35+
product(display_name=u'ProductFoo', slug=u'productfoo', save=True)
36+
product(display_name=u'ProductBar', slug=u'productbar', save=True)
37+
38+
resp = self.client.get(reverse('cyoa'))
39+
40+
eq_(resp.status_code, 200)
41+
self.assertContains(resp, 'ProductFoo')
42+
self.assertContains(resp, 'productfoo')
43+
self.assertContains(resp, 'ProductBar')
44+
self.assertContains(resp, 'productbar')
45+
46+
2447
class TestFeedback(TestCase):
2548
client_class = LocalizingClient
2649

fjord/feedback/urls.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,11 @@
1414
r'/?$',
1515
'feedback_router', name='feedback'),
1616

17-
url(r'^thanks/$', 'thanks', name='thanks'),
18-
url(r'^downloadfirefox/$', 'download_firefox', name='download-firefox'),
17+
url(r'^cyoa/?$', 'cyoa', name='cyoa'),
18+
url(r'^chooseyourownadventure/?$', 'cyoa', name='cyoa_long'),
19+
20+
url(r'^thanks/?$', 'thanks', name='thanks'),
21+
url(r'^downloadfirefox/?$', 'download_firefox', name='download-firefox'),
1922

2023
# These are redirects for backwards compatibility with old urls
2124
# used for Firefox feedback

fjord/feedback/views.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -320,5 +320,14 @@ def feedback_router(request, product=None, version=None, channel=None,
320320
*args, **kwargs)
321321

322322

323+
def cyoa(request):
324+
template = 'feedback/cyoa.html'
325+
326+
products = models.Product.objects.all()
327+
return render(request, template, {
328+
'products': products
329+
})
330+
331+
323332
class PostFeedbackAPI(generics.CreateAPIView):
324333
serializer_class = models.ResponseSerializer

0 commit comments

Comments
 (0)