Skip to content

Commit

Permalink
Prevent scroll up when refreshing the page because of optionset.refresh
Browse files Browse the repository at this point in the history
  • Loading branch information
jochenklar committed Dec 15, 2023
1 parent 263fa92 commit ea2a119
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ angular.module('project_questions')
});
};

service.initView = function(page_id) {
service.initView = function(page_id, scrollUp) {
if (initializing) return;

if (page_id !== null) {
Expand Down Expand Up @@ -187,7 +187,9 @@ angular.module('project_questions')
// disable initializing flag again, set browser location, scroll to top and set back flag
initializing = false;
$location.path('/' + service.page.id + '/');
$window.scrollTo(0, 0);
if (angular.isUndefined(scrollUp) || scrollUp === true) {
$window.scrollTo(0, 0);
}
back = false;

$timeout(function() {
Expand Down Expand Up @@ -967,6 +969,7 @@ angular.module('project_questions')
});
}


// check if we need to refresh the site
if (angular.isUndefined(jump) || !jump) {
angular.forEach([service.page].concat(service.questionsets), function(questionset) {
Expand All @@ -975,7 +978,7 @@ angular.module('project_questions')
var question = element;
angular.forEach(question.optionsets, function(optionset) {
if (optionset.has_refresh) {
return service.initView(service.page.id);
return service.initView(service.page.id, false);
}
});
}
Expand Down

0 comments on commit ea2a119

Please sign in to comment.