split up views
This commit is contained in:
parent
248e3ce16e
commit
1cce65842b
|
@ -23,4 +23,5 @@ Travis.Layout.instance = (name) ->
|
||||||
@layout = Travis.Layout[name].create(name: name)
|
@layout = Travis.Layout[name].create(name: name)
|
||||||
|
|
||||||
require 'layouts/default'
|
require 'layouts/default'
|
||||||
|
require 'layouts/profile'
|
||||||
|
|
||||||
|
|
|
@ -1,98 +1,9 @@
|
||||||
Travis.Views =
|
require 'ext/ember/namespace'
|
||||||
ApplicationView: Em.View.extend
|
|
||||||
templateName: 'application'
|
|
||||||
|
|
||||||
RepositoriesView: Em.View.extend
|
@Travis.Views = Em.Namespace.create()
|
||||||
templateName: 'repositories/list'
|
|
||||||
|
|
||||||
RepositoriesItemView: Em.View.extend
|
|
||||||
classes: (->
|
|
||||||
color = Travis.Helpers.colorForResult(@getPath('repository.lastBuildResult'))
|
|
||||||
classes = ['repository', color]
|
|
||||||
classes.push 'selected' if @getPath('repository.selected')
|
|
||||||
classes.join(' ')
|
|
||||||
).property('repository.lastBuildResult', 'repository.selected')
|
|
||||||
|
|
||||||
urlRepository: (->
|
|
||||||
Travis.Urls.repository(@get('context'))
|
|
||||||
).property('context')
|
|
||||||
|
|
||||||
urlLastBuild: (->
|
|
||||||
Travis.Urls.lastBuild(@get('context'))
|
|
||||||
).property('context')
|
|
||||||
|
|
||||||
RepositoryView: Em.View.extend
|
|
||||||
templateName: 'repositories/show'
|
|
||||||
|
|
||||||
TabsView: Em.View.extend
|
|
||||||
templateName: 'repositories/tabs'
|
|
||||||
|
|
||||||
urlRepository: (->
|
|
||||||
Travis.Urls.repository(@getPath('controller.repository'))
|
|
||||||
).property('controller.repository.id')
|
|
||||||
|
|
||||||
urlBuilds: (->
|
|
||||||
Travis.Urls.builds(@getPath('controller.repository'))
|
|
||||||
).property('controller.repository.id')
|
|
||||||
|
|
||||||
urlBuild: (->
|
|
||||||
Travis.Urls.build(@getPath('controller.repository'), @getPath('controller.build'))
|
|
||||||
).property('controller.repository.slug', 'controller.build.id')
|
|
||||||
|
|
||||||
urlJob: (->
|
|
||||||
Travis.Urls.job(@getPath('controller.repository'), @getPath('controller.job'))
|
|
||||||
).property('controller.repository.slug', 'controller.job.id')
|
|
||||||
|
|
||||||
HistoryView: Em.View.extend
|
|
||||||
templateName: 'builds/list'
|
|
||||||
|
|
||||||
BuildsItemView: Em.View.extend
|
|
||||||
classes: (->
|
|
||||||
Travis.Helpers.colorForResult(@getPath('context.result'))
|
|
||||||
).property('context.result')
|
|
||||||
|
|
||||||
urlBuild: (->
|
|
||||||
Travis.Urls.build(@getPath('context.repository'), @get('context'))
|
|
||||||
).property('context.repository.slug', 'context')
|
|
||||||
|
|
||||||
BuildView: Em.View.extend
|
|
||||||
templateName: 'builds/show'
|
|
||||||
|
|
||||||
classes: (->
|
|
||||||
Travis.Helpers.colorForResult(@get('result'))
|
|
||||||
).property('result')
|
|
||||||
|
|
||||||
requiredJobs: (->
|
|
||||||
@getPath('context.jobs').filter((job) -> job.get('allow_failure') != true)
|
|
||||||
).property() # TODO same here with binding to 'context.data.job_ids'
|
|
||||||
|
|
||||||
allowedFailureJobs: (->
|
|
||||||
@getPath('context.jobs').filter((job) -> job.get('allow_failure'))
|
|
||||||
).property()
|
|
||||||
|
|
||||||
urlBuild: (->
|
|
||||||
Travis.Urls.build(@getPath('context.repository'), @get('context'))
|
|
||||||
).property('controller.content.repository.id', 'controller.content.id')
|
|
||||||
|
|
||||||
JobsView: Em.View.extend
|
|
||||||
templateName: 'jobs/list'
|
|
||||||
|
|
||||||
JobsItemView: Em.View.extend
|
|
||||||
urlJob: (->
|
|
||||||
Travis.Urls.job(@getPath('context.repository'), @get('context'))
|
|
||||||
).property('context.repository', 'context')
|
|
||||||
|
|
||||||
JobView: Em.View.extend
|
|
||||||
templateName: 'jobs/show'
|
|
||||||
|
|
||||||
classes: (->
|
|
||||||
Travis.Helpers.colorForResult(@get('result'))
|
|
||||||
).property('result')
|
|
||||||
|
|
||||||
urlJob: (->
|
|
||||||
Travis.Urls.job(@getPath('context.repository'), @get('context'))
|
|
||||||
).property('controller.content.repository.id', 'controller.content.id')
|
|
||||||
|
|
||||||
LogView: Em.View.extend
|
|
||||||
templateName: 'jobs/log'
|
|
||||||
|
|
||||||
|
require 'views/app'
|
||||||
|
require 'views/build'
|
||||||
|
require 'views/job'
|
||||||
|
require 'views/repo'
|
||||||
|
require 'views/tabs'
|
||||||
|
|
3
assets/javascripts/app/views/app.coffee
Normal file
3
assets/javascripts/app/views/app.coffee
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
Travis.Views.reopen
|
||||||
|
ApplicationView: Em.View.extend
|
||||||
|
templateName: 'application'
|
33
assets/javascripts/app/views/build.coffee
Normal file
33
assets/javascripts/app/views/build.coffee
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
@Travis.Views.reopen
|
||||||
|
HistoryView: Em.View.extend
|
||||||
|
templateName: 'builds/list'
|
||||||
|
|
||||||
|
BuildsItemView: Em.View.extend
|
||||||
|
classes: (->
|
||||||
|
Travis.Helpers.colorForResult(@getPath('context.result'))
|
||||||
|
).property('context.result')
|
||||||
|
|
||||||
|
urlBuild: (->
|
||||||
|
Travis.Urls.build(@getPath('context.repository'), @get('context'))
|
||||||
|
).property('context.repository.slug', 'context')
|
||||||
|
|
||||||
|
BuildView: Em.View.extend
|
||||||
|
templateName: 'builds/show'
|
||||||
|
|
||||||
|
classes: (->
|
||||||
|
Travis.Helpers.colorForResult(@get('result'))
|
||||||
|
).property('result')
|
||||||
|
|
||||||
|
requiredJobs: (->
|
||||||
|
@getPath('context.jobs').filter((job) -> job.get('allow_failure') != true)
|
||||||
|
).property() # TODO same here with binding to 'context.data.job_ids'
|
||||||
|
|
||||||
|
allowedFailureJobs: (->
|
||||||
|
@getPath('context.jobs').filter((job) -> job.get('allow_failure'))
|
||||||
|
).property()
|
||||||
|
|
||||||
|
urlBuild: (->
|
||||||
|
Travis.Urls.build(@getPath('context.repository'), @get('context'))
|
||||||
|
).property('controller.content.repository.id', 'controller.content.id')
|
||||||
|
|
||||||
|
|
23
assets/javascripts/app/views/job.coffee
Normal file
23
assets/javascripts/app/views/job.coffee
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
@Travis.Views.reopen
|
||||||
|
JobsView: Em.View.extend
|
||||||
|
templateName: 'jobs/list'
|
||||||
|
|
||||||
|
JobsItemView: Em.View.extend
|
||||||
|
urlJob: (->
|
||||||
|
Travis.Urls.job(@getPath('context.repository'), @get('context'))
|
||||||
|
).property('context.repository', 'context')
|
||||||
|
|
||||||
|
JobView: Em.View.extend
|
||||||
|
templateName: 'jobs/show'
|
||||||
|
|
||||||
|
classes: (->
|
||||||
|
Travis.Helpers.colorForResult(@get('result'))
|
||||||
|
).property('result')
|
||||||
|
|
||||||
|
urlJob: (->
|
||||||
|
Travis.Urls.job(@getPath('context.repository'), @get('context'))
|
||||||
|
).property('controller.content.repository.id', 'controller.content.id')
|
||||||
|
|
||||||
|
LogView: Em.View.extend
|
||||||
|
templateName: 'jobs/log'
|
||||||
|
|
24
assets/javascripts/app/views/repo.coffee
Normal file
24
assets/javascripts/app/views/repo.coffee
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
@Travis.Views.reopen
|
||||||
|
RepositoriesView: Em.View.extend
|
||||||
|
templateName: 'repositories/list'
|
||||||
|
|
||||||
|
RepositoriesItemView: Em.View.extend
|
||||||
|
classes: (->
|
||||||
|
color = Travis.Helpers.colorForResult(@getPath('repository.lastBuildResult'))
|
||||||
|
classes = ['repository', color]
|
||||||
|
classes.push 'selected' if @getPath('repository.selected')
|
||||||
|
classes.join(' ')
|
||||||
|
).property('repository.lastBuildResult', 'repository.selected')
|
||||||
|
|
||||||
|
urlRepository: (->
|
||||||
|
Travis.Urls.repository(@get('context'))
|
||||||
|
).property('context')
|
||||||
|
|
||||||
|
urlLastBuild: (->
|
||||||
|
Travis.Urls.lastBuild(@get('context'))
|
||||||
|
).property('context')
|
||||||
|
|
||||||
|
RepositoryView: Em.View.extend
|
||||||
|
templateName: 'repositories/show'
|
||||||
|
|
||||||
|
|
21
assets/javascripts/app/views/tabs.coffee
Normal file
21
assets/javascripts/app/views/tabs.coffee
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
@Travis.Views.reopen
|
||||||
|
TabsView: Em.View.extend
|
||||||
|
templateName: 'repositories/tabs'
|
||||||
|
|
||||||
|
urlRepository: (->
|
||||||
|
Travis.Urls.repository(@getPath('controller.repository'))
|
||||||
|
).property('controller.repository.id')
|
||||||
|
|
||||||
|
urlBuilds: (->
|
||||||
|
Travis.Urls.builds(@getPath('controller.repository'))
|
||||||
|
).property('controller.repository.id')
|
||||||
|
|
||||||
|
urlBuild: (->
|
||||||
|
Travis.Urls.build(@getPath('controller.repository'), @getPath('controller.build'))
|
||||||
|
).property('controller.repository.slug', 'controller.build.id')
|
||||||
|
|
||||||
|
urlJob: (->
|
||||||
|
Travis.Urls.job(@getPath('controller.repository'), @getPath('controller.job'))
|
||||||
|
).property('controller.repository.slug', 'controller.job.id')
|
||||||
|
|
||||||
|
|
3
assets/javascripts/lib/ext/ember/namespace.js
Normal file
3
assets/javascripts/lib/ext/ember/namespace.js
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
Em.Namespace.reopen = Em.Namespace.reopenClass
|
||||||
|
|
||||||
|
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user