Commits

Andreas Stenius  committed e007a4b

Use keywords to tag modules.

  • Participants
  • Parent commits 229e1ad

Comments (0)

Files changed (7)

File dispatch/dispatch

 [
- {home, [], resource_page, [{template, "home.tpl"}, {id, page_home}]}
+ {home, [], resource_page, [{template, "home.tpl"}, {id, page_home}]},
+ {categories, ["categories"], resource_template, [{template, "categories.tpl"}]},
+ {keyword, ["category", id, slug], resource_page, [{template, "category.tpl"}, {cat, keyword}]}
 ].

File templates/_zmr_mod_card.tpl

+<div class="zmr_mod_card">
+  <h3><a href="{{ m.rsc[id].page_url }}">{{ m.rsc[id].title }}</a></h3>
+    {% include "_zmr_mod_category_links.tpl" %}
+  <p>
+    {{ m.rsc[id].summary }}
+  </p>
+</div>

File templates/_zmr_mod_category_links.tpl

+  <span class="zmr_categories">
+    {% for cat in m.rsc[id].subject %}
+      <span class="zmr_category"><a href="{{ m.rsc[cat].page_url }}">{{ m.rsc[cat].title }}</a></span>
+    {% endfor %}
+  </span>

File templates/categories.tpl

+{% extends "base.tpl" %}
+
+{% block content %}
+
+<h1>Module Categories</h1>
+
+<p>
+{% for col in m.search[{keyword_cloud cat='zmr_repository'}]|split_in:4 %}
+  <div class="zp-25">
+    <ul>
+      {% for id, count in col %}
+        <li>
+  	  <h3><a href="{{ m.rsc[id].page_url }}">{{ m.rsc[id].title }}</a> ({{ count }})</h3>
+	  {{ m.rsc[id].summary }}
+        </li>
+      {% endfor %}
+    </ul>
+  </div>
+{% endfor %}
+</p>
+
+{% endblock %}

File templates/category.tpl

+{% extends "base.tpl" %}
+
+{% block content %}
+
+<h1>Category: {{ m.rsc[id].title }}</h1>
+<p class="summary">
+  {{ m.rsc[id].summary }}
+</p>
+
+<p>
+    {{ m.rsc[id].body|show_media }}
+</p>
+
+<p>
+{% for col in m.search[{referrers id=id}]|split_in:4 %}
+  <div class="zp-25">
+    <ul>
+      {% for id, predicate in col %}
+        <li>
+	  {% include "_zmr_mod_card.tpl" id=id %}
+        </li>
+      {% endfor %}
+    </ul>
+  </div>
+{% endfor %}
+</p>
+
+
+{% endblock %}

File templates/home.tpl

     <ul>
         {% for id in col %}
         <li>
-            <h3><a href="{{ m.rsc[id].page_url }}">{{ m.rsc[id].title }}</a></h3>
-            {{ m.rsc[id].summary }}
+	  {% include "_zmr_mod_card.tpl" id=id %}
         </li>
         {% endfor %}
     </ul>

File templates/page.zmr_repository.tpl

     {{ m.rsc[id].summary }}
 </p>
 
-{{ m.rsc[id].body|show_media }}
+<p>
+    {{ m.rsc[id].body|show_media }}
+</p>
 
 <p>
+    <a href="{% url categories %}">Categories</a>: {% include "_zmr_mod_category_links.tpl" %}<br />
     SCM system: {{ m.rsc[id].zmr_repo_scm.title  }}<br />
     {% if m.rsc[id].author %}Author: {{ m.rsc[id].author.title }}<br />{% endif %}
     Project website: <a href="{{ m.rsc[id].website|default:m.rsc[id].zmr_repository_url }}">{{ m.rsc[id].website|default:m.rsc[id].zmr_repository_url }}</a>