try using SortableMixin, but it's buggy

This commit is contained in:
Sven Fuchs 2012-07-06 13:34:44 +02:00
parent f8c4377e01
commit 267ad6c752
5 changed files with 29 additions and 23 deletions

View File

@ -2,10 +2,12 @@ require 'helpers'
require 'travis/ticker'
Travis.Controllers = Em.Namespace.create
RepositoriesController: Em.ArrayController.extend
RepositoriesController: Ember.ArrayController.extend
contentBinding: 'layout.repositories'
# sortProperties: ['sortOrder']
# sortAscending: false
RepositoryController: Em.Controller.extend # Travis.Urls.Repository,
RepositoryController: Em.Controller.extend
repositoryBinding: 'layout.repository'
TabsController: Em.Controller.extend
@ -18,11 +20,11 @@ Travis.Controllers = Em.Namespace.create
repositoryBinding: 'layout.repository'
contentBinding: 'layout.builds'
BuildController: Em.Controller.extend # Travis.Urls.Commit,
BuildController: Em.Controller.extend
repositoryBinding: 'layout.repository'
buildBinding: 'layout.build'
JobController: Em.Controller.extend # Travis.Urls.Commit,
JobController: Em.Controller.extend
repositoryBinding: 'layout.repository'
jobBinding: 'layout.job'

View File

@ -1,15 +1,15 @@
require 'travis/model'
@Travis.Repository = Travis.Model.extend
slug: DS.attr('string')
owner: DS.attr('string')
name: DS.attr('string')
description: DS.attr('string')
lastBuildId: DS.attr('number')
lastBuildNumber: DS.attr('string')
lastBuildResult: DS.attr('number')
lastBuildStarted_at: DS.attr('string')
lastBuildFinished_at: DS.attr('string')
slug: DS.attr('string')
owner: DS.attr('string')
name: DS.attr('string')
description: DS.attr('string')
lastBuildId: DS.attr('number')
lastBuildNumber: DS.attr('string')
lastBuildResult: DS.attr('number')
lastBuildStartedAt: DS.attr('string')
lastBuildFinishedAt: DS.attr('string')
lastBuild: DS.belongsTo('Travis.Build')
@ -27,6 +27,10 @@ require 'travis/model'
duration
).property('data.lastBuildDuration', 'lastBuildStartedAt', 'lastBuildFinishedAt')
sortOrder: (->
@get('lastBuildFinishedAt') || '9999'
).property('lastBuildFinishedAt')
stats: (->
# @get('_stats') || $.get("https://api.github.com/repos/#{@get('slug')}", (data) =>
# @set('_stats', data)

View File

@ -1,5 +1,5 @@
<ul id="repositories">
{{#each repository in controller.content}}
{{#each repository in controller}}
{{#view Travis.Views.RepositoriesItemView contextBinding="repository"}}
<li {{bindAttr class="view.classes"}}>
<a {{bindAttr href="view.urlRepository"}} class="current">{{slug}}</a>
@ -9,7 +9,7 @@
<span class="duration_label">{{t repositories.duration}}:</span>
<abbr class="duration" {{bindAttr title="lastBuildStartedAt"}}>{{formatDuration lastBuildDuration}}</abbr>,
<span class="finished_at_label">{{t repositories.finished_at}}:</span>
<abbr class="finished_at timeago" {{bindAttr title="lastBuildFinishedAt"}}>{{formatTime lastBuildFinished_at}}</abbr>
<abbr class="finished_at timeago" {{bindAttr title="lastBuildFinishedAt"}}>{{formatTime lastBuildFinishedAt}}</abbr>
</p>
{{#if description}}
<p class="description">{{description}}</p>

View File

@ -3,15 +3,15 @@ require 'ext/jquery'
responseTime = 0
repositories = [
{ id: 1, owner: 'travis-ci', name: 'travis-core', slug: 'travis-ci/travis-core', build_ids: [1, 2], last_build_id: 1, last_build_number: 1, last_build_result: 0, description: 'Description of travis-core' },
{ id: 2, owner: 'travis-ci', name: 'travis-assets', slug: 'travis-ci/travis-assets', build_ids: [3], last_build_id: 3, last_build_number: 3, last_build_result: 1, description: 'Description of travis-assets'},
{ id: 3, owner: 'travis-ci', name: 'travis-hub', slug: 'travis-ci/travis-hub', build_ids: [4], last_build_id: 4, last_build_number: 4, description: 'Description of travis-hub'},
{ id: 1, owner: 'travis-ci', name: 'travis-core', slug: 'travis-ci/travis-core', build_ids: [1, 2], last_build_id: 1, last_build_number: 1, last_build_result: 0, last_build_finished_at: '2012-07-02T00:00:00Z', description: 'Description of travis-core' },
{ id: 2, owner: 'travis-ci', name: 'travis-assets', slug: 'travis-ci/travis-assets', build_ids: [3], last_build_id: 3, last_build_number: 3, last_build_result: 1, last_build_finished_at: '2012-07-01T00:01:00Z', description: 'Description of travis-assets'},
{ id: 3, owner: 'travis-ci', name: 'travis-hub', slug: 'travis-ci/travis-hub', build_ids: [4], last_build_id: 4, last_build_number: 4, last_build_result: undefined, last_build_finished_at: undefined, description: 'Description of travis-hub'},
]
builds = [
{ id: 1, repository_id: '1', commit_id: 1, job_ids: [1, 2], number: 1, event_type: 'push', config: { rvm: ['rbx', '1.9.3'] }, finished_at: '2012-06-20T00:21:20Z', duration: 35, result: 0 },
{ id: 1, repository_id: '1', commit_id: 1, job_ids: [1, 2], number: 1, event_type: 'push', config: { rvm: ['rbx', '1.9.3'] }, finished_at: '2012-07-02T00:00:00Z', duration: 35, result: 0 },
{ id: 2, repository_id: '1', commit_id: 2, job_ids: [3], number: 2, event_type: 'push', config: { rvm: ['rbx'] } },
{ id: 3, repository_id: '2', commit_id: 3, job_ids: [4], number: 3, event_type: 'push', config: { rvm: ['rbx'] }, finished_at: '2012-06-20T00:21:20Z', duration: 35, result: 1 },
{ id: 3, repository_id: '2', commit_id: 3, job_ids: [4], number: 3, event_type: 'push', config: { rvm: ['rbx'] }, finished_at: '2012-07-01T00:01:00Z', duration: 35, result: 1 },
{ id: 4, repository_id: '3', commit_id: 4, job_ids: [5], number: 4, event_type: 'push', config: { rvm: ['rbx'] } },
]
@ -23,10 +23,10 @@ commits = [
]
jobs = [
{ id: 1, repository_id: 1, build_id: 1, commit_id: 1, log_id: 1, number: '1.1', config: { rvm: 'rbx' }, finished_at: '2012-06-20T00:21:20Z', duration: 35, result: 0 }
{ id: 1, repository_id: 1, build_id: 1, commit_id: 1, log_id: 1, number: '1.1', config: { rvm: 'rbx' }, finished_at: '2012-07-02T00:00:00Z', duration: 35, result: 0 }
{ id: 2, repository_id: 1, build_id: 1, commit_id: 1, log_id: 2, number: '1.2', config: { rvm: '1.9.3' }, allow_failure: true }
{ id: 3, repository_id: 1, build_id: 2, commit_id: 2, log_id: 3, number: '2.1', config: { rvm: 'rbx' } }
{ id: 4, repository_id: 2, build_id: 3, commit_id: 3, log_id: 4, number: '3.1', config: { rvm: 'rbx' }, finished_at: '2012-06-20T00:21:20Z', duration: 35, result: 1 }
{ id: 4, repository_id: 2, build_id: 3, commit_id: 3, log_id: 4, number: '3.1', config: { rvm: 'rbx' }, finished_at: '2012-07-01T00:01:00Z', duration: 35, result: 1 }
{ id: 5, repository_id: 3, build_id: 4, commit_id: 4, log_id: 5, number: '4.1', config: { rvm: 'rbx' } }
{ id: 6, repository_id: 1, build_id: 5, commit_id: 5, log_id: 5, number: '5.1', config: { rvm: 'rbx' }, state: 'created', queue: 'builds.common' }
{ id: 7, repository_id: 1, build_id: 5, commit_id: 5, log_id: 5, number: '5.2', config: { rvm: 'rbx' }, state: 'created', queue: 'builds.common' }

File diff suppressed because one or more lines are too long