Skip to content
Snippets Groups Projects
Commit 64975243 authored by sandeepsajan0's avatar sandeepsajan0 Committed by Fredrik Jonsson
Browse files

Update notifications list UI,add related object link and date

parent 08b22b2a
No related branches found
No related tags found
No related merge requests found
import django_filters
from .models import Activity
class NotificationFilter(django_filters.FilterSet):
class Meta:
model = Activity
fields = {
'timestamp',
'source_content_type',
}
{% extends "base-apply.html" %} {% extends "base-apply.html" %}
{% load i18n static activity_tags %} {% load i18n static activity_tags apply_tags %}
{% block content %} {% block content %}
<div class="admin-bar"> <div class="admin-bar">
...@@ -22,23 +22,40 @@ ...@@ -22,23 +22,40 @@
<div class="wrapper wrapper--large wrapper--tabs js-tabs-content"> <div class="wrapper wrapper--large wrapper--tabs js-tabs-content">
{# Tab 1 #} {# Tab 1 #}
<div class="tabs__content" id="tab-1"> <div class="tabs__content" id="tab-1">
{% for comment in object_list %} <!-- <form action="" method="get">-->
{% if comment.type == 'comment' %} <!-- {{ filter.form.as_p }}-->
<!-- <input type="submit" />-->
<p><a href="{{ comment.source.get_absolute_url }}">{{ comment.source_content_type.name|source_type }} ({{ comment.source.title|truncatechars:15 }})</a> <!-- </form>-->
: {{ comment.user }} made a comment</p> {% for comment in comments %}
{% endif %} <div class="feed__item feed__item--comment">
<div class="feed__pre-content">
<p class="feed__label feed__label--comment">{{ comment.source_content_type.name|source_type }}</p>
</div>
<div class="feed__content js-feed-content">
<div class="feed__meta js-feed-meta">
<p class="feed__meta-item"><a href="{{ comment.source.get_absolute_url }}">{{ comment.source.title|capfirst|truncatechars:15 }}</a>
: {{ comment.user }} made a comment – {{ comment.timestamp|date:"SHORT_DATETIME_FORMAT" }}</p>
</div>
</div>
</div>
{% endfor %} {% endfor %}
</div> </div>
{# Tab 2 #} {# Tab 2 #}
<div class="tabs__content" id="tab-2"> <div class="tabs__content" id="tab-2">
<div class="feed">
{% for action in actions %} {% for action in actions %}
<p><a href="{{ action.source.get_absolute_url }}">{{ action.source_content_type.name|source_type }} ({{ action.source.title|truncatechars:15 }})</a> <div class="feed__item feed__item--action">
: {{ action.message }} <a href="{{ action.related_object.get_absolute_url }}">{{ action.related_object.title }}</a> <div class="feed__pre-content">
</p> <p class="feed__label feed__label--action">{{ action.source_content_type.name|source_type }}</p>
</div>
<div class="feed__content js-feed-content">
<div class="feed__meta js-feed-meta">
<p class="feed__meta-item"><a href="{{ action.source.get_absolute_url }}">{{ action.source.title|capfirst|truncatechars:15 }}</a>
: {{ action.message }} {% if action.related_object %}<a href="{{ action.related_object.get_absolute_url }}">{{ action.related_object|model_verbose_name }}</a>{% endif %}
– {{ action.timestamp|date:"SHORT_DATETIME_FORMAT" }}</p>
</div>
</div>
</div>
{% endfor %} {% endfor %}
</div>
</div> </div>
</div> </div>
......
...@@ -83,4 +83,5 @@ class NotificationsView(ListView): ...@@ -83,4 +83,5 @@ class NotificationsView(ListView):
else: else:
context['comments'] = Activity.comments.filter(user=user).order_by('-timestamp') context['comments'] = Activity.comments.filter(user=user).order_by('-timestamp')
context['actions'] = Activity.actions.filter(user=user).order_by('-timestamp') context['actions'] = Activity.actions.filter(user=user).order_by('-timestamp')
# context['filter'] = NotificationFilter(self.request.GET, queryset=self.get_queryset())
return context return context
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment