Cleanup BuildsView
This commit is contained in:
parent
345cb6e29e
commit
c205529295
|
@ -61,7 +61,7 @@
|
||||||
</table>
|
</table>
|
||||||
{{#if displayShowMoreButton}}
|
{{#if displayShowMoreButton}}
|
||||||
<p>
|
<p>
|
||||||
{{view view.ShowMoreButton}}
|
{{view 'show-more-button'}}
|
||||||
{{#if isLoading}}
|
{{#if isLoading}}
|
||||||
<span class="loading"></span>
|
<span class="loading"></span>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
|
@ -39,3 +39,4 @@ require 'views/top'
|
||||||
require 'views/status_images'
|
require 'views/status_images'
|
||||||
require 'views/status_image_input'
|
require 'views/status_image_input'
|
||||||
require 'views/dashboard'
|
require 'views/dashboard'
|
||||||
|
require 'views/show-more-button'
|
||||||
|
|
|
@ -1,24 +1,4 @@
|
||||||
Travis.reopen
|
Travis.reopen
|
||||||
BuildsView: Travis.View.extend
|
|
||||||
buildsBinding: 'controller.builds'
|
|
||||||
|
|
||||||
ShowMoreButton: Em.View.extend
|
|
||||||
tagName: 'button'
|
|
||||||
classNameBindings: ['isLoading', 'showMore']
|
|
||||||
showMore: true
|
|
||||||
attributeBindings: ['disabled']
|
|
||||||
isLoadingBinding: 'controller.isLoading'
|
|
||||||
template: Em.Handlebars.compile('{{view.label}}')
|
|
||||||
|
|
||||||
disabledBinding: 'isLoading'
|
|
||||||
|
|
||||||
label: (->
|
|
||||||
if @get('isLoading') then 'Loading' else 'Show more'
|
|
||||||
).property('isLoading')
|
|
||||||
|
|
||||||
click: ->
|
|
||||||
@get('controller').showMore()
|
|
||||||
|
|
||||||
BuildView: Travis.View.extend
|
BuildView: Travis.View.extend
|
||||||
classNameBindings: ['color', 'loading']
|
classNameBindings: ['color', 'loading']
|
||||||
buildBinding: 'controller.build'
|
buildBinding: 'controller.build'
|
||||||
|
|
18
assets/scripts/app/views/show-more-button.coffee
Normal file
18
assets/scripts/app/views/show-more-button.coffee
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
View = Ember.View.extend
|
||||||
|
tagName: 'button'
|
||||||
|
classNameBindings: ['isLoading', 'showMore']
|
||||||
|
showMore: true
|
||||||
|
attributeBindings: ['disabled']
|
||||||
|
isLoadingBinding: 'controller.isLoading'
|
||||||
|
template: Ember.Handlebars.compile('{{view.label}}')
|
||||||
|
|
||||||
|
disabledBinding: 'isLoading'
|
||||||
|
|
||||||
|
label: (->
|
||||||
|
if @get('isLoading') then 'Loading' else 'Show more'
|
||||||
|
).property('isLoading')
|
||||||
|
|
||||||
|
click: ->
|
||||||
|
@get('controller').showMore()
|
||||||
|
|
||||||
|
Travis.ShowMoreButtonView = View
|
Loading…
Reference in New Issue
Block a user