From 8339923d59207bf7a614f3bbb6b3c3518ea5c3b2 Mon Sep 17 00:00:00 2001 From: Zambom Date: Fri, 7 Apr 2017 19:26:31 -0300 Subject: [PATCH] Chat adjusts --- amadeus/static/css/base/amadeus.css | 19 +++++++++++++++++++ chat/templates/chat/_profile.html | 2 +- chat/views.py | 6 +++--- news/urls.py | 2 +- users/forms.py | 4 ++-- 5 files changed, 26 insertions(+), 7 deletions(-) diff --git a/amadeus/static/css/base/amadeus.css b/amadeus/static/css/base/amadeus.css index 5a1b392..46de65f 100755 --- a/amadeus/static/css/base/amadeus.css +++ b/amadeus/static/css/base/amadeus.css @@ -1409,11 +1409,30 @@ div.dataTables_wrapper div.dataTables_paginate { } .talk-filter h4 { font-weight: 700; + font-size: 14px; margin-bottom: 5px !important; } .talk-filter .checkbox { margin-right: 10px; } +.talk-filter .checkbox .checkbox-material { + top: 0px; +} +.talk-filter .checkbox .checkbox-material .check { + width: 14px; + height: 14px; +} +.talk-filter .checkbox .checkbox-material .check::before { + margin-top: -8px; + margin-left: 4px; +} +.talk-filter label { + font-size: 14px; +} + +#chat-filters .btn-sm { + padding: 5px 10px; +} .messages-container { height: 400px; diff --git a/chat/templates/chat/_profile.html b/chat/templates/chat/_profile.html index 4bbf518..93d086a 100644 --- a/chat/templates/chat/_profile.html +++ b/chat/templates/chat/_profile.html @@ -17,7 +17,7 @@ {{ participant }} - {% trans 'Send Message' %} + {% trans 'Send Message' %}
diff --git a/chat/views.py b/chat/views.py index 468da85..121b8b3 100644 --- a/chat/views.py +++ b/chat/views.py @@ -49,7 +49,7 @@ class GeneralIndex(LoginRequiredMixin, LogMixin, generic.ListView): def get_queryset(self): user = self.request.user - conversations = Conversation.objects.filter((Q(user_one = user) | Q(user_two = user))) + conversations = Conversation.objects.extra(select = {"most_recent": "select create_date from chat_talkmessages where chat_talkmessages.talk_id = chat_conversation.id order by create_date DESC LIMIT 1"}).filter((Q(user_one = user) | Q(user_two = user))).order_by('-most_recent') return conversations @@ -189,10 +189,10 @@ class SubjectView(LoginRequiredMixin, LogMixin, generic.ListView): slug = self.kwargs.get('slug') subject = get_object_or_404(Subject, slug = slug) - conversations = Conversation.objects.filter((Q(user_one = user) & (Q(user_two__is_staff = True) | + conversations = Conversation.objects.extra(select = {"most_recent": "select create_date from chat_talkmessages where chat_talkmessages.talk_id = chat_conversation.id order by create_date DESC LIMIT 1"}).filter((Q(user_one = user) & (Q(user_two__is_staff = True) | Q(user_two__subject_student = subject) | Q(user_two__professors = subject) | Q(user_two__coordinators__subject_category = subject))) | (Q(user_two = user) & (Q(user_one__is_staff = True) | Q(user_one__subject_student = subject) | - Q(user_one__professors = subject) | Q(user_one__coordinators__subject_category = subject)))).distinct() + Q(user_one__professors = subject) | Q(user_one__coordinators__subject_category = subject)))).distinct().order_by('-most_recent') return conversations diff --git a/news/urls.py b/news/urls.py index df009be..f5d8b89 100644 --- a/news/urls.py +++ b/news/urls.py @@ -4,7 +4,7 @@ from . import views urlpatterns = [ url(r'^$', views.ListNewsView.as_view(), name='manage_news'), url(r'^view/(?P[\w_-]+)/$', views.VisualizeNews.as_view(), name = 'view'), - url(r'^create/$, views.CreateNewsView.as_view(), name='create'), + url(r'^create/$', views.CreateNewsView.as_view(), name='create'), url(r'^update/(?P[\w_-]+)/$', views.UpdateNewsView.as_view(), name = 'update'), ] diff --git a/users/forms.py b/users/forms.py index 2cb71a5..16e337a 100644 --- a/users/forms.py +++ b/users/forms.py @@ -128,8 +128,8 @@ class ProfileForm(Validation): y = self.cleaned_data.get('y') w = self.cleaned_data.get('width') h = self.cleaned_data.get('height') - - if self.instance.image : + + if self.instance.image: image = Image.open(self.instance.image) cropped_image = image.crop((x, y, w+x, h+y)) resized_image = cropped_image.resize((200, 200), Image.ANTIALIAS) -- libgit2 0.21.2