зеркало из https://github.com/mozilla/kitsune.git
Merge pull request #6156 from akatsoulas/question-list-product
Display tags for all products in AAQ
This commit is contained in:
Коммит
91b6f07151
|
@ -45,7 +45,6 @@
|
|||
{{ topic_sidebar(topics[:10], subtopics, product, topic, subtopic) }}
|
||||
{% endif %}
|
||||
|
||||
|
||||
{{ aaq_widget(request, "topic", topic) }}
|
||||
|
||||
{% endblock %}
|
||||
|
|
|
@ -219,8 +219,8 @@
|
|||
{% if question.topic %}
|
||||
{% set topic = question.topic %}
|
||||
<li class="tag">
|
||||
<a class="tag-name" href="{{ url('questions.list', topic.product.slug)|urlparams(None, request.GET, topic=None) }}">
|
||||
{{ pgettext('DB: products.Product.title', topic.product.title) }}
|
||||
<a class="tag-name" href="{{ url('questions.list', question.product.slug)|urlparams(None, request.GET, topic=None) }}">
|
||||
{{ pgettext('DB: products.Product.title', question.product.title) }}
|
||||
</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
|
|
|
@ -17,13 +17,7 @@ from kitsune.questions.models import Answer, Question, QuestionLocale, VoteMetad
|
|||
from kitsune.questions.tests import AnswerFactory, QuestionFactory, tags_eq
|
||||
from kitsune.questions.views import NO_TAG, UNAPPROVED_TAG
|
||||
from kitsune.sumo.templatetags.jinja_helpers import urlparams
|
||||
from kitsune.sumo.tests import (
|
||||
TestCase,
|
||||
attrs_eq,
|
||||
emailmessage_raise_smtp,
|
||||
get,
|
||||
post,
|
||||
)
|
||||
from kitsune.sumo.tests import TestCase, attrs_eq, emailmessage_raise_smtp, get, post
|
||||
from kitsune.sumo.urlresolvers import reverse
|
||||
from kitsune.tags.tests import TagFactory
|
||||
from kitsune.tidings.models import Watch
|
||||
|
@ -1126,13 +1120,16 @@ class QuestionsTemplateTestCase(TestCase):
|
|||
|
||||
def test_topic_filter(self):
|
||||
p = ProductFactory()
|
||||
t1 = TopicFactory(product=p)
|
||||
t2 = TopicFactory(product=p)
|
||||
t3 = TopicFactory(product=p)
|
||||
t1 = TopicFactory()
|
||||
t2 = TopicFactory()
|
||||
t3 = TopicFactory()
|
||||
t1.products.add(p)
|
||||
t2.products.add(p)
|
||||
t3.products.add(p)
|
||||
|
||||
q1 = QuestionFactory()
|
||||
q2 = QuestionFactory(topic=t1)
|
||||
q3 = QuestionFactory(topic=t2)
|
||||
q1 = QuestionFactory(product=p)
|
||||
q2 = QuestionFactory(topic=t1, product=p)
|
||||
q3 = QuestionFactory(topic=t2, product=p)
|
||||
|
||||
url = reverse("questions.list", args=["all"])
|
||||
|
||||
|
@ -1206,8 +1203,9 @@ class QuestionsTemplateTestCase(TestCase):
|
|||
|
||||
def test_product_shows_without_tags(self):
|
||||
p = ProductFactory()
|
||||
t = TopicFactory(product=p)
|
||||
q = QuestionFactory(topic=t)
|
||||
t = TopicFactory()
|
||||
t.products.add(p)
|
||||
q = QuestionFactory(topic=t, product=p)
|
||||
|
||||
response = self.client.get(urlparams(reverse("questions.list", args=["all"]), show=""))
|
||||
doc = pq(response.content)
|
||||
|
|
|
@ -125,6 +125,12 @@ def question_list(request, product_slug=None, topic_slug=None):
|
|||
messages.add_message(request, messages.WARNING, "You cannot list questions at this time.")
|
||||
return HttpResponseRedirect("/")
|
||||
|
||||
topic_navigation = any(
|
||||
[
|
||||
request.resolver_match.url_name == "questions.list_by_topic",
|
||||
topic_slug and not product_slug,
|
||||
]
|
||||
)
|
||||
filter_ = request.GET.get("filter")
|
||||
owner = request.GET.get("owner", request.session.get("questions_owner", "all"))
|
||||
show = request.GET.get("show")
|
||||
|
@ -157,7 +163,6 @@ def question_list(request, product_slug=None, topic_slug=None):
|
|||
|
||||
# Get all topics
|
||||
topics = []
|
||||
topic_navigation = False
|
||||
if topic_slug:
|
||||
try:
|
||||
topic_history = TopicSlugHistory.objects.get(slug=topic_slug)
|
||||
|
@ -166,7 +171,6 @@ def question_list(request, product_slug=None, topic_slug=None):
|
|||
except TopicSlugHistory.DoesNotExist:
|
||||
...
|
||||
topics = Topic.active.filter(visible=True, slug=topic_slug)
|
||||
topic_navigation = True
|
||||
if not topics:
|
||||
raise Http404()
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче