Commit e0e9c3fbfe4b6470e53baef2c5dbc8e043e0d13b

Authored by Jailson Dias
2 parents 9694bb41 5af8d200

Merge branch 'master' of https://github.com/amadeusproject/amadeuslms

Showing 2 changed files with 6 additions and 6 deletions   Show diff stats
app/templates/home.html
... ... @@ -5,23 +5,23 @@
5 5 {% block javascript %}
6 6 <script type="text/javascript">
7 7 var pageNum = {{ page_obj.number }}; // The latest page loaded
8   - var hasNextPage = {{ paginator.num_pages }}; // Indicates whether to expect another page after this one
  8 + var numberPages = {{ paginator.num_pages }}; // Indicates the number of pages
9 9 var baseUrl = '{% url "app:index" %}';
10 10  
11 11 // loadOnScroll handler
12 12 var loadOnScroll = function() {
13 13 // If the current scroll position is past out cutoff point...
14   - if ($(window).scrollTop() > $(document).height() - ($(window).height()*3)) {
  14 + if ($(window).scrollTop() >= $(document).height() - $(window).height() - 10) {
15 15 // temporarily unhook the scroll event watcher so we don't call a bunch of times in a row
16 16 $(window).unbind();
17   - // execute the load function below that will visit the JSON feed and stuff data into the HTML
  17 + // execute the load function below that will visit the view and return the content
18 18 loadItems();
19 19 }
20 20 };
21 21  
22 22 var loadItems = function() {
23   - // If the next page doesn't exist, just quit now
24   - if (pageNum == hasNextPage) {
  23 + // Check if page is equal to the number of pages
  24 + if (pageNum == numberPages) {
25 25 return false
26 26 }
27 27 // Update the page number
... ...
app/views.py
... ... @@ -16,7 +16,7 @@ class AppIndex(LoginRequiredMixin, LogMixin, ListView, NotificationMixin):
16 16  
17 17 template_name = "home.html"
18 18 context_object_name = 'courses'
19   - paginate_by = 3
  19 + paginate_by = 10
20 20  
21 21 not_action = "Acessar"
22 22 not_resource = "home"
... ...