refactored breadcrumb management

This commit is contained in:
Fabien Potencier
2012-07-06 22:10:59 +02:00
parent 65e0bd402b
commit a7d17a749e
7 changed files with 19 additions and 31 deletions

View File

@@ -11,10 +11,7 @@
</div>
</div>
<ul class="breadcrumb">
<li><a href="{{ path('repository', {repo: repo}) }}">{{ repo }}</a> <span class="divider">/</span></li>
<li>Blame</li>
</ul>
{% include 'breadcrumb.twig' with {breadcrumbs: [{dir: 'Blame', path:''}]} %}
<div class="source-view">
<div class="source-header">

9
views/breadcrumb.twig Normal file
View File

@@ -0,0 +1,9 @@
<ul class="breadcrumb">
<li><a href="{{ path('repository', {repo: repo}) }}">{{ repo }}</a></li>
{% for breadcrumb in breadcrumbs %}
<span class="divider">/</span>
<li{% if loop.last %} class="active"{% endif %}>{% if not loop.last %}<a href="{{ path('tree_dir', {repo: repo, branch: branch, tree: breadcrumb.path}) }}">{{ breadcrumb.dir }}</a>{% endif %}{% if loop.last %}{{ breadcrumb.dir }}{% endif %}</li>
{% endfor %}
{% block extra %}{% endblock %}
</ul>

View File

@@ -11,10 +11,7 @@
</div>
</div>
<ul class="breadcrumb">
<li><a href="{{ path('repository', {repo: repo}) }}">{{ repo }}</a> <span class="divider">/</span></li>
<li>Commit {{ commit.getHash}} </li>
</ul>
{% include 'breadcrumb.twig' with {breadcrumbs: [{dir: "Commit #{commit.getHash}", path:''}]} %}
<div class="commit-view">
<div class="commit-header">

View File

@@ -12,10 +12,7 @@
</div>
</div>
<ul class="breadcrumb">
<li><a href="{{ path('repository', {repo: repo}) }}">{{ repo }}</a> <span class="divider">/</span></li>
<li>Commit history</li>
</ul>
{% include 'breadcrumb.twig' with {breadcrumbs: [{dir: 'Commit history', path:''}]} %}
{% for date, commit in commits %}
<table class="table table-striped table-bordered">

View File

@@ -12,13 +12,7 @@
</div>
</div>
<ul class="breadcrumb">
<li><a href="{{ path('repository', {repo: repo}) }}">{{ repo }}</a></li>
{% for breadcrumb in breadcrumbs %}
<span class="divider">/</span>
<li{% if loop.last %} class="active"{% endif %}>{% if not loop.last %}<a href="{{ path('tree_dir', {repo: repo, branch: branch, tree: breadcrumb.path}) }}">{{ breadcrumb.dir }}</a>{% endif %}{% if loop.last %}{{ breadcrumb.dir }}{% endif %}</li>
{% endfor %}
</ul>
{% include 'breadcrumb.twig' with {breadcrumbs: breadcrumbs} %}
<div class="source-view">
<div class="source-header">

View File

@@ -12,10 +12,7 @@
</div>
</div>
<ul class="breadcrumb">
<li><a href="{{ path('repository', {repo: repo}) }}">{{ repo }}</a> <span class="divider">/</span></li>
<li>Statistics</li>
</ul>
{% include 'breadcrumb.twig' with {breadcrumbs: [{dir: 'Statistics', path:''}]} %}
<table class="table table-striped table-bordered">
<thead>

View File

@@ -12,14 +12,11 @@
</div>
</div>
<ul class="breadcrumb">
<li><a href="{{ path('repository', {repo: repo}) }}">{{ repo }}</a></li>
{% for breadcrumb in breadcrumbs %}
<span class="divider">/</span>
<li{% if loop.last %} class="active"{% endif %}>{% if not loop.last %}<a href="{{ path('tree_dir', {repo: repo, branch: branch, tree: breadcrumb.path}) }}">{{ breadcrumb.dir }}</a>{% endif %}{% if loop.last %}{{ breadcrumb.dir }}{% endif %}</li>
{% endfor %}
{% embed 'breadcrumb.twig' with {breadcrumbs: breadcrumbs} %}
{% block extra %}
<a href="{{ path('rss', {repo: repo, branch: branch}) }}"><i class="rss pull-right"></i></a>
</ul>
{% endblock %}
{% endembed %}
<table class="tree">
<thead>