Fix show more button by changing it into component
This commit is contained in:
parent
7e59794571
commit
8c35e42b2b
|
@ -1,21 +1,19 @@
|
||||||
`import Ember from 'ember'`
|
`import Ember from 'ember'`
|
||||||
|
|
||||||
View = Ember.View.extend
|
ShowMoreButtonComponent = Ember.Component.extend
|
||||||
tagName: 'button'
|
tagName: 'button'
|
||||||
classNames: ['button button--grey button--showmore']
|
classNames: ['button button--grey button--showmore']
|
||||||
classNameBindings: ['isLoading', 'showMore']
|
classNameBindings: ['isLoading', 'showMore']
|
||||||
showMore: true
|
showMore: true
|
||||||
attributeBindings: ['disabled']
|
attributeBindings: ['disabled']
|
||||||
isLoadingBinding: 'controller.isLoading'
|
|
||||||
templateName: 'show-more-button'
|
|
||||||
|
|
||||||
disabledBinding: 'isLoading'
|
disabledBinding: 'isLoading'
|
||||||
|
|
||||||
label: (->
|
buttonLabel: (->
|
||||||
if @get('isLoading') then 'Loading' else 'Show more'
|
if @get('isLoading') then 'Loading' else 'Show more'
|
||||||
).property('isLoading')
|
).property('isLoading')
|
||||||
|
|
||||||
click: ->
|
click: ->
|
||||||
@get('controller').showMore()
|
this.attrs.showMore()
|
||||||
|
|
||||||
`export default View`
|
`export default ShowMoreButtonComponent`
|
|
@ -28,4 +28,8 @@ Controller = Ember.ArrayController.extend
|
||||||
|
|
||||||
@store.find('build', options)
|
@store.find('build', options)
|
||||||
|
|
||||||
|
actions:
|
||||||
|
showMoreBuilds: ->
|
||||||
|
@showMore()
|
||||||
|
|
||||||
`export default Controller`
|
`export default Controller`
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
{{/each}}
|
{{/each}}
|
||||||
{{#if displayShowMoreButton}}
|
{{#if displayShowMoreButton}}
|
||||||
<p>
|
<p>
|
||||||
{{view 'show-more-button'}}
|
{{show-more-button isLoading=isLoading showMore=(action 'showMoreBuilds')}}
|
||||||
{{#if isLoading}}
|
{{#if isLoading}}
|
||||||
{{loading-indicator}}
|
{{loading-indicator}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
1
app/templates/components/show-more-button.hbs
Normal file
1
app/templates/components/show-more-button.hbs
Normal file
|
@ -0,0 +1 @@
|
||||||
|
<span class="icon icon--eye"></span>{{buttonLabel}}
|
|
@ -1 +0,0 @@
|
||||||
<span class="icon icon--eye"></span>{{view.label}}
|
|
Loading…
Reference in New Issue
Block a user