diff --git a/lms/templates/admin/base_site.html b/lms/templates/admin/base_site.html index 2dfd0bef7a50..cd8ab70e4f4b 100644 --- a/lms/templates/admin/base_site.html +++ b/lms/templates/admin/base_site.html @@ -1,5 +1,5 @@ {% extends "admin/base.html" %} -{% load i18n admin_urls %} +{% load i18n admin_urls static %} {% block title %}{{ title }} | {{ site_title|default:_('Django site admin') }}{% endblock %} {% block branding %}

{{ site_header|default:_('Django administration') }}

@@ -21,6 +21,10 @@

{{ site_header|default:_('D {% endblock %} +{% block extrahead %} + +{% endblock %} + {% block messages %}{{ block.super }} {% include "survey_report/admin_banner.html" %} {% endblock %} diff --git a/openedx/features/survey_report/static/survey_report/js/admin_banner.js b/openedx/features/survey_report/static/survey_report/js/admin_banner.js new file mode 100644 index 000000000000..d8650321ba36 --- /dev/null +++ b/openedx/features/survey_report/static/survey_report/js/admin_banner.js @@ -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); + } + }); + }); +}); diff --git a/openedx/features/survey_report/templates/survey_report/admin_banner.html b/openedx/features/survey_report/templates/survey_report/admin_banner.html index 0e8034380e35..fa0b37ecf751 100644 --- a/openedx/features/survey_report/templates/survey_report/admin_banner.html +++ b/openedx/features/survey_report/templates/survey_report/admin_banner.html @@ -1,4 +1,5 @@ {% block survey_report_banner %} +{% load static %} {% if show_survey_report_banner %}
@@ -11,11 +12,25 @@

Join the Open edX Data Sh

If you agree and want to send a report you can click the button below. You can always send reports and see the status of reports you have sent in the past at admin/survey_report/surveyreport/ .

-
+ + {% csrf_token %}
+ {% endif %} + + + {% endblock %}