diff --git a/readthedocs/core/context_processors.py b/readthedocs/core/context_processors.py index 23bfb07a51e..127219c2cfb 100644 --- a/readthedocs/core/context_processors.py +++ b/readthedocs/core/context_processors.py @@ -25,6 +25,7 @@ def readthedocs_processor(request): "USE_ORGANIZATIONS": settings.RTD_ALLOW_ORGANIZATIONS, "SUPPORT_EMAIL": settings.SUPPORT_EMAIL, "PUBLIC_API_URL": settings.PUBLIC_API_URL, + "RTD_EXT_THEME_ENABLED": settings.RTD_EXT_THEME_ENABLED, } return exports diff --git a/readthedocs/core/notifications.py b/readthedocs/core/notifications.py index b94756b2488..8fbf2c8c155 100644 --- a/readthedocs/core/notifications.py +++ b/readthedocs/core/notifications.py @@ -4,10 +4,11 @@ from django.utils.translation import gettext_lazy as _ -from readthedocs.notifications.constants import WARNING +from readthedocs.notifications.constants import INFO, WARNING from readthedocs.notifications.messages import Message, registry MESSAGE_EMAIL_VALIDATION_PENDING = "core:email:validation-pending" +MESSAGE_BETA_DASHBOARD_AVAILABLE = "core:dashboard:beta-available" messages = [ Message( id=MESSAGE_EMAIL_VALIDATION_PENDING, @@ -22,6 +23,25 @@ ), type=WARNING, ), + Message( + id=MESSAGE_BETA_DASHBOARD_AVAILABLE, + header=_("New beta dashboard"), + body=_( + textwrap.dedent( + """ + {% if RTD_EXT_THEME_ENABLED %} + This dashboard is currently in beta, + you can return to the legacy dashboard if you encounter any problems. + Feel free to report any feedback you may have. + {% else %} + Our new beta dashboard is now available for testing. + Give it a try and send us feedback. + {% endif %} + """ + ).strip(), + ), + type=INFO, + ), ] diff --git a/readthedocs/core/static-src/core/js/site.js b/readthedocs/core/static-src/core/js/site.js index 01bb8dd4d4b..1d932d0f6f8 100644 --- a/readthedocs/core/static-src/core/js/site.js +++ b/readthedocs/core/static-src/core/js/site.js @@ -3,7 +3,7 @@ // Dismiss a notification module.exports.handle_notification_dismiss = function () { $(document).ready(function () { - $('ul.notifications li.notification > a').click(function (ev) { + $('ul.notifications li.notification > a.notification-action').click(function (ev) { var url = $(this).attr('href'); var dismiss_url = $(this).parent().attr('data-dismiss-url'); var csrf_token = $(this).parent().attr('data-csrf-token'); diff --git a/readthedocs/core/static/core/js/site.js b/readthedocs/core/static/core/js/site.js index 7ebcf3485bf..9a2ea403430 100644 --- a/readthedocs/core/static/core/js/site.js +++ b/readthedocs/core/static/core/js/site.js @@ -1 +1 @@ -require=function i(n,o,a){function u(e,t){if(!o[e]){if(!n[e]){var r="function"==typeof require&&require;if(!t&&r)return r(e,!0);if(s)return s(e,!0);throw(t=new Error("Cannot find module '"+e+"'")).code="MODULE_NOT_FOUND",t}r=o[e]={exports:{}},n[e][0].call(r.exports,function(t){return u(n[e][1][t]||t)},r,r.exports,i,n,o,a)}return o[e].exports}for(var s="function"==typeof require&&require,t=0;t a").click(function(t){$(this).attr("href");var e=$(this).parent().attr("data-dismiss-url"),r=$(this).parent().attr("data-csrf-token");e?(t.preventDefault(),$.ajax({type:"PATCH",url:e,data:{state:"dismissed"},headers:{"X-CSRFToken":r}}).then(t=>{$(this).parent().hide()})):$(this).parent().hide()})})}},{}]},{},[]); \ No newline at end of file +require=function r(n,o,a){function u(e,t){if(!o[e]){if(!n[e]){var i="function"==typeof require&&require;if(!t&&i)return i(e,!0);if(f)return f(e,!0);throw(t=new Error("Cannot find module '"+e+"'")).code="MODULE_NOT_FOUND",t}i=o[e]={exports:{}},n[e][0].call(i.exports,function(t){return u(n[e][1][t]||t)},i,i.exports,r,n,o,a)}return o[e].exports}for(var f="function"==typeof require&&require,t=0;t a.notification-action").click(function(t){$(this).attr("href");var e=$(this).parent().attr("data-dismiss-url"),i=$(this).parent().attr("data-csrf-token");e?(t.preventDefault(),$.ajax({type:"PATCH",url:e,data:{state:"dismissed"},headers:{"X-CSRFToken":i}}).then(t=>{$(this).parent().hide()})):$(this).parent().hide()})})}},{}]},{},[]); diff --git a/readthedocs/rtd_tests/tests/test_notifications.py b/readthedocs/rtd_tests/tests/test_notifications.py index 135a67c5000..3670ada30cb 100644 --- a/readthedocs/rtd_tests/tests/test_notifications.py +++ b/readthedocs/rtd_tests/tests/test_notifications.py @@ -55,6 +55,7 @@ class TestNotification(EmailNotification): "PRODUCTION_DOMAIN": "readthedocs.org", "PUBLIC_DOMAIN": mock.ANY, "PUBLIC_API_URL": mock.ANY, + "RTD_EXT_THEME_ENABLED": mock.ANY, "SITE_ROOT": mock.ANY, "SUPPORT_EMAIL": "support@readthedocs.org", "TEMPLATE_ROOT": mock.ANY,