Commit aeab8e3e8f33ee5887e7f35ef74081e788d867ef

Authored by Jailson Dias
2 parents 5927b6dd f02ce614

Merge branch 'master' of https://github.com/amadeusproject/amadeuslms

amadeus/settings.py
@@ -77,6 +77,8 @@ TEMPLATES = [ @@ -77,6 +77,8 @@ TEMPLATES = [
77 'django.template.context_processors.request', 77 'django.template.context_processors.request',
78 'django.contrib.auth.context_processors.auth', 78 'django.contrib.auth.context_processors.auth',
79 'django.contrib.messages.context_processors.messages', 79 'django.contrib.messages.context_processors.messages',
  80 +
  81 + 'core.context_processors.notifications',
80 ], 82 ],
81 }, 83 },
82 }, 84 },
@@ -92,8 +94,8 @@ DATABASES = { @@ -92,8 +94,8 @@ DATABASES = {
92 'default': { 94 'default': {
93 'ENGINE': 'django.db.backends.postgresql', 95 'ENGINE': 'django.db.backends.postgresql',
94 'NAME': 'amadeus', 96 'NAME': 'amadeus',
95 - 'USER': 'amadeus_admin',  
96 - 'PASSWORD': 'amadeus', 97 + 'USER': 'postgres',
  98 + 'PASSWORD': 'felipe',
97 'HOST': '127.0.0.1', 99 'HOST': '127.0.0.1',
98 'PORT': '5432', 100 'PORT': '5432',
99 } 101 }
app/templates/home.html
@@ -103,11 +103,18 @@ @@ -103,11 +103,18 @@
103 {% block content %} 103 {% block content %}
104 {% if user|has_role:'system_admin' %} 104 {% if user|has_role:'system_admin' %}
105 <h3>{% trans 'Courses' %}</h3> 105 <h3>{% trans 'Courses' %}</h3>
106 - {% endif %}  
107 106
108 - <div id="timeline">  
109 - {% include page_template %}  
110 - </div> 107 + <div id="timeline">
  108 + {% include page_template %}
  109 + </div>
  110 + {% else %}
  111 + <ul class="timeline" style="-webkit-padding-start: 0px">
  112 + <div id="timeline">
  113 + {% include page_template %}
  114 + </div>
  115 + </ul>
  116 + {% endif %}
  117 +
111 <div id="loading" class="alert alert-primary" role="alert" style="display: none"> 118 <div id="loading" class="alert alert-primary" role="alert" style="display: none">
112 <center> 119 <center>
113 <span class="fa fa-spin fa-circle-o-notch"></span> 120 <span class="fa fa-spin fa-circle-o-notch"></span>
app/templates/home_admin_content.html
1 {% load i18n %} 1 {% load i18n %}
2 2
3 -{% for course in courses %} 3 +{% for course in objects %}
4 <div class="panel panel-default courseHome"> 4 <div class="panel panel-default courseHome">
5 <div class="panel-body"> 5 <div class="panel-body">
6 <p>{{ course }}</p> 6 <p>{{ course }}</p>
app/templates/home_teacher_student_content.html
@@ -0,0 +1,19 @@ @@ -0,0 +1,19 @@
  1 +{% load i18n %}
  2 +
  3 +{% for notification in objects %}
  4 + <li {% if not notification.read %}class="not_read"{% endif %}>
  5 + <div class="avatar">
  6 + <img src="{{ notification.user.image.url }}">
  7 + </div>
  8 + <div class="bubble-container">
  9 + <div class="bubble">
  10 + <div class="retweet" style="color: white">
  11 + {{ notification.datetime }}
  12 + </div>
  13 + <h3>{{ notification.user }}</h3> - <h3>{{ notification.action_resource }}</h3><br/>
  14 + <a href="{% url 'core:notification_read' notification.id %}">{{ notification }}</a>
  15 + </div>
  16 + <div class="arrow"></div>
  17 + </div>
  18 + </li>
  19 +{% endfor %}
0 \ No newline at end of file 20 \ No newline at end of file
@@ -15,7 +15,7 @@ class AppIndex(LoginRequiredMixin, LogMixin, ListView, NotificationMixin): @@ -15,7 +15,7 @@ class AppIndex(LoginRequiredMixin, LogMixin, ListView, NotificationMixin):
15 redirect_field_name = 'next' 15 redirect_field_name = 'next'
16 16
17 template_name = "home.html" 17 template_name = "home.html"
18 - context_object_name = 'courses' 18 + context_object_name = 'objects'
19 paginate_by = 10 19 paginate_by = 10
20 20
21 not_action = "Acessar" 21 not_action = "Acessar"
@@ -25,7 +25,7 @@ class AppIndex(LoginRequiredMixin, LogMixin, ListView, NotificationMixin): @@ -25,7 +25,7 @@ class AppIndex(LoginRequiredMixin, LogMixin, ListView, NotificationMixin):
25 if self.request.user.is_staff: 25 if self.request.user.is_staff:
26 objects = Course.objects.all() 26 objects = Course.objects.all()
27 else: 27 else:
28 - objects = Notification.objects.filter(user = self.request.user) 28 + objects = Notification.objects.filter(user = self.request.user).order_by('-datetime')
29 29
30 return objects 30 return objects
31 31
@@ -45,10 +45,6 @@ class AppIndex(LoginRequiredMixin, LogMixin, ListView, NotificationMixin): @@ -45,10 +45,6 @@ class AppIndex(LoginRequiredMixin, LogMixin, ListView, NotificationMixin):
45 45
46 46
47 super(AppIndex, self).createNotification("teste", not_resource="home", resource_link="/register") 47 super(AppIndex, self).createNotification("teste", not_resource="home", resource_link="/register")
48 -  
49 - notifications = Notification.objects.filter(user= self.request.user, read=False)  
50 - context['notifications'] = notifications  
51 -  
52 return self.response_class(request = self.request, template = self.template_name, context = context, using = self.template_engine, **response_kwargs) 48 return self.response_class(request = self.request, template = self.template_name, context = context, using = self.template_engine, **response_kwargs)
53 49
54 50
core/context_processors.py 0 → 100644
@@ -0,0 +1,9 @@ @@ -0,0 +1,9 @@
  1 +from .models import Notification
  2 +
  3 +def notifications(request):
  4 + if request.user.is_authenticated:
  5 + return {
  6 + 'notifications': Notification.objects.filter(user= request.user, read=False).order_by('-datetime')
  7 + }
  8 + else:
  9 + return request
0 \ No newline at end of file 10 \ No newline at end of file
core/static/css/base/amadeus.css
@@ -115,7 +115,7 @@ ul { @@ -115,7 +115,7 @@ ul {
115 margin-bottom: 2em; } 115 margin-bottom: 2em; }
116 .timeline li { 116 .timeline li {
117 padding: 1em 0; } 117 padding: 1em 0; }
118 - .timeline li:nth-child(even) { 118 + .timeline li.not_read {
119 background-color: #d3d7d8; } 119 background-color: #d3d7d8; }
120 120
121 .avatar { 121 .avatar {
core/static/css/base/header.css
@@ -21,6 +21,10 @@ @@ -21,6 +21,10 @@
21 transform:scale(1.1); 21 transform:scale(1.1);
22 } 22 }
23 23
  24 +.notification-count{
  25 + background-color: #cc0000;
  26 +}
  27 +
24 /* ID */ 28 /* ID */
25 29
26 .notifications{ 30 .notifications{
core/templates/base.html
@@ -53,7 +53,7 @@ @@ -53,7 +53,7 @@
53 <div class="navbar-collapse collapse navbar-responsive-collapse"> 53 <div class="navbar-collapse collapse navbar-responsive-collapse">
54 <ul class="nav navbar-nav navbar-right notifications"> 54 <ul class="nav navbar-nav navbar-right notifications">
55 <li class="" data-toggle="tooltip" data-placement="bottom" title data-original-title="notifications"> 55 <li class="" data-toggle="tooltip" data-placement="bottom" title data-original-title="notifications">
56 - <a class="dropdown-toggle" data-toggle="dropdown"><i class="fa fa-bell-o" aria-hidden="true"></i></a> 56 + <a class="dropdown-toggle" data-toggle="dropdown"> <span class="badge notification-count">{{notifications.count}}</span><i class="fa fa-bell-o" aria-hidden="true"></i></a>
57 <ul class="dropdown-menu"> 57 <ul class="dropdown-menu">
58 <li class="dropdown-header">Notifications</li> 58 <li class="dropdown-header">Notifications</li>
59 {% for notification in notifications %} 59 {% for notification in notifications %}
logs/log_file_02-09-2016.txt
@@ -1,6 +0,0 @@ @@ -1,6 +0,0 @@
1 -02/09/2016 23:34:45 - zambom - Entrou no sistema  
2 -02/09/2016 23:34:45 - zambom - Acessou home  
3 -02/09/2016 23:55:55 - jailson - Entrou no sistema  
4 -02/09/2016 23:55:55 - jailson - Acessou home  
5 -02/09/2016 23:56:05 - jailson - Acessou home  
6 -02/09/2016 23:56:25 - jailson - Acessou home  
logs/log_file_03-09-2016.txt
@@ -1,3 +0,0 @@ @@ -1,3 +0,0 @@
1 -03/09/2016 20:13:26 - zambom - Entrou no sistema  
2 -03/09/2016 20:13:26 - zambom - Acessou home  
3 -03/09/2016 20:13:45 - zambom - Acessou home  
logs/log_file_05-09-2016.txt
@@ -1,52 +0,0 @@ @@ -1,52 +0,0 @@
1 -05/09/2016 02:41:58 - matheuslins - Entrou no sistema  
2 -05/09/2016 02:41:58 - matheuslins - Acessou home  
3 -05/09/2016 02:43:00 - matheuslins - Acessou home  
4 -05/09/2016 02:43:14 - matheuslins - Entrou no sistema  
5 -05/09/2016 02:43:14 - matheuslins - Acessou home  
6 -05/09/2016 02:43:18 - matheuslins - Acessou home  
7 -05/09/2016 02:44:46 - matheuslins - Acessou home  
8 -05/09/2016 02:45:32 - matheuslins - Entrou no sistema  
9 -05/09/2016 02:45:32 - matheuslins - Acessou home  
10 -05/09/2016 03:09:26 - matheuslins - Acessou home  
11 -05/09/2016 03:09:29 - matheuslins - Acessou home  
12 -05/09/2016 03:11:13 - matheuslins - Acessou home  
13 -05/09/2016 04:07:13 - test - Entrou no sistema  
14 -05/09/2016 04:07:13 - test - Acessou home  
15 -05/09/2016 04:08:48 - test - Entrou no sistema  
16 -05/09/2016 04:08:48 - test - Acessou home  
17 -05/09/2016 04:09:55 - test - Entrou no sistema  
18 -05/09/2016 04:09:55 - test - Acessou home  
19 -05/09/2016 04:12:37 - test - Entrou no sistema  
20 -05/09/2016 04:12:37 - test - Acessou home  
21 -05/09/2016 04:13:00 - test - Entrou no sistema  
22 -05/09/2016 04:13:00 - test - Acessou home  
23 -05/09/2016 04:13:23 - test - Entrou no sistema  
24 -05/09/2016 04:13:23 - test - Acessou home  
25 -05/09/2016 04:15:02 - test - Entrou no sistema  
26 -05/09/2016 04:15:02 - test - Acessou home  
27 -05/09/2016 04:20:19 - matheuslins - Entrou no sistema  
28 -05/09/2016 04:20:19 - matheuslins - Acessou home  
29 -05/09/2016 04:21:11 - matheuslins - Acessou home  
30 -05/09/2016 04:36:46 - test - Entrou no sistema  
31 -05/09/2016 04:36:46 - test - Acessou home  
32 -05/09/2016 04:37:23 - test - Entrou no sistema  
33 -05/09/2016 04:37:23 - test - Acessou home  
34 -05/09/2016 04:37:41 - test - Entrou no sistema  
35 -05/09/2016 04:37:41 - test - Acessou home  
36 -05/09/2016 04:38:01 - test - Entrou no sistema  
37 -05/09/2016 04:38:01 - test - Acessou home  
38 -05/09/2016 04:38:23 - test - Entrou no sistema  
39 -05/09/2016 04:38:23 - test - Acessou home  
40 -05/09/2016 04:38:39 - test - Entrou no sistema  
41 -05/09/2016 04:38:39 - test - Acessou home  
42 -05/09/2016 04:39:39 - test - Entrou no sistema  
43 -05/09/2016 04:39:39 - test - Acessou home  
44 -05/09/2016 04:40:28 - matheuslins - Acessou home  
45 -05/09/2016 15:14:48 - matheuslins - Acessou home  
46 -05/09/2016 15:28:49 - zambom - Acessou home  
47 -05/09/2016 15:29:02 - zambom - Entrou no sistema  
48 -05/09/2016 15:29:02 - zambom - Acessou home  
49 -05/09/2016 15:31:13 - zambom - Entrou no sistema  
50 -05/09/2016 15:31:13 - zambom - Acessou home  
51 -05/09/2016 20:20:12 - admin - Entrou no sistema  
52 -05/09/2016 20:20:13 - admin - Acessou home  
53 \ No newline at end of file 0 \ No newline at end of file
logs/log_file_06-09-2016.txt
@@ -1,100 +0,0 @@ @@ -1,100 +0,0 @@
1 -06/09/2016 00:07:02 - teste - Entrou no sistema  
2 -06/09/2016 00:07:02 - teste - Acessou home  
3 -06/09/2016 00:08:58 - teste - Acessou home  
4 -06/09/2016 01:01:27 - test - Entrou no sistema  
5 -06/09/2016 01:01:27 - test - Acessou home  
6 -06/09/2016 01:05:49 - test - Entrou no sistema  
7 -06/09/2016 01:05:49 - test - Acessou home  
8 -06/09/2016 01:07:43 - test - Entrou no sistema  
9 -06/09/2016 01:07:43 - test - Acessou home  
10 -06/09/2016 01:08:45 - test - Entrou no sistema  
11 -06/09/2016 01:08:45 - test - Acessou home  
12 -06/09/2016 01:11:30 - test - Entrou no sistema  
13 -06/09/2016 01:11:30 - test - Acessou home  
14 -06/09/2016 01:12:02 - test - Entrou no sistema  
15 -06/09/2016 01:12:02 - test - Acessou home  
16 -06/09/2016 01:13:00 - test - Entrou no sistema  
17 -06/09/2016 01:13:00 - test - Acessou home  
18 -06/09/2016 01:16:27 - test - Entrou no sistema  
19 -06/09/2016 01:16:27 - test - Acessou home  
20 -06/09/2016 01:17:35 - test - Entrou no sistema  
21 -06/09/2016 01:17:35 - test - Acessou home  
22 -06/09/2016 01:18:15 - test - Entrou no sistema  
23 -06/09/2016 01:18:15 - test - Acessou home  
24 -06/09/2016 01:22:19 - test - Entrou no sistema  
25 -06/09/2016 01:22:19 - test - Acessou home  
26 -06/09/2016 01:25:09 - test - Entrou no sistema  
27 -06/09/2016 01:25:09 - test - Acessou home  
28 -06/09/2016 01:25:35 - test - Entrou no sistema  
29 -06/09/2016 01:25:35 - test - Acessou home  
30 -06/09/2016 01:26:40 - test - Entrou no sistema  
31 -06/09/2016 01:26:40 - test - Acessou home  
32 -06/09/2016 01:27:40 - test - Entrou no sistema  
33 -06/09/2016 01:27:40 - test - Acessou home  
34 -06/09/2016 01:28:50 - test - Entrou no sistema  
35 -06/09/2016 01:28:50 - test - Acessou home  
36 -06/09/2016 01:30:51 - test - Entrou no sistema  
37 -06/09/2016 01:30:51 - test - Acessou home  
38 -06/09/2016 01:41:51 - test - Entrou no sistema  
39 -06/09/2016 01:41:51 - test - Acessou home  
40 -06/09/2016 01:43:59 - test - Entrou no sistema  
41 -06/09/2016 01:43:59 - test - Acessou home  
42 -06/09/2016 01:45:22 - test - Entrou no sistema  
43 -06/09/2016 01:45:22 - test - Acessou home  
44 -06/09/2016 01:45:51 - test - Entrou no sistema  
45 -06/09/2016 01:45:51 - test - Acessou home  
46 -06/09/2016 01:46:02 - test - Entrou no sistema  
47 -06/09/2016 01:46:02 - test - Acessou home  
48 -06/09/2016 01:46:18 - test - Entrou no sistema  
49 -06/09/2016 01:46:18 - test - Acessou home  
50 -06/09/2016 01:46:28 - test - Entrou no sistema  
51 -06/09/2016 01:46:28 - test - Acessou home  
52 -06/09/2016 02:39:03 - test - Entrou no sistema  
53 -06/09/2016 02:39:03 - test - Acessou home  
54 -06/09/2016 02:39:41 - test - Entrou no sistema  
55 -06/09/2016 02:39:41 - test - Acessou home  
56 -06/09/2016 02:40:57 - test - Entrou no sistema  
57 -06/09/2016 02:40:57 - test - Acessou home  
58 -06/09/2016 02:41:50 - test - Entrou no sistema  
59 -06/09/2016 02:41:50 - test - Acessou home  
60 -06/09/2016 02:46:53 - test - Entrou no sistema  
61 -06/09/2016 02:46:53 - test - Acessou home  
62 -06/09/2016 02:47:14 - test - Entrou no sistema  
63 -06/09/2016 02:47:14 - test - Acessou home  
64 -06/09/2016 02:50:33 - test - Entrou no sistema  
65 -06/09/2016 02:50:33 - test - Acessou home  
66 -06/09/2016 02:52:54 - test - Entrou no sistema  
67 -06/09/2016 02:52:54 - test - Acessou home  
68 -06/09/2016 02:57:03 - test - Entrou no sistema  
69 -06/09/2016 02:57:03 - test - Acessou home  
70 -06/09/2016 03:02:15 - test - Entrou no sistema  
71 -06/09/2016 03:02:15 - test - Acessou home  
72 -06/09/2016 16:20:42 - test - Entrou no sistema  
73 -06/09/2016 16:20:42 - test - Acessou home  
74 -06/09/2016 16:29:26 - test - Entrou no sistema  
75 -06/09/2016 16:29:26 - test - Acessou home  
76 -06/09/2016 16:31:14 - test - Entrou no sistema  
77 -06/09/2016 16:31:14 - test - Acessou home  
78 -06/09/2016 16:33:06 - test - Entrou no sistema  
79 -06/09/2016 16:33:06 - test - Acessou home  
80 -06/09/2016 16:33:26 - test - Entrou no sistema  
81 -06/09/2016 16:33:26 - test - Acessou home  
82 -06/09/2016 16:33:36 - test - Entrou no sistema  
83 -06/09/2016 16:33:36 - test - Acessou home  
84 -06/09/2016 16:34:10 - test - Entrou no sistema  
85 -06/09/2016 16:34:10 - test - Acessou home  
86 -06/09/2016 16:34:29 - test - Entrou no sistema  
87 -06/09/2016 16:34:29 - test - Acessou home  
88 -06/09/2016 21:30:40 - test - Entrou no sistema  
89 -06/09/2016 21:30:40 - test - Acessou home  
90 -06/09/2016 21:32:32 - test - Entrou no sistema  
91 -06/09/2016 21:32:32 - test - Acessou home  
92 -06/09/2016 21:34:11 - test - Entrou no sistema  
93 -06/09/2016 21:34:11 - test - Acessou home  
94 -06/09/2016 21:38:44 - test - Entrou no sistema  
95 -06/09/2016 21:38:44 - test - Acessou home  
96 -06/09/2016 21:58:49 - jailson - Entrou no sistema  
97 -06/09/2016 21:58:49 - jailson - Acessou home  
98 -06/09/2016 21:59:05 - jailson - Acessou home  
99 -06/09/2016 21:59:35 - jailson - Acessou home  
100 -06/09/2016 21:59:42 - jailson - Acessou home  
logs/log_file_07-09-2016.txt
@@ -1,10 +0,0 @@ @@ -1,10 +0,0 @@
1 -07/09/2016 17:10:46 - matheuslins - Entrou no sistema  
2 -07/09/2016 17:10:46 - matheuslins - Acessou home  
3 -07/09/2016 17:10:58 - matheuslins - Acessou home  
4 -07/09/2016 17:12:12 - matheuslins - Acessou home  
5 -07/09/2016 17:12:15 - matheuslins - Acessou home  
6 -07/09/2016 17:12:24 - matheuslins - Acessou home  
7 -07/09/2016 17:17:16 - matheuslins - Entrou no sistema  
8 -07/09/2016 17:17:16 - matheuslins - Acessou home  
9 -07/09/2016 17:24:09 - test - Entrou no sistema  
10 -07/09/2016 17:24:09 - test - Acessou home