David Chambers avatar David Chambers committed 028f872

Added a template filter, `combine`, to enable the category template to include
required files.

Comments (0)

Files changed (2)

templates/category.dhtml

 {% extends "base.dhtml" %}
 {% load mango_extras %}
 {% block title %}{{ category.name|smart_capfirst }}{% endblock %}
+{% block stylesheets %}{{ block.super }}{% for href in category.pages|combine:category.posts|required:"stylesheets" %}
+    <link rel="stylesheet" href="{{ href }}" />{% endfor %}{% endblock %}
 {% block content %}
             <h1>{{ category.name|smart_capfirst }}</h1>
             {% if category.pages %}
             </ol>{% endif %}{% if not category.pages and not category.posts and not category.subcategories %}
             <p>This category is currently empty.</p>{% endif %}
 {% endblock %}
+{% block scripts %}{{ block.super }}{% for src in category.pages|combine:category.posts|required:"scripts" %}
+    <script src="{{ src }}" />{% endfor %}{% endblock %}

templatetags/mango_extras.py

     else:
         return comment.author.url
 
+@register.filter
+def combine(list1, list2):
+    return list1 + list2
+
 @stringfilter
 def _convert(text):
     md.reset()
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.