From f49006dba5217fbebf384e06e5cb3f1d308b9d84 Mon Sep 17 00:00:00 2001 From: juliotoscano Date: Wed, 30 Nov 2016 12:01:04 -0300 Subject: [PATCH] modifying css cards #250 --- app/static/js/home.js | 42 ++++++++++++++++++++++++++++++++++++++++++ app/templates/home.html | 67 ++++++++++++------------------------------------------------------- core/static/css/base/amadeus.css | 20 ++++++++++---------- courses/static/js/topic.js | 2 +- courses/templates/course/course_card.html | 2 +- courses/templates/course/view.html | 42 ++++++++++++++++++++++++------------------ courses/templates/subject/form_view_student.html | 2 +- courses/templates/subject/form_view_teacher.html | 4 ++-- courses/templates/subject/index.html | 10 +++------- courses/templates/topic/index.html | 6 +++--- 10 files changed, 99 insertions(+), 98 deletions(-) create mode 100644 app/static/js/home.js diff --git a/app/static/js/home.js b/app/static/js/home.js new file mode 100644 index 0000000..750acf5 --- /dev/null +++ b/app/static/js/home.js @@ -0,0 +1,42 @@ +// loadOnScroll handler +var loadOnScroll = function() { + // If the current scroll position is past out cutoff point... + if ($(window).scrollTop() >= $(document).height() - $(window).height() - 10) { + // temporarily unhook the scroll event watcher so we don't call a bunch of times in a row + $(window).unbind(); + // execute the load function below that will visit the view and return the content + loadItems(); + } +}; + +var loadItems = function() { + // Check if page is equal to the number of pages + if (pageNum == numberPages) { + return false + } + // Update the page number + pageNum = pageNum + 1; + + $("#loading").show(); + // Configure the url we're about to hit + setTimeout(function (){ + $.ajax({ + url: baseUrl, + data: {'page': pageNum}, + success: function(data) { + $("#loading").hide(); + + $("#timeline").append(data); + }, + complete: function(data, textStatus){ + // Turn the scroll monitor back on + $(window).bind('scroll', loadOnScroll); + } + }); + }, 1000) +}; + +$(document).ready(function(){ + $(window).bind('scroll', loadOnScroll); + $.material.init(); +}); \ No newline at end of file diff --git a/app/templates/home.html b/app/templates/home.html index 1925ca1..4a03de7 100644 --- a/app/templates/home.html +++ b/app/templates/home.html @@ -5,59 +5,16 @@ {% block javascript %} {% if page_obj %} + {% endif %} {% endblock %} @@ -96,7 +53,7 @@ {% endblock %} {% if user|has_role:'system_admin' %} - +
  • {% trans 'Users' %}
  • {% trans 'Manage Users' %}
  • {% trans 'Create User' %}
  • - + -
  • +
  • {% trans 'Settings' %}