diff --git a/assets/scripts/app/templates/builds.hbs b/assets/scripts/app/templates/builds.hbs index 262ce55b..bac8dfb5 100644 --- a/assets/scripts/app/templates/builds.hbs +++ b/assets/scripts/app/templates/builds.hbs @@ -61,7 +61,7 @@ {{#if displayShowMoreButton}}

- {{view view.ShowMoreButton}} + {{view 'show-more-button'}} {{#if isLoading}} {{/if}} diff --git a/assets/scripts/app/views.coffee b/assets/scripts/app/views.coffee index 8060353c..85eb00eb 100644 --- a/assets/scripts/app/views.coffee +++ b/assets/scripts/app/views.coffee @@ -39,3 +39,4 @@ require 'views/top' require 'views/status_images' require 'views/status_image_input' require 'views/dashboard' +require 'views/show-more-button' diff --git a/assets/scripts/app/views/build.coffee b/assets/scripts/app/views/build.coffee index 2d2aae90..ae7c9fdf 100644 --- a/assets/scripts/app/views/build.coffee +++ b/assets/scripts/app/views/build.coffee @@ -1,24 +1,4 @@ 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 classNameBindings: ['color', 'loading'] buildBinding: 'controller.build' diff --git a/assets/scripts/app/views/show-more-button.coffee b/assets/scripts/app/views/show-more-button.coffee new file mode 100644 index 00000000..d0ee0788 --- /dev/null +++ b/assets/scripts/app/views/show-more-button.coffee @@ -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