Slightly better implementation of showAll for jobs in queues
This commit is contained in:
parent
9c8f93f705
commit
d1633e796a
|
@ -20,7 +20,7 @@
|
|||
</ul>
|
||||
|
||||
{{#if queue.isMore}}
|
||||
<a {{action loadMoreJobs this.queue target="view"}} class="show-more-jobs">
|
||||
<a {{action showAll this.queue target="view"}} class="show-more-jobs">
|
||||
{{queue.leftLength}} more jobs - show all
|
||||
</a>
|
||||
{{/if}}
|
||||
|
|
|
@ -38,12 +38,9 @@
|
|||
templateName: 'queues/list'
|
||||
controller: Em.ArrayController.create()
|
||||
|
||||
loadMoreJobs: (event) ->
|
||||
showAll: (event) ->
|
||||
queue = event.context
|
||||
# nasty hack to not have to implement showAll for
|
||||
# limitedArray
|
||||
# TODO: implement it properly later
|
||||
queue.incrementProperty('limit', 1000000)
|
||||
queue.showAll()
|
||||
|
||||
didInsertElement: ->
|
||||
queues = for queue in Travis.QUEUES
|
||||
|
|
|
@ -6,9 +6,12 @@ Travis.LimitedArray = Em.ArrayProxy.extend
|
|||
@_super.apply this, arguments
|
||||
|
||||
arrangedContent: (->
|
||||
if content = @get('content')
|
||||
content = @get('content')
|
||||
if @get('disable')
|
||||
content
|
||||
else if content
|
||||
content.slice(0, @get('limit'))
|
||||
).property('content', 'limit')
|
||||
).property('content', 'limit', 'disable')
|
||||
|
||||
totalLength: (->
|
||||
@get('content.length')
|
||||
|
@ -27,9 +30,15 @@ Travis.LimitedArray = Em.ArrayProxy.extend
|
|||
@get('leftLength') > 0
|
||||
).property('leftLength')
|
||||
|
||||
showAll: ->
|
||||
@set 'limit', 1000000000
|
||||
@set 'disable', true
|
||||
|
||||
contentArrayDidChange: (array, index, removedCount, addedCount) ->
|
||||
@_super.apply this, arguments
|
||||
|
||||
return if @get('disable')
|
||||
|
||||
limit = @get 'limit'
|
||||
arrangedContent = @get('arrangedContent')
|
||||
length = arrangedContent.get 'length'
|
||||
|
|
Loading…
Reference in New Issue
Block a user