fix tabs tools
This commit is contained in:
parent
82117d5730
commit
1150a5f703
|
@ -4,12 +4,9 @@ Travis.StatsController = Travis.Controller.extend
|
|||
name: 'stats'
|
||||
|
||||
init: ->
|
||||
@_super('top', 'stats', 'hooks')
|
||||
|
||||
viewShow: (params) ->
|
||||
if @currentUser
|
||||
@connectStats()
|
||||
|
||||
connectStats: () ->
|
||||
@statsController.connectOutlet(outletName: 'main', name: 'stats')
|
||||
@_super('top')
|
||||
@connectTop()
|
||||
@connectOutlet(outletName: 'main', controller: this, viewClass: Travis.StatsView)
|
||||
|
||||
activate: (action, params) ->
|
||||
# noop
|
||||
|
|
|
@ -26,5 +26,8 @@
|
|||
githubAdmin: (slug) ->
|
||||
"http://github.com/#{slug}/admin/hooks#travis_minibucket"
|
||||
|
||||
statusImage: (slug, branch) ->
|
||||
"https://secure.travis-ci.org/#{slug}.png" + if branch then "?branch=#{branch}" else ''
|
||||
|
||||
email: (email) ->
|
||||
"mailto:#{email}"
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
require 'models/artifact'
|
||||
require 'models/branch'
|
||||
require 'models/build'
|
||||
require 'models/commit'
|
||||
require 'models/hook'
|
||||
|
|
|
@ -21,6 +21,10 @@ require 'travis/model'
|
|||
Travis.Build.byRepositoryId @get('id'), event_type: 'pull_request'
|
||||
).property()
|
||||
|
||||
branches: (->
|
||||
Travis.Branch.byRepositoryId @get('id')
|
||||
).property()
|
||||
|
||||
lastBuildDuration: (->
|
||||
duration = @getPath('data.last_build_duration')
|
||||
duration = Travis.Helpers.durationFrom(@get('lastBuildStartedAt'), @get('lastBuildFinishedAt')) unless duration
|
||||
|
|
|
@ -1,31 +0,0 @@
|
|||
<ul class="tabs">
|
||||
<li id="tab_current" {{bindAttr class="classCurrent"}}>
|
||||
<h5><a {{bindAttr href="urlRepository"}}>{{t repositories.tabs.current}}</a></h5>
|
||||
</li>
|
||||
<li id="tab_builds" {{bindAttr class="classBuilds"}}>
|
||||
<h5><a {{bindAttr href="urlBuilds"}}>{{t repositories.tabs.build_history}}</a></h5>
|
||||
</li>
|
||||
<li id="tab_pull_requests" {{bindAttr class="classPullRequests"}}>
|
||||
<h5><a {{bindAttr href="urlPullRequests"}}>{{t repositories.tabs.pull_requests}}</a></h5>
|
||||
</li>
|
||||
<li id="tab_branches" {{bindAttr class="classBranches"}}>
|
||||
<h5><a {{bindAttr href="urlBranches"}}>{{t repositories.tabs.branches}}</a></h5>
|
||||
</li>
|
||||
<li id="tab_build" {{bindAttr class="classBuild"}}>
|
||||
<h5><a {{bindAttr href="urlBuild"}}>{{t repositories.tabs.build}} #{{build.number}}</a></h5>
|
||||
</li>
|
||||
<li id="tab_job" {{bindAttr class="classJob"}}>
|
||||
<h5><a {{bindAttr href="urlJob"}}>{{t repositories.tabs.job}} #{{job.number}}</a></h5>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<div id="tools">
|
||||
<a href="#" {{action toggleTools}}></a>
|
||||
<div class="pane">
|
||||
<p><label>{{t repositories.branch}}:</label><select></select></p>
|
||||
<p><label>{{t repositories.image_url}}:</label><input type="text" class="url"></input></p>
|
||||
<p><label>{{t repositories.markdown}}:</label><input type="text" class="markdown"></input></p>
|
||||
<p><label>{{t repositories.textile}}:</label><input type="text" class="textile"></input></p>
|
||||
<p><label>{{t repositories.rdoc}}:</label><input type="text" class="rdoc"></input></p>
|
||||
</div>
|
||||
</div>
|
|
@ -13,7 +13,7 @@
|
|||
<li><a class="forks" title="Forks" {{bindAttr href="view.urlGithubNetwork"}}>{{stats.forks}}</a></li>
|
||||
</ul>
|
||||
|
||||
{{view templateName="repositories/_tabs" contextBinding="view"}}
|
||||
{{view Travis.TabsView}}
|
||||
</div>
|
||||
|
||||
<div class="tab">
|
||||
|
|
46
assets/javascripts/app/templates/repositories/tabs.hbs
Normal file
46
assets/javascripts/app/templates/repositories/tabs.hbs
Normal file
|
@ -0,0 +1,46 @@
|
|||
<ul class="tabs">
|
||||
<li id="tab_current" {{bindAttr class="view.classCurrent"}}>
|
||||
<h5><a {{bindAttr href="view.urlRepository"}}>{{t repositories.tabs.current}}</a></h5>
|
||||
</li>
|
||||
<li id="tab_builds" {{bindAttr class="view.classBuilds"}}>
|
||||
<h5><a {{bindAttr href="view.urlBuilds"}}>{{t repositories.tabs.build_history}}</a></h5>
|
||||
</li>
|
||||
<li id="tab_pull_requests" {{bindAttr class="view.classPullRequests"}}>
|
||||
<h5><a {{bindAttr href="view.urlPullRequests"}}>{{t repositories.tabs.pull_requests}}</a></h5>
|
||||
</li>
|
||||
<li id="tab_branches" {{bindAttr class="view.classBranches"}}>
|
||||
<h5><a {{bindAttr href="view.urlBranches"}}>{{t repositories.tabs.branches}}</a></h5>
|
||||
</li>
|
||||
<li id="tab_build" {{bindAttr class="view.classBuild"}}>
|
||||
<h5><a {{bindAttr href="view.urlBuild"}}>{{t repositories.tabs.build}} #{{view.build.number}}</a></h5>
|
||||
</li>
|
||||
<li id="tab_job" {{bindAttr class="view.classJob"}}>
|
||||
<h5><a {{bindAttr href="view.urlJob"}}>{{t repositories.tabs.job}} #{{view.job.number}}</a></h5>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<div id="tools">
|
||||
<a href="#" {{action toggleTools}}></a>
|
||||
<div class="pane">
|
||||
<p>
|
||||
<label>{{t repositories.branch}}:</label>
|
||||
{{view Ember.Select contentBinding="view.branches" selectionBinding="view.branch" optionLabelPath="content.commit.branch" optionValuePath="content.commit.branch"}}
|
||||
</p>
|
||||
<p>
|
||||
<label>{{t repositories.image_url}}:</label>
|
||||
<input type="text" class="url" {{bindAttr value="view.urlStatusImage"}}></input>
|
||||
</p>
|
||||
<p>
|
||||
<label>{{t repositories.markdown}}:</label>
|
||||
<input type="text" class="markdown" {{bindAttr value="view.markdownStatusImage"}}></input>
|
||||
</p>
|
||||
<p>
|
||||
<label>{{t repositories.textile}}:</label>
|
||||
<input type="text" class="textile" {{bindAttr value="view.textileStatusImage"}}></input>
|
||||
</p>
|
||||
<p>
|
||||
<label>{{t repositories.rdoc}}:</label>
|
||||
<input type="text" class="rdoc" {{bindAttr value="view.rdocStatusImage"}}></input>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
|
@ -28,6 +28,23 @@
|
|||
RepositoryView: Em.View.extend
|
||||
templateName: 'repositories/show'
|
||||
|
||||
repositoryBinding: 'controller.repository'
|
||||
|
||||
urlGithub: (->
|
||||
Travis.Urls.githubRepository(@getPath('repository.slug'))
|
||||
).property('repository.slug'),
|
||||
|
||||
urlGithubWatchers: (->
|
||||
Travis.Urls.githubWatchers(@getPath('repository.slug'))
|
||||
).property('repository.slug'),
|
||||
|
||||
urlGithubNetwork: (->
|
||||
Travis.Urls.githubNetwork(@getPath('repository.slug'))
|
||||
).property('repository.slug'),
|
||||
|
||||
TabsView: Em.View.extend
|
||||
templateName: 'repositories/tabs'
|
||||
|
||||
repositoryBinding: 'controller.repository'
|
||||
buildBinding: 'controller.build'
|
||||
jobBinding: 'controller.job'
|
||||
|
@ -73,15 +90,26 @@
|
|||
Travis.Urls.job(@getPath('repository.slug'), @getPath('job.id'))
|
||||
).property('repository.slug', 'job.id')
|
||||
|
||||
urlGithub: (->
|
||||
Travis.Urls.githubRepository(@getPath('repository.slug'))
|
||||
).property('repository.slug'),
|
||||
branches: (->
|
||||
@getPath('repository.branches')
|
||||
).property('repository.id')
|
||||
|
||||
urlStatusImage: (->
|
||||
Travis.Urls.statusImage(@getPath('repository.slug'), @getPath('branch.commit.branch'))
|
||||
).property('repository.slug', 'branch')
|
||||
|
||||
markdownStatusImage: (->
|
||||
"[})](#{@get('urlRepository')})"
|
||||
).property('urlStatusImage')
|
||||
|
||||
textileStatusImage: (->
|
||||
"!#{@get('urlStatusImage')}!:#{@get('urlRepository')}"
|
||||
).property('urlStatusImage')
|
||||
|
||||
rdocStatusImage: (->
|
||||
"{<img src=\"#{@get('urlStatusImage')}\" alt=\"Build Status\" />}[#{@get('urlRepository')}]"
|
||||
).property('urlStatusImage')
|
||||
|
||||
|
||||
urlGithubWatchers: (->
|
||||
Travis.Urls.githubWatchers(@getPath('repository.slug'))
|
||||
).property('repository.slug'),
|
||||
|
||||
urlGithubNetwork: (->
|
||||
Travis.Urls.githubNetwork(@getPath('repository.slug'))
|
||||
).property('repository.slug'),
|
||||
|
||||
|
|
|
@ -40,6 +40,12 @@ artifacts = [
|
|||
{ id: 5, body: 'log 4' }
|
||||
]
|
||||
|
||||
branches = [
|
||||
{ branches: [builds[0], builds[1]], commits: [commits[0], commits[1]] },
|
||||
{ branches: [builds[2]], commits: [commits[2]] },
|
||||
{ branches: [builds[3]], commits: [commits[3]] },
|
||||
]
|
||||
|
||||
workers = [
|
||||
{ id: 1, name: 'ruby-1', host: 'worker.travis-ci.org', state: 'ready' }
|
||||
{ id: 2, name: 'ruby-2', host: 'worker.travis-ci.org', state: 'ready' }
|
||||
|
@ -89,6 +95,13 @@ for job in jobs
|
|||
job: job,
|
||||
commit: commits[job.commit_id - 1]
|
||||
|
||||
for data in branches
|
||||
$.mockjax
|
||||
url: '/branches'
|
||||
data: { repository_id: data.branches[0].repository_id }
|
||||
responseTime: responseTime
|
||||
responseText: data
|
||||
|
||||
for artifact in artifacts
|
||||
$.mockjax
|
||||
url: '/artifacts/' + artifact.id
|
||||
|
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user