Skip to content
Browse files

fixes bug in PaginatedCollectionView

properly detaches scrollEvent

Change-Id: I0fc4e79360bffaa9fede1f0fc9de482cb1937000
Reviewed-on: https://gerrit.instructure.com/18445
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jon Jensen <jon@instructure.com>
QA-Review: Ryan Florence <ryanf@instructure.com>
  • Loading branch information...
1 parent 34e2b20 commit 99ed04ae764fb1bf9aeab1068b506c3adca9cbb1 @ryanflorence ryanflorence committed Mar 8, 2013
View
12 app/coffeescripts/views/PaginatedCollectionView.coffee
@@ -35,7 +35,7 @@ define [
# Adds a loading indicator element
els: _.extend({}, CollectionView::els,
- '.loadingIndicator': '$loadingIndicator'
+ '.paginatedLoadingIndicator': '$loadingIndicator'
)
@optionProperty 'scrollContainer'
@@ -57,6 +57,7 @@ define [
attachCollection: ->
super
+ @collection.on 'reset', @attachScroll
@collection.on 'fetched:last', @detachScroll
@collection.on 'beforeFetch', @showLoadingIndicator
@collection.on 'fetch', @hideLoadingIndicator
@@ -79,9 +80,11 @@ define [
#
# @api private
- attachScroll: ->
- event = "scroll.pagination:#{@cid}, resize.pagination:#{@cid}"
- @scrollContainer.on event, @checkScroll
+ attachScroll: =>
+ scroll = "scroll.pagination:#{@cid}"
+ resize = "resize.pagination:#{@cid}"
+ @scrollContainer.on scroll, @checkScroll
+ @scrollContainer.on resize, @checkScroll
##
# Removes the scoll event from scrollContainer
@@ -113,7 +116,6 @@ define [
@detachScroll()
super
-
##
# Hides the loading indicator after render
#
View
13 app/stylesheets/utilities/_forms.scss
@@ -0,0 +1,13 @@
+input[type=text].loading {
+ background-image: url('/images/ajax-reload-animated.gif');
+ background-repeat: no-repeat;
+ background-position: 98% center;
+}
+
+.paginatedLoadingIndicator {
+ background-image: url('/images/ajax-reload-animated.gif');
+ background-repeat: no-repeat;
+ background-position: center center;
+ height: 20px;
+}
+
View
1 app/stylesheets/utilities/_main.scss
@@ -19,3 +19,4 @@
@import "show_hide_opacity";
@import "spacing";
@import "alignment";
+@import "forms";
View
2 app/views/jst/paginatedCollection.handlebars
@@ -6,5 +6,5 @@
</p>
{{/if}}
-<div class="loadingIndicator"></div>
+<div class="loadingIndicator">Loading</div>
View
2 app/views/jst/searchView.handlebars
@@ -1,4 +1,4 @@
-<input type="text" class="inputFilterView" />
+<input type="text" name="inputFilter" class="inputFilterView" />
<div class="collectionView"></div>

0 comments on commit 99ed04a

Please sign in to comment.
Something went wrong with that request. Please try again.