Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Notifications: show attached to User, Project and Organization #261

Merged
merged 3 commits into from
Jan 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions readthedocsext/theme/templates/includes/utils/messages.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,23 @@
page content pane.
{% endcomment %}

{% comment %}
``user_notifications`` comes from a Context Processor.
We need to use a CustomUser to have access to "user.notifications"
See https://docs.djangoproject.com/en/4.2/ref/settings/#std-setting-AUTH_USER_MODEL
{% endcomment %}
{% if user_notifications %}
{% for notification in user_notifications %}
<div class="ui message">
{% comment %}
Add this Xmark here once we implement dismissing notifications.
<i class="fa-duotone fa-circle-xmark close icon"></i>
{% endcomment %}
{{ notification.get_message.get_rendered_body|safe }}
</div>
{% endfor %}
{% endif %}

{% if messages %}
{% for message in messages %}
{% comment %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,16 @@
{% endcomment %}

{% block organization_header %}
{# Render all the notifications attached to the organization.#}
{% for notification in organization.notifications.all %}
<div class="ui message">
<i class="{{ notification.get_message.get_display_icon_classes }} icon"></i>
<span>{{ notification.get_message.get_rendered_body|safe }}</span>
</div>
{% endfor %}



<div class="ui top attached segment" data-bind="using: CollapsingHeaderView({{ is_collapsed|default_if_none:True|yesno:"true,false" }})">

{% block organization_header_metadata %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,14 @@
{% endcomment %}

{% block project_header %}
{# Render all the notifications attached to the project.#}
{% for notification in project.notifications.all %}
<div class="ui message">
<i class="{{ notification.get_message.get_display_icon_classes }} icon"></i>
<span>{{ notification.get_message.get_rendered_body|safe }}</span>
</div>
{% endfor %}

<div class="ui top attached segment" data-bind="using: CollapsingHeaderView({{ is_collapsed|default_if_none:True|yesno:"true,false" }})">

{% block project_header_metadata %}
Expand Down