add isBuildTab and isJobTab helpers

This commit is contained in:
Sven Fuchs 2012-07-05 18:19:52 +02:00
parent a6119caf3e
commit 68b9b31d7f
3 changed files with 18 additions and 9 deletions

View File

@ -11,20 +11,20 @@
<li id="tab_branches" {{bindAttr class="view.classBranches"}}>
<h5><a {{bindAttr href="view.urlBranches"}}>{{t repositories.tabs.branches}}</a></h5>
</li>
{{#with controller.build}}
{{#if isLoaded}}
{{#if view.isBuildTab}}
{{#with controller.build}}
<li id="tab_build" {{bindAttr class="view.classBuild"}}>
<h5><a {{bindAttr href="view.urlBuild"}}>{{t repositories.tabs.build}} #{{number}}</a></h5>
</li>
{{/if}}
{{/with}}
{{#with controller.job}}
{{#if isLoaded}}
{{/with}}
{{/if}}
{{#if view.isJobTab}}
{{#with controller.job}}
<li id="tab_job" {{bindAttr class="view.classJob"}}>
<h5><a {{bindAttr href="view.urlJob"}}>{{t repositories.tabs.job}} #{{number}}</a></h5>
</li>
{{/if}}
{{/with}}
{{/with}}
{{/if}}
</ul>
<div id="tools">

View File

@ -5,6 +5,15 @@
toggleTools: ->
$('#tools .pane').toggle()
isBuildTab: (->
tab = @getPath('controller.tab')
(tab == 'build' || tab == 'job') && @getPath('controller.build.isLoaded')
).property('controller.tab', 'controller.build.isLoaded')
isJobTab: (->
@getPath('controller.tab') == 'job' && @getPath('controller.job.isLoaded')
).property('controller.tab', 'controller.job.isLoaded')
# hrm. how to parametrize bindAttr?
classCurrent: (->
'active' if @getPath('controller.tab') == 'current'

File diff suppressed because one or more lines are too long