diff --git a/src/adhocracy/lib/helpers/__init__.py b/src/adhocracy/lib/helpers/__init__.py index c37db4f3a..49bd8cf1b 100644 --- a/src/adhocracy/lib/helpers/__init__.py +++ b/src/adhocracy/lib/helpers/__init__.py @@ -254,6 +254,9 @@ def entity_url(entity, **kwargs): return treatment.url(entity, **kwargs) elif isinstance(entity, model.Message): return message.url(entity, **kwargs) + elif (isinstance(entity, model.CategoryBadge) and c.instance is not None + and c.instance.display_category_pages): + return category.url(entity, **kwargs) raise ValueError("No URL maker for: %s" % repr(entity)) diff --git a/src/adhocracy/templates/components.html b/src/adhocracy/templates/components.html index c6900800c..61983e7f3 100644 --- a/src/adhocracy/templates/components.html +++ b/src/adhocracy/templates/components.html @@ -491,3 +491,12 @@ ${tables} + + +<%def name="category_link(category)"> + %if c.instance is not None and c.instance.display_category_pages: + ${category} + %else: + ${category} + %endif + diff --git a/src/adhocracy/templates/page/show.html b/src/adhocracy/templates/page/show.html index dea71a69c..eac1d7042 100644 --- a/src/adhocracy/templates/page/show.html +++ b/src/adhocracy/templates/page/show.html @@ -66,7 +66,7 @@
${_('Last Activity')}
${_('Category')}

%if c.page.category: - ${c.page.category} + ${components.category_link(c.page.category)} %else: ${_("This page is not assigned to any category")} %endif diff --git a/src/adhocracy/templates/proposal/show.html b/src/adhocracy/templates/proposal/show.html index 92cd782b9..1e9705341 100644 --- a/src/adhocracy/templates/proposal/show.html +++ b/src/adhocracy/templates/proposal/show.html @@ -238,7 +238,7 @@

${_('Last Activity')}
${_('Category')}

%if c.proposal.category: - ${c.proposal.category} + ${components.category_link(c.proposal.category)} %else: ${_("This proposal is not assigned to any category")} %endif