Skip to content

Commit e74350b

Browse files
committed
New dashboard: notification to point users there
We can add the notifications to all the users by running the following code: ```python from readthedocs.core.notifications import MESSAGE_BETA_DASHBOARD_AVAILABLE for user in User.objects.all(): Notification.objects.add( message_id=MESSAGE_BETA_DASHBOARD_AVAILABLE, attached_to=user, dismissable=True, ) ``` This will show a one-time dismissable notification to these users. In the future (weeks, months) if we can show them another notification like this one as a reminder, we can run the same code again. Related readthedocs/ext-theme#183
1 parent dd908ef commit e74350b

File tree

3 files changed

+17
-3
lines changed

3 files changed

+17
-3
lines changed

readthedocs/core/notifications.py

+15-1
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,11 @@
44

55
from django.utils.translation import gettext_lazy as _
66

7-
from readthedocs.notifications.constants import WARNING
7+
from readthedocs.notifications.constants import INFO, WARNING
88
from readthedocs.notifications.messages import Message, registry
99

1010
MESSAGE_EMAIL_VALIDATION_PENDING = "core:email:validation-pending"
11+
MESSAGE_BETA_DASHBOARD_AVAILABLE = "core:dashboard:beta-available"
1112
messages = [
1213
Message(
1314
id=MESSAGE_EMAIL_VALIDATION_PENDING,
@@ -22,6 +23,19 @@
2223
),
2324
type=WARNING,
2425
),
26+
Message(
27+
id=MESSAGE_BETA_DASHBOARD_AVAILABLE,
28+
header=_("New beta dashboard available"),
29+
body=_(
30+
textwrap.dedent(
31+
"""
32+
We are launching our new <strong>beta dashboard</strong> with a fresh redesign and new powerful features.
33+
<a href="https://beta.readthedocs.org/">Give it a try</a> and send us feedback.
34+
"""
35+
).strip(),
36+
),
37+
type=INFO,
38+
),
2539
]
2640

2741

readthedocs/core/static-src/core/js/site.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// Dismiss a notification
44
module.exports.handle_notification_dismiss = function () {
55
$(document).ready(function () {
6-
$('ul.notifications li.notification > a').click(function (ev) {
6+
$('ul.notifications li.notification > a.notification-action').click(function (ev) {
77
var url = $(this).attr('href');
88
var dismiss_url = $(this).parent().attr('data-dismiss-url');
99
var csrf_token = $(this).parent().attr('data-csrf-token');

readthedocs/core/static/core/js/site.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)