Commit 640b5d31 by Diana Huang

Merge pull request #10699 from doganov/TNL-3644

Fixes TNL-3664 by collapsing actions dropdown after an action item is clicked.
parents fb9f8184 771aaa6c
......@@ -79,8 +79,8 @@
return properties;
}
function toggleCourseActionsDropdown(event) {
var dashboard_index = $(this).data('dashboard-index');
function toggleCourseActionsDropdownInternal(element) {
var dashboard_index = element.data('dashboard-index');
// Toggle the visibility control for the selected element and set the focus
var dropdown_selector = 'div#actions-dropdown-' + dashboard_index;
......@@ -97,6 +97,10 @@
var anchor = $(anchor_selector);
var aria_expanded_state = (anchor.attr('aria-expanded') === 'true');
anchor.attr('aria-expanded', !aria_expanded_state);
}
function toggleCourseActionsDropdown(event) {
toggleCourseActionsDropdownInternal($(this));
// Suppress the actual click event from the browser
event.preventDefault();
......@@ -118,11 +122,13 @@
});
$(".action-email-settings").click(function(event) {
$("#email_settings_course_id").val( $(event.target).data("course-id") );
$("#email_settings_course_number").text( $(event.target).data("course-number") );
var element = $(event.target);
$("#email_settings_course_id").val( element.data("course-id") );
$("#email_settings_course_number").text( element.data("course-number") );
if($(event.target).data("optout") === "False") {
$("#receive_emails").prop('checked', true);
}
toggleCourseActionsDropdownInternal(element);
});
$(".action-unenroll").click(function(event) {
......@@ -138,6 +144,7 @@
}, true));
$('#refund-info').html( element.data("refund-info") );
$("#unenroll_course_id").val( element.data("course-id") );
toggleCourseActionsDropdownInternal(element);
});
$('#unenroll_form').on('ajax:complete', function(event, xhr) {
......
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