Make sure that repo has a slug when creating a link to repo

Raw repo data is sometimes passed to linkTo helpers and in such case
Repo instance is created by id and it does not include slug. This commit
will be reverted after fixing "incomplete" implementation, which will
allow to preload Repo with both id and slug before searching for it.
This commit is contained in:
Piotr Sarnacki 2013-02-19 22:02:46 +01:00
parent 86670def14
commit 42ed7cf4de
3 changed files with 10 additions and 4 deletions

View File

@ -24,7 +24,7 @@
<td class="number">
<span class="status"></span>
{{#if job.id}}
{{#if job.repo}}
{{#if job.repo.slug}}
{{#linkTo "job" repo job}}{{number}}{{/linkTo}}
{{/if}}
{{/if}}

View File

@ -6,7 +6,9 @@
<dd class="number">
<span class="status"></span>
{{#if job.id}}
{{#linkTo job repo job}}{{job.number}}{{/linkTo}}
{{#if job.repo.slug}}
{{#linkTo job repo job}}{{job.number}}{{/linkTo}}
{{/if}}
{{/if}}
</dd>
<dt>{{t jobs.state}}</dt>

View File

@ -9,10 +9,14 @@
{{#with view.repo}}
<div class="slug-and-status">
<span class="status"></span>
{{#linkTo repo this class="slug"}}{{slug}}{{/linkTo}}
{{#if slug}}
{{#linkTo repo this class="slug"}}{{slug}}{{/linkTo}}
{{/if}}
</div>
{{#with lastBuildHash}}
{{#linkTo build repo id class="last_build"}}{{number}}{{/linkTo}}
{{#if repo.slug}}
{{#linkTo build repo id class="last_build"}}{{number}}{{/linkTo}}
{{/if}}
{{/with}}
<p class="summary">