Simplify build/job and tools templates
This commit is contained in:
parent
da9a34f06c
commit
92da0c8034
|
@ -1,8 +1,9 @@
|
|||
Travis.RepoController = Travis.Controller.extend
|
||||
bindings: []
|
||||
needs: ['repos', 'currentUser']
|
||||
needs: ['repos', 'currentUser', 'build']
|
||||
currentUserBinding: 'controllers.currentUser'
|
||||
|
||||
build: Ember.computed.alias('controllers.build.build')
|
||||
|
||||
slug: (-> @get('repo.slug') ).property('repo.slug')
|
||||
isLoading: (-> @get('repo.isLoading') ).property('repo.isLoading')
|
||||
|
||||
|
|
|
@ -20,26 +20,26 @@
|
|||
<dd class="duration" {{bindAttr title="startedAt"}}>{{formatDuration build.duration}}</dd>
|
||||
</div>
|
||||
|
||||
{{#with build.commit}}
|
||||
{{#with build}}
|
||||
<div class="right">
|
||||
<dt>{{t builds.commit}}</dt>
|
||||
<dd class="commit"><a {{bindAttr href="controller.urlGithubCommit"}}>{{formatCommit this}}</a></dd>
|
||||
{{#if ../build.pullRequest}}
|
||||
<dd class="commit"><a {{bindAttr href="controller.urlGithubCommit"}}>{{formatCommit commit}}</a></dd>
|
||||
{{#if pullRequest}}
|
||||
<dt>{{t builds.pull_request}}</dt>
|
||||
<dd class="pull_request"><a {{bindAttr href="compareUrl"}}>#{{build.pullRequestNumber}} {{build.pullRequestTitle}}</a></dd>
|
||||
<dd class="pull_request"><a {{bindAttr href="commit.compareUrl"}}>#{{pullRequestNumber}} {{pullRequestTitle}}</a></dd>
|
||||
{{else}}
|
||||
{{#if compareUrl}}
|
||||
{{#if commit.compareUrl}}
|
||||
<dt>{{t builds.compare}}</dt>
|
||||
<dd class="compare"><a {{bindAttr href="compareUrl"}}>{{pathFrom compareUrl}}</a></dd>
|
||||
<dd class="compare"><a {{bindAttr href="commit.compareUrl"}}>{{pathFrom commit.compareUrl}}</a></dd>
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
{{#if authorName}}
|
||||
{{#if commit.authorName}}
|
||||
<dt>{{t builds.author}}</dt>
|
||||
<dd class="author"><a {{bindAttr href="urlAuthor"}}>{{authorName}}</a></dd>
|
||||
<dd class="author"><a {{bindAttr href="controller.urlAuthor"}}>{{commit.authorName}}</a></dd>
|
||||
{{/if}}
|
||||
{{#if committerName}}
|
||||
{{#if commit.committerName}}
|
||||
<dt>{{t builds.committer}}</dt>
|
||||
<dd class="committer"><a {{bindAttr href="urlCommitter"}}>{{committerName}}</a></dd>
|
||||
<dd class="committer"><a {{bindAttr href="controller.urlCommitter"}}>{{commit.committerName}}</a></dd>
|
||||
{{/if}}
|
||||
</div>
|
||||
{{/with}}
|
||||
|
|
|
@ -19,26 +19,26 @@
|
|||
<dd class="duration" {{bindAttr title="startedAt"}}>{{formatDuration job.duration}}</dd>
|
||||
</div>
|
||||
|
||||
{{#with job.commit}}
|
||||
{{#with job}}
|
||||
<div class="right">
|
||||
<dt>{{t jobs.commit}}</dt>
|
||||
<dd class="commit"><a {{bindAttr href="controller.urlGithubCommit"}}>{{formatCommit this}}</a></dd>
|
||||
{{#if ../job.build.pullRequest}}
|
||||
<dd class="commit"><a {{bindAttr href="controller.urlGithubCommit"}}>{{formatCommit commit}}</a></dd>
|
||||
{{#if build.pullRequest}}
|
||||
<dt>{{t builds.pull_request}}</dt>
|
||||
<dd class="pull_request"><a {{bindAttr href="compareUrl"}}>#{{job.build.pullRequestNumber}} {{job.build.pullRequestTitle}}</a></dd>
|
||||
<dd class="pull_request"><a {{bindAttr href="commit.compareUrl"}}>#{{build.pullRequestNumber}} {{build.pullRequestTitle}}</a></dd>
|
||||
{{else}}
|
||||
{{#if compareUrl}}
|
||||
{{#if commit.compareUrl}}
|
||||
<dt>{{t jobs.compare}}</dt>
|
||||
<dd class="compare"><a {{bindAttr href="compareUrl"}}>{{pathFrom compareUrl}}</a></dd>
|
||||
<dd class="compare"><a {{bindAttr href="commit.compareUrl"}}>{{pathFrom commit.compareUrl}}</a></dd>
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
{{#if authorName}}
|
||||
{{#if commit.authorName}}
|
||||
<dt>{{t jobs.author}}</dt>
|
||||
<dd class="author"><a {{bindAttr href="controller.urlAuthor"}}>{{authorName}}</a></dd>
|
||||
<dd class="author"><a {{bindAttr href="controller.urlAuthor"}}>{{commit.authorName}}</a></dd>
|
||||
{{/if}}
|
||||
{{#if committerName}}
|
||||
{{#if commit.committerName}}
|
||||
<dt>{{t jobs.committer}}</dt>
|
||||
<dd class="committer"><a {{bindAttr href="controller.urlCommitter"}}>{{committerName}}</a></dd>
|
||||
<dd class="committer"><a {{bindAttr href="controller.urlCommitter"}}>{{commit.committerName}}</a></dd>
|
||||
{{/if}}
|
||||
</div>
|
||||
{{/with}}
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
<ul class="tabs">
|
||||
<li id="tab_current" {{bindAttr class="view.classCurrent"}}>
|
||||
<h5>
|
||||
{{#if slug}}
|
||||
{{#linkTo "repo" this currentWhen="repo.index"}}
|
||||
{{#if repo.slug}}
|
||||
{{#linkTo "repo" repo currentWhen="repo.index"}}
|
||||
{{t repositories.tabs.current}}
|
||||
{{/linkTo}}
|
||||
{{/if}}
|
||||
|
@ -10,8 +10,8 @@
|
|||
</li>
|
||||
<li id="tab_builds" {{bindAttr class="view.classBuilds"}}>
|
||||
<h5>
|
||||
{{#if slug}}
|
||||
{{#linkTo "builds" this}}
|
||||
{{#if repo.slug}}
|
||||
{{#linkTo "builds" repo}}
|
||||
{{t repositories.tabs.build_history}}
|
||||
{{/linkTo}}
|
||||
{{/if}}
|
||||
|
@ -19,8 +19,8 @@
|
|||
</li>
|
||||
<li id="tab_pull_requests" {{bindAttr class="view.classPullRequests"}}>
|
||||
<h5>
|
||||
{{#if slug}}
|
||||
{{#linkTo "pullRequests" this}}
|
||||
{{#if repo.slug}}
|
||||
{{#linkTo "pullRequests" repo}}
|
||||
{{t repositories.tabs.pull_requests}}
|
||||
{{/linkTo}}
|
||||
{{/if}}
|
||||
|
@ -28,8 +28,8 @@
|
|||
</li>
|
||||
<li id="tab_branches" {{bindAttr class="view.classBranches"}}>
|
||||
<h5>
|
||||
{{#if slug}}
|
||||
{{#linkTo "branches" this}}
|
||||
{{#if repo.slug}}
|
||||
{{#linkTo "branches" repo}}
|
||||
{{t repositories.tabs.branches}}
|
||||
{{/linkTo}}
|
||||
{{/if}}
|
||||
|
@ -37,10 +37,10 @@
|
|||
</li>
|
||||
<li id="tab_build" {{bindAttr class="view.classBuild"}}>
|
||||
<h5>
|
||||
{{#if view.build.id}}
|
||||
{{#if view.build.repo.slug}}
|
||||
{{#linkTo "build" view.build.repo view.build}}
|
||||
{{t repositories.tabs.build}} #{{view.build.number}}
|
||||
{{#if build.id}}
|
||||
{{#if repo.slug}}
|
||||
{{#linkTo "build" repo build}}
|
||||
{{t repositories.tabs.build}} #{{build.number}}
|
||||
{{/linkTo}}
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
|
@ -48,10 +48,10 @@
|
|||
</li>
|
||||
<li id="tab_job" {{bindAttr class="view.classJob"}}>
|
||||
<h5>
|
||||
{{#if view.job.id}}
|
||||
{{#if view.job.repo.slug}}
|
||||
{{#linkTo "job" view.job.repo view.job}}
|
||||
{{t repositories.tabs.job}} #{{view.job.number}}
|
||||
{{#if job.id}}
|
||||
{{#if repo.slug}}
|
||||
{{#linkTo "job" repo job}}
|
||||
{{t repositories.tabs.job}} #{{job.number}}
|
||||
{{/linkTo}}
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
|
|
|
@ -32,10 +32,8 @@ Travis.reopen
|
|||
RepoShowTabsView: Travis.View.extend
|
||||
templateName: 'repos/show/tabs'
|
||||
|
||||
repoBinding: 'controller.repo'
|
||||
buildBinding: 'controller.build'
|
||||
jobBinding: 'controller.job'
|
||||
tabBinding: 'controller.tab'
|
||||
contextBinding: 'controller'
|
||||
|
||||
# hrm. how to parametrize bindAttr?
|
||||
classCurrent: (->
|
||||
|
|
Loading…
Reference in New Issue
Block a user