Commit 2d0e0381d3e4d1c4186c6d75e9b1a003d4febb42
1 parent
78fc91e9
Exists in
master
and in
3 other branches
Adding general mural page
Showing
11 changed files
with
207 additions
and
8 deletions
Show diff stats
amadeus/static/css/base/amadeus.css
@@ -925,4 +925,24 @@ li.item .notify_badge { | @@ -925,4 +925,24 @@ li.item .notify_badge { | ||
925 | padding-right: 0px; | 925 | padding-right: 0px; |
926 | font-size: 16px !important; | 926 | font-size: 16px !important; |
927 | margin: 7px 0 0 0 !important; | 927 | margin: 7px 0 0 0 !important; |
928 | +} | ||
929 | + | ||
930 | +.mural .post_make { | ||
931 | + padding: 10px; | ||
932 | + margin-bottom: 10px; | ||
933 | +} | ||
934 | +.mural .post_make .user-img { | ||
935 | + padding: 0; | ||
936 | +} | ||
937 | +.mural .post_make .post-field { | ||
938 | + padding-right: 0px; | ||
939 | +} | ||
940 | +.mural .post_make .post-field div { | ||
941 | + border-width: 1px; | ||
942 | + border-style: solid; | ||
943 | + padding: 0px 5px; | ||
944 | +} | ||
945 | +.mural .post_make .post-field h4 { | ||
946 | + cursor: text; | ||
947 | + font-style: italic; | ||
928 | } | 948 | } |
929 | \ No newline at end of file | 949 | \ No newline at end of file |
amadeus/static/css/base/amadeus_responsive.css
1 | +@media(min-width: 1200px) { | ||
2 | + .mural .post_make .user-img img { | ||
3 | + max-width: 70px; | ||
4 | + max-height: 70px; | ||
5 | + } | ||
6 | + | ||
7 | + .mural .post_make .post-field h4 { | ||
8 | + line-height: 2.6em; | ||
9 | + } | ||
10 | +} | ||
11 | + | ||
1 | @media(max-width: 1199px) { | 12 | @media(max-width: 1199px) { |
2 | .navbar .navbar-brand { | 13 | .navbar .navbar-brand { |
3 | padding: 15px; | 14 | padding: 15px; |
4 | } | 15 | } |
16 | + | ||
17 | + .mural .post_make .user-img img { | ||
18 | + max-width: 65px; | ||
19 | + max-height: 65px; | ||
20 | + } | ||
21 | + | ||
22 | + .mural .post_make .post-field h4 { | ||
23 | + line-height: 2.3em; | ||
24 | + } | ||
5 | } | 25 | } |
6 | 26 | ||
7 | @media(max-width: 768px) { | 27 | @media(max-width: 768px) { |
@@ -42,6 +62,14 @@ | @@ -42,6 +62,14 @@ | ||
42 | display:none; | 62 | display:none; |
43 | } | 63 | } |
44 | 64 | ||
65 | + .mural .post_make .user-img img { | ||
66 | + max-width: 60px; | ||
67 | + max-height: 60px; | ||
68 | + } | ||
69 | + | ||
70 | + .mural .post_make .post-field h4 { | ||
71 | + line-height: 2em; | ||
72 | + } | ||
45 | } | 73 | } |
46 | 74 | ||
47 | @media(min-width: 768px) { | 75 | @media(min-width: 768px) { |
@@ -82,3 +110,14 @@ | @@ -82,3 +110,14 @@ | ||
82 | margin-top: 6px; | 110 | margin-top: 6px; |
83 | } | 111 | } |
84 | } | 112 | } |
113 | + | ||
114 | +@media(max-width: 680px) { | ||
115 | + .mural .post_make .user-img img { | ||
116 | + max-width: 50px; | ||
117 | + max-height: 50px; | ||
118 | + } | ||
119 | + | ||
120 | + .mural .post_make .post-field h4 { | ||
121 | + line-height: 1.6em; | ||
122 | + } | ||
123 | +} | ||
85 | \ No newline at end of file | 124 | \ No newline at end of file |
amadeus/static/css/themes/green.css
@@ -488,6 +488,14 @@ a.add-row { | @@ -488,6 +488,14 @@ a.add-row { | ||
488 | color: #333; | 488 | color: #333; |
489 | } | 489 | } |
490 | 490 | ||
491 | +.mural .post_make { | ||
492 | + background: #FFFFFF; | ||
493 | +} | ||
494 | + | ||
495 | +.mural .post_make .post-field div { | ||
496 | + border-color: #CCCCCC; | ||
497 | +} | ||
498 | + | ||
491 | @media(max-width: 768px) { | 499 | @media(max-width: 768px) { |
492 | .navbar .navbar-nav .dropdown .dropdown-menu li > a { | 500 | .navbar .navbar-nav .dropdown .dropdown-menu li > a { |
493 | color: #333333 !important; | 501 | color: #333333 !important; |
amadeus/templates/base.html
@@ -179,8 +179,10 @@ | @@ -179,8 +179,10 @@ | ||
179 | <i class="fa fa-graduation-cap" aria-hidden="true"></i> | 179 | <i class="fa fa-graduation-cap" aria-hidden="true"></i> |
180 | </a> | 180 | </a> |
181 | </li> | 181 | </li> |
182 | - <li class="item" data-toggle="tooltip" data-placement="right" title="{% trans "Timeline" %}"> | ||
183 | - <i class="fa fa-list" aria-hidden="true" ></i> | 182 | + <li class="item {{ mural_menu_active }}" data-toggle="tooltip" data-placement="right" title="{% trans "Timeline" %}"> |
183 | + <a href="{% url 'mural:manage_general' %}"> | ||
184 | + <i class="fa fa-list" aria-hidden="true" ></i> | ||
185 | + </a> | ||
184 | </li> | 186 | </li> |
185 | <li class="item" data-toggle="tooltip" data-placement="right" title="{% trans "Messages" %}"> | 187 | <li class="item" data-toggle="tooltip" data-placement="right" title="{% trans "Messages" %}"> |
186 | <i class="fa fa-envelope-o" aria-hidden="true"></i> | 188 | <i class="fa fa-envelope-o" aria-hidden="true"></i> |
@@ -228,8 +230,10 @@ | @@ -228,8 +230,10 @@ | ||
228 | <i class="fa fa-graduation-cap" aria-hidden="true"></i> | 230 | <i class="fa fa-graduation-cap" aria-hidden="true"></i> |
229 | </a> | 231 | </a> |
230 | </li> | 232 | </li> |
231 | - <li class="item" data-toggle="tooltip" data-placement="top" title="{% trans "Timeline" %}"> | ||
232 | - <i class="fa fa-list" aria-hidden="true" ></i> | 233 | + <li class="item {{ mural_menu_active }}" data-toggle="tooltip" data-placement="top" title="{% trans "Timeline" %}"> |
234 | + <a href="{% url 'mural:manage_general' %}" | ||
235 | + <i class="fa fa-list" aria-hidden="true" ></i> | ||
236 | + </a> | ||
233 | </li> | 237 | </li> |
234 | <li class="item" data-toggle="tooltip" data-placement="top" title="{% trans "Messages" %}"> | 238 | <li class="item" data-toggle="tooltip" data-placement="top" title="{% trans "Messages" %}"> |
235 | <i class="fa fa-envelope-o" aria-hidden="true"></i> | 239 | <i class="fa fa-envelope-o" aria-hidden="true"></i> |
amadeus/urls.py
@@ -29,6 +29,7 @@ urlpatterns = [ | @@ -29,6 +29,7 @@ urlpatterns = [ | ||
29 | url(r'^subjects/', include('subjects.urls', namespace = 'subjects')), | 29 | url(r'^subjects/', include('subjects.urls', namespace = 'subjects')), |
30 | url(r'^groups/', include('students_group.urls', namespace = 'groups')), | 30 | url(r'^groups/', include('students_group.urls', namespace = 'groups')), |
31 | url(r'^topics/', include('topics.urls', namespace = 'topics')), | 31 | url(r'^topics/', include('topics.urls', namespace = 'topics')), |
32 | + url(r'^mural/', include('mural.urls', namespace = 'mural')), | ||
32 | url(r'^webpages/', include('webpage.urls', namespace = 'webpages')), | 33 | url(r'^webpages/', include('webpage.urls', namespace = 'webpages')), |
33 | url(r'^ytvideo/', include('youtube_video.urls', namespace = 'youtube')), | 34 | url(r'^ytvideo/', include('youtube_video.urls', namespace = 'youtube')), |
34 | url(r'^file_links/', include('file_link.urls', namespace = 'file_links')), | 35 | url(r'^file_links/', include('file_link.urls', namespace = 'file_links')), |
@@ -0,0 +1,28 @@ | @@ -0,0 +1,28 @@ | ||
1 | +# -*- coding: utf-8 -*- | ||
2 | +# Generated by Django 1.10 on 2017-02-03 21:56 | ||
3 | +from __future__ import unicode_literals | ||
4 | + | ||
5 | +from django.conf import settings | ||
6 | +from django.db import migrations, models | ||
7 | +import django.db.models.deletion | ||
8 | + | ||
9 | + | ||
10 | +class Migration(migrations.Migration): | ||
11 | + | ||
12 | + dependencies = [ | ||
13 | + migrations.swappable_dependency(settings.AUTH_USER_MODEL), | ||
14 | + ('mural', '0001_initial'), | ||
15 | + ] | ||
16 | + | ||
17 | + operations = [ | ||
18 | + migrations.CreateModel( | ||
19 | + name='MuralVisualizations', | ||
20 | + fields=[ | ||
21 | + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
22 | + ('viewed', models.BooleanField(default=False, verbose_name='Viewed')), | ||
23 | + ('comment', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='visualization_comment', to='mural.Comment', verbose_name='Comment')), | ||
24 | + ('post', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='visualization_post', to='mural.Mural', verbose_name='Post')), | ||
25 | + ('user', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='visualization_user', to=settings.AUTH_USER_MODEL, verbose_name='User')), | ||
26 | + ], | ||
27 | + ), | ||
28 | + ] |
mural/models.py
@@ -39,4 +39,10 @@ class Comment(models.Model): | @@ -39,4 +39,10 @@ class Comment(models.Model): | ||
39 | post = models.ForeignKey(Mural, verbose_name = _('Post'), related_name = 'comment_post') | 39 | post = models.ForeignKey(Mural, verbose_name = _('Post'), related_name = 'comment_post') |
40 | user = models.ForeignKey(User, verbose_name = _('User'), related_name = "comment_user", null = True) | 40 | user = models.ForeignKey(User, verbose_name = _('User'), related_name = "comment_user", null = True) |
41 | create_date = models.DateTimeField(_('Create Date'), auto_now_add = True) | 41 | create_date = models.DateTimeField(_('Create Date'), auto_now_add = True) |
42 | - last_update = models.DateTimeField(_('Last Update'), auto_now = True) | ||
43 | \ No newline at end of file | 42 | \ No newline at end of file |
43 | + last_update = models.DateTimeField(_('Last Update'), auto_now = True) | ||
44 | + | ||
45 | +class MuralVisualizations(models.Model): | ||
46 | + viewed = models.BooleanField(_('Viewed'), default = False) | ||
47 | + post = models.ForeignKey(Mural, verbose_name = _('Post'), related_name = 'visualization_post', null = True) | ||
48 | + comment = models.ForeignKey(Comment, verbose_name = _('Comment'), related_name = 'visualization_comment', null = True) | ||
49 | + user = models.ForeignKey(User, verbose_name = _('User'), related_name = "visualization_user", null = True) | ||
44 | \ No newline at end of file | 50 | \ No newline at end of file |
@@ -0,0 +1,47 @@ | @@ -0,0 +1,47 @@ | ||
1 | +{% extends 'base.html' %} | ||
2 | + | ||
3 | +{% load static i18n pagination %} | ||
4 | +{% load django_bootstrap_breadcrumbs %} | ||
5 | + | ||
6 | +{% block breadcrumbs %} | ||
7 | + {{ block.super }} | ||
8 | + | ||
9 | + {% trans 'Mural: General' as general %} | ||
10 | + | ||
11 | + {% breadcrumb general 'mural:manage_general' %} | ||
12 | +{% endblock %} | ||
13 | + | ||
14 | +{% block content %} | ||
15 | + <div id="core-subjects-options-div"> | ||
16 | + <ul class="core-subjects-options"> | ||
17 | + <a href="{% url 'mural:manage_general' %}"><li class="active">{% trans "General" %} ({{ totals.general }})</li></a> | ||
18 | + <a href=""><li>{% trans "Per Category" %} ({{ totals.category }})</li></a> | ||
19 | + <a href=""><li>{% trans "Per Subject" %} ({{ totals.subject }})</li></a> | ||
20 | + </ul> | ||
21 | + </div> | ||
22 | + | ||
23 | + <div class="col-md-12 cards-content mural"> | ||
24 | + <div class="col-md-9 col-sm-9 col-xs-9"> | ||
25 | + <div class="row post_make"> | ||
26 | + <div class="col-lg-1 col-md-1 col-sm-1 col-xs-1 user-img"> | ||
27 | + <img src="{{ request.user.image_url }}" class="img-responsive" /> | ||
28 | + </div> | ||
29 | + <div class="col-lg-11 col-md-11 col-sm-11 col-xs-11 post-field"> | ||
30 | + <div> | ||
31 | + <h4>{% trans 'Wish to make a new post?' %}</h4> | ||
32 | + </div> | ||
33 | + </div> | ||
34 | + </div> | ||
35 | + | ||
36 | + {% if posts.count > 0 %} | ||
37 | + {% else %} | ||
38 | + <div class="text-center no-subjects"> | ||
39 | + <i class="fa fa-list"></i> | ||
40 | + <h4>{% trans 'There are no posts in this mural yet.' %}</h4> | ||
41 | + </div> | ||
42 | + {% endif %} | ||
43 | + </div> | ||
44 | + <div class="col-md-3 col-sm-3 col-xs-3"> | ||
45 | + </div> | ||
46 | + </div> | ||
47 | +{% endblock %} | ||
0 | \ No newline at end of file | 48 | \ No newline at end of file |
mural/urls.py
mural/views.py
1 | -from django.shortcuts import render | 1 | +from django.shortcuts import get_object_or_404, redirect, render |
2 | +from django.views import generic | ||
3 | +from django.contrib import messages | ||
4 | +from django.http import JsonResponse | ||
5 | +from django.core.urlresolvers import reverse, reverse_lazy | ||
6 | +from django.utils.translation import ugettext_lazy as _ | ||
7 | +from django.contrib.auth.mixins import LoginRequiredMixin | ||
8 | +from django.db.models import Q, Count | ||
2 | 9 | ||
3 | -# Create your views here. | 10 | +from .models import GeneralPost, CategoryPost, SubjectPost, MuralVisualizations |
11 | + | ||
12 | +class GeneralIndex(LoginRequiredMixin, generic.ListView): | ||
13 | + login_url = reverse_lazy("users:login") | ||
14 | + redirect_field_name = 'next' | ||
15 | + | ||
16 | + template_name = 'mural/list.html' | ||
17 | + model = GeneralPost | ||
18 | + context_object_name = "posts" | ||
19 | + paginate_by = 10 | ||
20 | + | ||
21 | + totals = {} | ||
22 | + | ||
23 | + def get_queryset(self): | ||
24 | + user = self.request.user | ||
25 | + | ||
26 | + general = GeneralPost.objects.all() | ||
27 | + | ||
28 | + self.totals['general'] = MuralVisualizations.objects.filter(Q(user = user) & Q(viewed = False) & (Q(post__generalpost__isnull = False) | Q(comment__post__generalpost__isnull = False))).distinct().count() | ||
29 | + self.totals['category'] = MuralVisualizations.objects.filter(Q(user = user) & Q(viewed = False) & (Q(post__categorypost__space__coordinators = user) | Q(comment__post__categorypost__space__coordinators = user) | Q(post__categorypost__space__subject_category__professor = user) | Q(post__categorypost__space__subject_category__students = user) | Q(comment__post__categorypost__space__subject_category__professor = user) | Q(comment__post__categorypost__space__subject_category__students = user))).distinct().count() | ||
30 | + self.totals['subject'] = MuralVisualizations.objects.filter(Q(user = user) & Q(viewed = False) & (Q(post__subjectpost__space__professor = user) | Q(comment__post__subjectpost__space__professor = user) | Q(post__subjectpost__space__students = user) | Q(comment__post__subjectpost__space__students = user))).distinct().count() | ||
31 | + | ||
32 | + return general | ||
33 | + | ||
34 | + def get_context_data(self, **kwargs): | ||
35 | + context = super(GeneralIndex, self).get_context_data(**kwargs) | ||
36 | + | ||
37 | + context['title'] = _('Mural') | ||
38 | + context['totals'] = self.totals | ||
39 | + context['mural_menu_active'] = 'subjects_menu_active' | ||
40 | + | ||
41 | + return context |
requirements.txt
@@ -35,4 +35,6 @@ whitenoise==3.2.2 | @@ -35,4 +35,6 @@ whitenoise==3.2.2 | ||
35 | django-session-security==2.4.0 | 35 | django-session-security==2.4.0 |
36 | django-cron==0.5.0 | 36 | django-cron==0.5.0 |
37 | django-crontab==0.7.1 | 37 | django-crontab==0.7.1 |
38 | -python-dateutil==2.6.0 | ||
39 | \ No newline at end of file | 38 | \ No newline at end of file |
39 | +python-dateutil==2.6.0 | ||
40 | +channels==1.0.3 | ||
41 | +asgi_redis==1.0.0 | ||
40 | \ No newline at end of file | 42 | \ No newline at end of file |