Skip to content
This repository has been archived by the owner on Jul 11, 2019. It is now read-only.

Commit

Permalink
Merge pull request #847 from xi/feature-category-link
Browse files Browse the repository at this point in the history
category links in sidebars
  • Loading branch information
Nicolas Dietrich committed Apr 7, 2014
2 parents 79a8e5f + 3ff3ad9 commit c80c60f
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 2 deletions.
3 changes: 3 additions & 0 deletions src/adhocracy/lib/helpers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))


Expand Down
9 changes: 9 additions & 0 deletions src/adhocracy/templates/components.html
Original file line number Diff line number Diff line change
Expand Up @@ -491,3 +491,12 @@
${tables}
</div>
</%def>


<%def name="category_link(category)">
%if c.instance is not None and c.instance.display_category_pages:
<a href="${h.entity_url(category)}">${category}</a>
%else:
${category}
%endif
</%def>
2 changes: 1 addition & 1 deletion src/adhocracy/templates/page/show.html
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ <h6>${_('Last Activity')}</h6>
<h6>${_('Category')}</h6>
<p>
%if c.page.category:
${c.page.category}
${components.category_link(c.page.category)}
%else:
${_("This page is not assigned to any category")}
%endif
Expand Down
2 changes: 1 addition & 1 deletion src/adhocracy/templates/proposal/show.html
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ <h6>${_('Last Activity')}</h6>
<h6>${_('Category')}</h6>
<p>
%if c.proposal.category:
${c.proposal.category}
${components.category_link(c.proposal.category)}
%else:
${_("This proposal is not assigned to any category")}
%endif
Expand Down

0 comments on commit c80c60f

Please sign in to comment.