From 7b40d33bd7e8604e0ffbddba7f283813029cdad4 Mon Sep 17 00:00:00 2001 From: Kasper Brandt Date: Tue, 14 Jun 2016 13:54:24 +0200 Subject: [PATCH] [#2185] Better scrolling in MyRSR and project page --- akvo/rsr/static/scripts-src/my-results.js | 8 +++++++- akvo/rsr/static/scripts-src/my-results.jsx | 8 +++++++- akvo/templates/myrsr/my_results.html | 2 +- akvo/templates/project_main.html | 2 +- 4 files changed, 16 insertions(+), 4 deletions(-) diff --git a/akvo/rsr/static/scripts-src/my-results.js b/akvo/rsr/static/scripts-src/my-results.js index e663e07797..d2a9d62667 100644 --- a/akvo/rsr/static/scripts-src/my-results.js +++ b/akvo/rsr/static/scripts-src/my-results.js @@ -2379,7 +2379,13 @@ function initReact() { // Wait 1s, then smoothly scroll to top window.setTimeout(function() { - smoothScroll.animateScroll('body'); + if (document.getElementById('projectMenu')) { + // Project page + smoothScroll.animateScroll('#projectMenu'); + } else if (document.getElementById('resultProjectTitle')) { + // MyRSR + smoothScroll.animateScroll('#resultProjectTitle'); + } }, 1000); } else { window.location.hash = ''; diff --git a/akvo/rsr/static/scripts-src/my-results.jsx b/akvo/rsr/static/scripts-src/my-results.jsx index 02a69f60cb..7c1bab75c1 100644 --- a/akvo/rsr/static/scripts-src/my-results.jsx +++ b/akvo/rsr/static/scripts-src/my-results.jsx @@ -2379,7 +2379,13 @@ function initReact() { // Wait 1s, then smoothly scroll to top window.setTimeout(function() { - smoothScroll.animateScroll('body'); + if (document.getElementById('projectMenu')) { + // Project page + smoothScroll.animateScroll('#projectMenu'); + } else if (document.getElementById('resultProjectTitle')) { + // MyRSR + smoothScroll.animateScroll('#resultProjectTitle'); + } }, 1000); } else { window.location.hash = ''; diff --git a/akvo/templates/myrsr/my_results.html b/akvo/templates/myrsr/my_results.html index c5c5dcf08b..1f18f2c69a 100644 --- a/akvo/templates/myrsr/my_results.html +++ b/akvo/templates/myrsr/my_results.html @@ -5,7 +5,7 @@ {% block title %}{% trans 'MyRSR - My Results' %}{% endblock title %} {% block myrsr_main %} -

+

{{ project.title }}

diff --git a/akvo/templates/project_main.html b/akvo/templates/project_main.html index 07e4176c09..80746ec26a 100644 --- a/akvo/templates/project_main.html +++ b/akvo/templates/project_main.html @@ -6,7 +6,7 @@
{% include "partials/project_header.html" %}
-
+