diff --git a/amadeus/settings.py b/amadeus/settings.py index af84506..96ede51 100644 --- a/amadeus/settings.py +++ b/amadeus/settings.py @@ -67,6 +67,7 @@ INSTALLED_APPS = [ 'pendencies', 'mural', 'file_link', + 'pdf_file', 'links', 'webpage', 'youtube_video', diff --git a/amadeus/static/css/base/amadeus.css b/amadeus/static/css/base/amadeus.css index 33b1f49..7e05949 100755 --- a/amadeus/static/css/base/amadeus.css +++ b/amadeus/static/css/base/amadeus.css @@ -964,6 +964,10 @@ li.item .notify_badge { margin: 7px 0 0 0 !important; } +.mural .mural-list { + padding-left: 0; +} + .mural .post_make { padding: 10px; margin-bottom: 10px; @@ -1075,6 +1079,11 @@ li.item .notify_badge { cursor: text; } +.post-filter h4 { + font-weight: 700; + margin-bottom: 15px; +} + .btn:focus, .btn:active:focus, .btn.active:focus, .btn.focus, .btn:active.focus, .btn.active.focus { outline: none; } \ No newline at end of file diff --git a/amadeus/static/css/themes/green.css b/amadeus/static/css/themes/green.css index f12223d..4fa7409 100644 --- a/amadeus/static/css/themes/green.css +++ b/amadeus/static/css/themes/green.css @@ -542,6 +542,22 @@ a.add-row { color: #BBBBBB !important; } +.post-filter { + background: #DDDDDD; +} + +.post-filter h4 { + color: #4caf50; +} + +.post-filter label { + color: #333333; +} + +.post-filter i { + color: #FF0000; +} + .btn:not(.btn-raised):not(.btn-link):focus, .btn:not(.btn-raised):not(.btn-link):hover, .input-group-btn .btn:not(.btn-raised):not(.btn-link):focus, .input-group-btn .btn:not(.btn-raised):not(.btn-link):hover { background-color: initial; } diff --git a/mural/templates/mural/_view.html b/mural/templates/mural/_view.html index 2876dba..56dbde0 100644 --- a/mural/templates/mural/_view.html +++ b/mural/templates/mural/_view.html @@ -1,6 +1,6 @@ {% load i18n mural_filters %} -
+
diff --git a/mural/templates/mural/list.html b/mural/templates/mural/list.html index dd334fe..9ddd1f0 100644 --- a/mural/templates/mural/list.html +++ b/mural/templates/mural/list.html @@ -21,8 +21,8 @@
-
-
+
+
@@ -45,7 +45,23 @@

{% trans 'There are no posts in this mural yet.' %}

-
+
+

{% trans 'Filter' %}

+ +
+
+ +
+
+ +
+ + +
@@ -67,6 +83,14 @@ } }); }); + + $("#clear_filter").click(function () { + var frm = $(this).parent(); + + frm.find("input[type='checkbox']").prop('checked', false); + + frm.submit(); + }); }); function setPostFormSubmit(post = "") { diff --git a/mural/templatetags/mural_filters.py b/mural/templatetags/mural_filters.py index 5a67272..bc5288d 100644 --- a/mural/templatetags/mural_filters.py +++ b/mural/templatetags/mural_filters.py @@ -14,6 +14,8 @@ def is_edited(post): @register.filter(name = 'action_icon') def action_icon(action): + icon = "" + if action == "comment": icon = "fa-commenting-o" elif action == "help": diff --git a/mural/views.py b/mural/views.py index 522c250..7d4323b 100644 --- a/mural/views.py +++ b/mural/views.py @@ -22,7 +22,6 @@ class GeneralIndex(LoginRequiredMixin, generic.ListView): redirect_field_name = 'next' template_name = 'mural/list.html' - model = GeneralPost context_object_name = "posts" paginate_by = 10 @@ -30,9 +29,20 @@ class GeneralIndex(LoginRequiredMixin, generic.ListView): def get_queryset(self): user = self.request.user + favorites = self.request.GET.get('favorite', False) + mines = self.request.GET.get('mine', False) + + if not favorites: + if mines: + general = GeneralPost.objects.extra(select = {"most_recent": "greatest(last_update, (select max(mural_comment.last_update) from mural_comment where mural_comment.post_id = mural_generalpost.mural_ptr_id))"}).filter(mural_ptr__user = user) + else: + general = GeneralPost.objects.extra(select = {"most_recent": "greatest(last_update, (select max(mural_comment.last_update) from mural_comment where mural_comment.post_id = mural_generalpost.mural_ptr_id))"}) + else: + if mines: + general = GeneralPost.objects.extra(select = {"most_recent": "greatest(last_update, (select max(mural_comment.last_update) from mural_comment where mural_comment.post_id = mural_generalpost.mural_ptr_id))"}).filter(favorites_post__isnull = False, mural_ptr__user = user) + else: + general = GeneralPost.objects.extra(select = {"most_recent": "greatest(last_update, (select max(mural_comment.last_update) from mural_comment where mural_comment.post_id = mural_generalpost.mural_ptr_id))"}).filter(favorites_post__isnull = False) - general = GeneralPost.objects.extra(select={"most_recent": "greatest(last_update, (select max(mural_comment.last_update) from mural_comment where mural_comment.post_id = mural_generalpost.mural_ptr_id))"}).order_by("-most_recent") - general_visualizations = MuralVisualizations.objects.filter(Q(user = user) & Q(viewed = False) & (Q(post__generalpost__isnull = False) | Q(comment__post__generalpost__isnull = False))).distinct() self.totals['general'] = general_visualizations.count() @@ -41,7 +51,7 @@ class GeneralIndex(LoginRequiredMixin, generic.ListView): general_visualizations.update(viewed = True) - return general + return general.order_by("-most_recent") def get_context_data(self, **kwargs): context = super(GeneralIndex, self).get_context_data(**kwargs) @@ -49,6 +59,18 @@ class GeneralIndex(LoginRequiredMixin, generic.ListView): context['title'] = _('Mural') context['totals'] = self.totals context['mural_menu_active'] = 'subjects_menu_active' + context['favorites'] = "" + context['mines'] = "" + + favs = self.request.GET.get('favorite', False) + + if favs: + context['favorites'] = "checked" + + mines = self.request.GET.get('mine', False) + + if mines: + context['mines'] = "checked" return context -- libgit2 0.21.2