Skip to content

Commit

Permalink
[#2185] Better scrolling in MyRSR and project page
Browse files Browse the repository at this point in the history
  • Loading branch information
KasperBrandt committed Jun 14, 2016
1 parent cbfc617 commit 7b40d33
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 4 deletions.
8 changes: 7 additions & 1 deletion akvo/rsr/static/scripts-src/my-results.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = '';
Expand Down
8 changes: 7 additions & 1 deletion akvo/rsr/static/scripts-src/my-results.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 = '';
Expand Down
2 changes: 1 addition & 1 deletion akvo/templates/myrsr/my_results.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
{% block title %}{% trans 'MyRSR - My Results' %}{% endblock title %}

{% block myrsr_main %}
<h4 class="resultProjectTitle">
<h4 class="resultProjectTitle" id="resultProjectTitle">
<a href="{% url 'project-main' project.pk %}">{{ project.title }}</a>
<a href="{% url 'project_editor' project.pk %}"><button class="btn btn-default btn-sm"><i class="fa fa-pencil-square-o"></i> {% trans 'Edit project' %}</button></a>
</h4>
Expand Down
2 changes: 1 addition & 1 deletion akvo/templates/project_main.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<div class="header-container">
{% include "partials/project_header.html" %}
</div>
<div class="projectMenu">
<div class="projectMenu" id="projectMenu">
<div class="container">
<div class="row">
<div class="col-md-12 ">
Expand Down

0 comments on commit 7b40d33

Please sign in to comment.