-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add dismiss button to survey report banner (#34160)
* feat: add dismiss button to survey report banner * refactor: move banner script to js file * fix: remove not in conditional
- Loading branch information
Showing
3 changed files
with
58 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
openedx/features/survey_report/static/survey_report/js/admin_banner.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
$(document).ready(function(){ | ||
$('#dismissButton').click(function() { | ||
$('#originalContent').slideUp('slow', function() { | ||
// If you want to do something after the slide-up, do it here. | ||
// For example, you can hide the entire div: | ||
// $(this).hide(); | ||
}); | ||
}); | ||
// When the form is submitted | ||
$("#survey_report_form").submit(function(event){ | ||
event.preventDefault(); // Prevent the form from submitting traditionally | ||
|
||
// Make the AJAX request | ||
$.ajax({ | ||
url: $(this).attr("action"), | ||
type: $(this).attr("method"), | ||
data: $(this).serialize(), | ||
success: function(response){ | ||
// Hide the original content block | ||
$("#originalContent").slideUp(400, function() { | ||
//$(this).css('display', 'none'); | ||
// Show the thank-you message block with slide down effect | ||
$("#thankYouMessage").slideDown(400, function() { | ||
// Wait for 3 seconds (3000 milliseconds) and then slide up the thank-you message | ||
setTimeout(function() { | ||
$("#thankYouMessage").slideUp(400); | ||
}, 3000); | ||
}); | ||
}); | ||
}, | ||
error: function(error){ | ||
// Handle any errors | ||
console.error("Error sending report:", error); | ||
} | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters