From bdb94d74619b8e3f28baa992941d3639a20be98e Mon Sep 17 00:00:00 2001 From: =?utf8?q?Je=CC=81re=CC=81my=20Fabre?= Date: Thu, 21 Jul 2016 11:38:34 +0200 Subject: [PATCH] Basicpage submenu stick in parent --- app/static/src/js/index.js | 2 ++ app/static/src/js/modules/sticky-kit-init.js | 31 ++++++++++++++++++++ app/templates/includes/footer_scripts.html | 1 + app/templates/pages/basicpage.html | 6 ---- app/templates/pages/menus/current_tree.html | 2 +- 5 files changed, 35 insertions(+), 7 deletions(-) create mode 100644 app/static/src/js/modules/sticky-kit-init.js diff --git a/app/static/src/js/index.js b/app/static/src/js/index.js index 059b6e8f..0998b802 100644 --- a/app/static/src/js/index.js +++ b/app/static/src/js/index.js @@ -8,6 +8,7 @@ var CloseButton = require('./modules/close-button'); var CloseEscape = require('./modules/close-escape'); var Search = require('./modules/search'); var OverflowInit = require('./modules/overflow-init'); +var StickyKitInit = require('./modules/sticky-kit-init'); // // Init all the modules @@ -19,3 +20,4 @@ window[CloseButton] = new CloseButton(); window[CloseEscape] = new CloseEscape(); window[Search] = new Search(); window[OverflowInit] = new OverflowInit(); +window[StickyKitInit] = new StickyKitInit(); diff --git a/app/static/src/js/modules/sticky-kit-init.js b/app/static/src/js/modules/sticky-kit-init.js new file mode 100644 index 00000000..ea6b3b09 --- /dev/null +++ b/app/static/src/js/modules/sticky-kit-init.js @@ -0,0 +1,31 @@ +var StickyKitInit = function() { + + // + // Init + // + this.init(); + +}; + +StickyKitInit.prototype.init = function() { + + var that = this, + options = {}, + data; + + $('[data-sticky]').each(function(i) { + + data = $(this).data(); + if(data.stickyOffset) { + options.offset_top = data.stickyOffset; + } + if(data.stickyParent) { + options.parent = '.' + data.stickyParent; + } + $(this).stick_in_parent(options); + + }); + +}; + +module.exports = StickyKitInit; diff --git a/app/templates/includes/footer_scripts.html b/app/templates/includes/footer_scripts.html index b7692426..8e714f50 100644 --- a/app/templates/includes/footer_scripts.html +++ b/app/templates/includes/footer_scripts.html @@ -3,6 +3,7 @@ {% compress js %} + {% block extra_js %}{% endblock %} {% editable_loader %} diff --git a/app/templates/pages/basicpage.html b/app/templates/pages/basicpage.html index 2940f958..d361c34f 100644 --- a/app/templates/pages/basicpage.html +++ b/app/templates/pages/basicpage.html @@ -46,10 +46,4 @@ - {{ page.basicpage.photo }}
- {{ page.basicpage.photo_credits }}
- {{ page.basicpage.photo_alignment }}
- {{ page.basicpage.photo_description }}
- {{ page.basicpage.photo_featured }}
- {{ page.basicpage.photo_featured_credits }}
{% endblock %} diff --git a/app/templates/pages/menus/current_tree.html b/app/templates/pages/menus/current_tree.html index 7eb088d2..b1437256 100644 --- a/app/templates/pages/menus/current_tree.html +++ b/app/templates/pages/menus/current_tree.html @@ -6,7 +6,7 @@ {% for page in page_branch %} {% if page.in_menu and page.has_children_in_menu %} {% if page.is_primary and page.is_current_or_ascendant %} -