Commit db06efae by Victor Shnayder

Prevent scroll-to-top on clicks in cohorts views

Have to return false from event handlers to avoid href="#"
links from sending the user to the top of the page.
parent 01a38c29
...@@ -144,6 +144,7 @@ var CohortManager = (function ($) { ...@@ -144,6 +144,7 @@ var CohortManager = (function ($) {
$(".remove", tr).html('<a href="#">remove</a>') $(".remove", tr).html('<a href="#">remove</a>')
.click(function() { .click(function() {
remove_user_from_cohort(item.username, current_cohort_id, tr); remove_user_from_cohort(item.username, current_cohort_id, tr);
return false;
}); });
detail_users.append(tr); detail_users.append(tr);
...@@ -217,6 +218,7 @@ var CohortManager = (function ($) { ...@@ -217,6 +218,7 @@ var CohortManager = (function ($) {
show_cohorts_button.click(function() { show_cohorts_button.click(function() {
state = state_summary; state = state_summary;
render(); render();
return false;
}); });
add_cohort_input.change(function() { add_cohort_input.change(function() {
...@@ -231,12 +233,14 @@ var CohortManager = (function ($) { ...@@ -231,12 +233,14 @@ var CohortManager = (function ($) {
var add_url = url + '/add'; var add_url = url + '/add';
data = {'name': add_cohort_input.val()} data = {'name': add_cohort_input.val()}
$.post(add_url, data).done(added_cohort); $.post(add_url, data).done(added_cohort);
return false;
}); });
add_members_button.click(function() { add_members_button.click(function() {
var add_url = detail_url + '/add'; var add_url = detail_url + '/add';
data = {'users': users_area.val()} data = {'users': users_area.val()}
$.post(add_url, data).done(added_users); $.post(add_url, data).done(added_users);
return false;
}); });
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment