move select() functionality to Travis.Model and reuse it for accounts
This commit is contained in:
parent
7ccbba2959
commit
e7a26524d4
|
@ -43,7 +43,7 @@ GIT
|
|||
|
||||
GIT
|
||||
remote: git://github.com/travis-ci/travis-api.git
|
||||
revision: 2705e23bb60c1c1e140912c18f6f20ada8ad0139
|
||||
revision: dd2c469443014798a45b9308654e45ae4db7139f
|
||||
specs:
|
||||
travis-api (0.0.1)
|
||||
backports (~> 2.5)
|
||||
|
|
|
@ -5,7 +5,9 @@ Travis.ProfileController = Travis.Controller.extend
|
|||
|
||||
account: (->
|
||||
login = @get('params.login') || Travis.app.get('currentUser.login')
|
||||
@get('accounts').filter((account) -> account if account.get('login') == login)[0]
|
||||
account = @get('accounts').filter((account) -> account if account.get('login') == login)[0]
|
||||
account.select() if account
|
||||
account
|
||||
).property('accounts.length', 'params.login')
|
||||
|
||||
activate: (action, params) ->
|
||||
|
|
|
@ -10,4 +10,3 @@ require 'travis/model'
|
|||
urlGithub: (->
|
||||
"http://github.com/#{@get('login')}"
|
||||
).property()
|
||||
|
||||
|
|
|
@ -66,9 +66,6 @@ require 'travis/model'
|
|||
) && {}
|
||||
).property()
|
||||
|
||||
select: ->
|
||||
Travis.Repo.select(@get('id'))
|
||||
|
||||
updateTimes: ->
|
||||
@notifyPropertyChange 'lastBuildDuration'
|
||||
|
||||
|
@ -89,10 +86,6 @@ require 'travis/model'
|
|||
repo = $.select(@find().toArray(), (repo) -> repo.get('slug') == slug)
|
||||
if repo.length > 0 then repo else @find(slug: slug)
|
||||
|
||||
select: (id) ->
|
||||
@find().forEach (repo) ->
|
||||
repo.set('selected', repo.get('id') == id)
|
||||
|
||||
# buildURL: (slug) ->
|
||||
# if slug then slug else 'repos'
|
||||
|
||||
|
|
|
@ -14,5 +14,6 @@
|
|||
<span class="repos_label">Repositories:</span>
|
||||
<abbr class="repos">{{view.content.reposCount}}</abbr>
|
||||
</p>
|
||||
<div class="indicator"><span></span></div>
|
||||
{{/collection}}
|
||||
</div>
|
||||
|
|
|
@ -11,6 +11,9 @@
|
|||
@set(key, value) unless key is 'id'
|
||||
this
|
||||
|
||||
select: ->
|
||||
@constructor.select(@get('id'))
|
||||
|
||||
@Travis.Model.reopenClass
|
||||
find: ->
|
||||
if arguments.length == 0
|
||||
|
@ -24,6 +27,10 @@
|
|||
load: (attrs) ->
|
||||
Travis.app.store.load(this, attrs)
|
||||
|
||||
select: (id) ->
|
||||
@find().forEach (record) ->
|
||||
record.set('selected', record.get('id') == id)
|
||||
|
||||
buildURL: (suffix) ->
|
||||
base = @url || @pluralName()
|
||||
Ember.assert('Base URL (' + base + ') must not start with slash', !base || base.toString().charAt(0) != '/')
|
||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
|
@ -1 +1 @@
|
|||
f4d864ad
|
||||
6e2bd916
|
Loading…
Reference in New Issue
Block a user