Browse Source

Add tag template

Jordi Boggiano 13 years ago
parent
commit
4161c75618

+ 1 - 1
src/Packagist/WebBundle/Controller/WebController.php

@@ -117,7 +117,7 @@ class WebController extends Controller
     /**
      * View all packages with the specified tag.
      *
-     * @Template("PackagistWebBundle:Web:index.html.twig")
+     * @Template()
      * @Route("/tag/{name}", name="tag")
      */
     public function tagAction($name)

+ 1 - 1
src/Packagist/WebBundle/Resources/views/Web/index.html.twig

@@ -1,7 +1,7 @@
 {% extends "PackagistWebBundle::layout.html.twig" %}
 
 {% block content %}
-    <h1>Packages</h1>
+    {% block content_title %}<h1>Packages</h1>{% endblock %}
     {% for package in packages %}
         <section class="package">
             <h2><a href="{{ url('view', { 'name' : package.name }) }}">{{ package.name }}</a></h2>

+ 5 - 0
src/Packagist/WebBundle/Resources/views/Web/tag.html.twig

@@ -0,0 +1,5 @@
+{% extends "PackagistWebBundle:Web:index.html.twig" %}
+
+{% block content_title %}
+<h1>Packages tagged with {{ tag }}</h1>
+{% endblock %}

+ 1 - 1
src/Packagist/WebBundle/Resources/views/Web/view.html.twig

@@ -16,7 +16,7 @@
                 {% if version.homepage %}
                     Homepage: <a href="{{ version.homepage }}">{{ version.homepage|replace({'http://': ''}) }}</a><br />
                 {% endif %}
-                Tags: {% for tag in version.tags %}{{ tag.name }}{{ loop.last ? '' : ', ' }}{% endfor %}
+                Tags: {% for tag in version.tags %}<a href="{{ url("tag", { "name" : tag.name }) }}">{{ tag.name }}</a>{{ loop.last ? '' : ', ' }}{% endfor %}
             </p>
             <p class="authors">Author{{ version.authors|length > 1 ? 's' : '' }}:
             {% for author in version.authors %}