Commits

heliostatic committed d629343

fixed the multiload issue

Comments (0)

Files changed (2)

app/assets/javascripts/links.js.coffee

 # All this logic will automatically be available in application.js.
 # You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/
 $ ->
-  if $('.thumbnails').length
+  if $('.more_link').length
     $(window).scroll ->
       url = $('.more_link').attr('href')
       if url && $(window).scrollTop() > $(document).height() - $(window).height() - 50
-        $('.more_link').text("Fetching more links...")
+        $('#loading').text("Fetching more links...")
         $.getScript(url)

app/views/links/index.js.coffee

 $("ul.thumbnails").append "<%= escape_javascript(render(:partial => 'link', :collection => @links)) %>"
-$(".more_link").replaceWith("<%= escape_javascript(
-    link_to_next_page @links, 'View more',
+$("#loading").replaceWith("<div id='loading'><%= escape_javascript(
+    link_to_next_page @links, 'Load more',
                         :remote => true,
-                        :class => 'btn more_link') %>");
+                        :class => 'btn more_link', 
+                        :'data-loading-text' => 'Loading...')
+                          %></div>");