Commit 144f2671879d25aec70fe7055220c141c5086a53
Exists in
master
and in
5 other branches
Merge in dev
Showing
61 changed files
with
1011 additions
and
678 deletions
Show diff stats
amadeus/roles.py
@@ -0,0 +1,43 @@ | @@ -0,0 +1,43 @@ | ||
1 | +//controles do modal | ||
2 | +$(window).ready(function() { // utilizado para abrir o modal quando tiver tido algum erro no preenchimento do formulario | ||
3 | + if($('.not_submited').length){ | ||
4 | + $('#poll').modal('show'); | ||
5 | + } | ||
6 | +}); | ||
7 | +var Answer = { | ||
8 | + init: function(url) { // utilizado para adicionar um novo campo de resposta | ||
9 | + $.get(url, function(data){ | ||
10 | + $("#form").append(data); | ||
11 | + var cont = 1; | ||
12 | + $("#form div div div input").each(function(){ | ||
13 | + $(this).attr('name',cont++); | ||
14 | + }); | ||
15 | + }); | ||
16 | + } | ||
17 | +}; | ||
18 | + | ||
19 | +var Submite = { | ||
20 | + post: function(url,dados){ | ||
21 | + $('#poll').modal('hide'); | ||
22 | + $.post(url,dados, function(data){ | ||
23 | + }).fail(function(data){ | ||
24 | + $("div.modal-backdrop.fade.in").remove(); | ||
25 | + $("#modal_poll").empty(); | ||
26 | + $("#modal_poll").append(data.responseText); | ||
27 | + }); | ||
28 | + }, | ||
29 | + remove: function(url,dados, id_li_link){ | ||
30 | + $('#poll').modal('hide'); | ||
31 | + $.post(url,dados, function(data){ | ||
32 | + $(id_li_link).remove(); | ||
33 | + $("#modal_poll").empty(); | ||
34 | + $("div.modal-backdrop.fade.in").remove(); | ||
35 | + }).fail(function(){ | ||
36 | + $("#modal_poll").empty(); | ||
37 | + $("#modal_poll").append(data); | ||
38 | + $('#poll').modal('show'); | ||
39 | + }); | ||
40 | + } | ||
41 | +} | ||
42 | + | ||
43 | +alert("essfd"); |
@@ -0,0 +1,14 @@ | @@ -0,0 +1,14 @@ | ||
1 | +var Modal = { | ||
2 | + get: function (url, id_modal, id_div_modal){ | ||
3 | + $.get(url, function(data){ | ||
4 | + if($(id_modal).length){ | ||
5 | + $(id_div_modal).empty(); | ||
6 | + $(id_div_modal).append(data); | ||
7 | + } else { | ||
8 | + $(id_div_modal).append(data); | ||
9 | + } | ||
10 | + $(id_modal).modal('show'); | ||
11 | + }); | ||
12 | + } | ||
13 | +}; | ||
14 | +alert("req"); |
@@ -0,0 +1,12 @@ | @@ -0,0 +1,12 @@ | ||
1 | +//deve ser importado apenas depois do html | ||
2 | +$( "#form" ).sortable({ // utilizado para fazer a re-organização das respostas | ||
3 | + delay: 100, | ||
4 | + distance: 5, | ||
5 | + update: function( event, ui ) { | ||
6 | + var cont = 1; | ||
7 | + $("#form div div div input").each(function(){ | ||
8 | + $(this).attr('name',cont++); | ||
9 | + }); | ||
10 | + }, | ||
11 | +}); | ||
12 | +alert("sort"); |
app/templates/app/base.html
@@ -1,22 +0,0 @@ | @@ -1,22 +0,0 @@ | ||
1 | -{% extends 'base.html' %} | ||
2 | - | ||
3 | -{% load static i18n %} | ||
4 | - | ||
5 | -{% block menu_top %} | ||
6 | - <ul class="nav navbar-nav"> | ||
7 | - <li class="active"> | ||
8 | - <a href="{% url 'home' %}">Home</a> | ||
9 | - </li> | ||
10 | - <li><a href="#contact">{% trans 'The Project' %}</a></li> | ||
11 | - <li><a href="#contact">{% trans 'CCTE Group' %}</a></li> | ||
12 | - <li class="divider-vertical"></li> | ||
13 | - <li class="dropdown"> | ||
14 | - <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">{% trans 'Hi' %}, {{ user }} <span class="caret"></span></a> | ||
15 | - <ul class="dropdown-menu"> | ||
16 | - <li><a href="{% url 'app:users:profile' %}">{% trans 'See Profile' %}</a></li> | ||
17 | - <li><a href="#">{% trans 'Settings' %}</a></li> | ||
18 | - <li><a href="{% url 'logout' %}">{% trans 'Logout' %}</a></li> | ||
19 | - </ul> | ||
20 | - </li> | ||
21 | - </ul> | ||
22 | -{% endblock %} | ||
23 | \ No newline at end of file | 0 | \ No newline at end of file |
app/templates/app/index.html
@@ -1,181 +0,0 @@ | @@ -1,181 +0,0 @@ | ||
1 | -{% extends 'app/base.html' %} | ||
2 | - | ||
3 | -{% load static i18n permission_tags %} | ||
4 | - | ||
5 | -{% block sidebar %} | ||
6 | - <h4>{% trans 'You have:' %} </h4> | ||
7 | - <div class="list-group"> | ||
8 | - <a href="#" class="list-group-item"> | ||
9 | - <span class="badge">4</span> | ||
10 | - {% trans 'Pending Tasks' %} | ||
11 | - </a> | ||
12 | - <a href="#" class="list-group-item"> | ||
13 | - <span class="badge">0</span> | ||
14 | - {% trans 'Users Online' %} | ||
15 | - </a> | ||
16 | - </div> | ||
17 | - | ||
18 | - <hr /> | ||
19 | - | ||
20 | - <h4>{% trans 'You can:' %} </h4> | ||
21 | - <div class="list-group"> | ||
22 | - {% if user|has_role:'professor' %} | ||
23 | - <a href="{% url 'course:create' %}" class="list-group-item"> | ||
24 | - {% trans 'Create Course' %} | ||
25 | - </a> | ||
26 | - {% endif %} | ||
27 | - {% if user|has_role:'professor' %} | ||
28 | - <a href="{% url 'users:manage' %}" class="list-group-item"> | ||
29 | - {% trans 'Manage Users' %} | ||
30 | - </a> | ||
31 | - {% endif %} | ||
32 | - <a href="{% url 'course:manage' %}" class="list-group-item"> | ||
33 | - {% trans 'Manage Courses' %} | ||
34 | - </a> | ||
35 | - {% if user|has_role:'professor' %} | ||
36 | - <a href="{% url 'course:manage_cat' %}" class="list-group-item"> | ||
37 | - {% trans 'Gerenciar Categorias' %} | ||
38 | - </a> | ||
39 | - {% endif %} | ||
40 | - </div> | ||
41 | - | ||
42 | - <hr /> | ||
43 | - | ||
44 | - {% if user|has_role:'student' %} | ||
45 | - <h4>{% trans 'Your course(s):' %}</h4> | ||
46 | - <p>{% trans 'No courses subscribed yet' %}</p> | ||
47 | - {% endif %} | ||
48 | -{% endblock %} | ||
49 | - | ||
50 | -{% block content %} | ||
51 | - <div class="row"> | ||
52 | - <div class="col-sm-12"> | ||
53 | - <form class="form-horizontal" method="post"> | ||
54 | - <div class="col-sm-10"> | ||
55 | - <div class="form-group"> | ||
56 | - <label for="search_keyword" class="control-label col-sm-3">{% trans 'Search course:' %} </label> | ||
57 | - <div class="col-sm-9"> | ||
58 | - <input type="text" class="form-control input-sm" id="search_keyword" /> | ||
59 | - </div> | ||
60 | - </div> | ||
61 | - </div> | ||
62 | - <button type="submit" class="btn btn-sm btn-success">{% trans 'Search' %}</button> | ||
63 | - </form> | ||
64 | - | ||
65 | - <hr /> | ||
66 | - | ||
67 | - <h5>{% trans 'Most popular keywords:' %}</h5> | ||
68 | - <div class="well"> | ||
69 | - <center> | ||
70 | - <ul class="cloud"> | ||
71 | - <li> | ||
72 | - <a href=""> | ||
73 | - teste amadeus prospb | ||
74 | - </a> | ||
75 | - </li> | ||
76 | - <li> | ||
77 | - <a href=""> | ||
78 | - programação fácil | ||
79 | - </a> | ||
80 | - </li> | ||
81 | - <li> | ||
82 | - <a href=""> | ||
83 | - intermediário | ||
84 | - </a> | ||
85 | - </li> | ||
86 | - <li> | ||
87 | - <a href=""> | ||
88 | - amadeus | ||
89 | - </a> | ||
90 | - </li> | ||
91 | - <li> | ||
92 | - <a href=""> | ||
93 | - palavra02 | ||
94 | - </a> | ||
95 | - </li> | ||
96 | - <li> | ||
97 | - <a href=""> | ||
98 | - programação para iniciantes | ||
99 | - </a> | ||
100 | - </li> | ||
101 | - <li> | ||
102 | - <a href=""> | ||
103 | - django | ||
104 | - </a> | ||
105 | - </li> | ||
106 | - <li> | ||
107 | - <a href=""> | ||
108 | - aluno teste | ||
109 | - </a> | ||
110 | - </li> | ||
111 | - <li> | ||
112 | - <a href=""> | ||
113 | - curso0101 | ||
114 | - </a> | ||
115 | - </li> | ||
116 | - <li> | ||
117 | - <a href=""> | ||
118 | - kjsdnksa | ||
119 | - </a> | ||
120 | - </li> | ||
121 | - <li> | ||
122 | - <a href=""> | ||
123 | - palavra01 | ||
124 | - </a> | ||
125 | - </li> | ||
126 | - <li> | ||
127 | - <a href=""> | ||
128 | - programming | ||
129 | - </a> | ||
130 | - </li> | ||
131 | - <li> | ||
132 | - <a href=""> | ||
133 | - python | ||
134 | - </a> | ||
135 | - </li> | ||
136 | - <li> | ||
137 | - <a href=""> | ||
138 | - curso | ||
139 | - </a> | ||
140 | - </li> | ||
141 | - <li> | ||
142 | - <a href=""> | ||
143 | - mvc | ||
144 | - </a> | ||
145 | - </li> | ||
146 | - <li> | ||
147 | - <a href=""> | ||
148 | - programação web | ||
149 | - </a> | ||
150 | - </li> | ||
151 | - <li> | ||
152 | - <a href=""> | ||
153 | - ionic | ||
154 | - </a> | ||
155 | - </li> | ||
156 | - <li> | ||
157 | - <a href=""> | ||
158 | - framework | ||
159 | - </a> | ||
160 | - </li> | ||
161 | - <li> | ||
162 | - <a href=""> | ||
163 | - web | ||
164 | - </a> | ||
165 | - </li> | ||
166 | - <li> | ||
167 | - <a href=""> | ||
168 | - android | ||
169 | - </a> | ||
170 | - </li> | ||
171 | - <li> | ||
172 | - <a href=""> | ||
173 | - programação | ||
174 | - </a> | ||
175 | - </li> | ||
176 | - </ul> | ||
177 | - </center> | ||
178 | - </div> | ||
179 | - </div> | ||
180 | - </div> | ||
181 | -{% endblock %} |
app/templates/home.html
@@ -119,11 +119,11 @@ | @@ -119,11 +119,11 @@ | ||
119 | </div> | 119 | </div> |
120 | 120 | ||
121 | {% else %} | 121 | {% else %} |
122 | - <ul class="timeline" style="-webkit-padding-start: 0px"> | 122 | + |
123 | <div id="timeline"> | 123 | <div id="timeline"> |
124 | {% include page_template %} | 124 | {% include page_template %} |
125 | </div> | 125 | </div> |
126 | - </ul> | 126 | + |
127 | {% endif %} | 127 | {% endif %} |
128 | 128 | ||
129 | <div id="loading" class="alert alert-primary" role="alert" style="display: none"> | 129 | <div id="loading" class="alert alert-primary" role="alert" style="display: none"> |
app/templates/home_teacher_student_content.html
1 | {% load static i18n %} | 1 | {% load static i18n %} |
2 | 2 | ||
3 | {% for notification in objects %} | 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 }}"> | 4 | + |
5 | + | ||
6 | + <div class="well timeLine"> | ||
7 | + <div class="row"> | ||
8 | + <div class="col-md-12"> | ||
9 | + <p><a href="#"></a></p><h6><a href="#"><i>Default Path to Notification</i></a></h6><p></p> | ||
10 | + </div> | ||
11 | + </div> | ||
12 | + <div class="row"> | ||
13 | + <div class="col-xs-2 col-md-1"> | ||
14 | + <img class="imgTimeLine" src="{{ notification.user.image_url }}"> | ||
7 | </div> | 15 | </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> | 16 | + <div class="col-xs-10 col-md-11"> |
17 | + <i class="fa fa-pencil-square-o" aria-hidden="true"></i> | ||
18 | + <a href=""><h4 class="resource_inline"><b>{{ notification.user }}</b></h4></a> | ||
19 | + <p class="resource_inline">{{notification.message}} em : <a href="{% url 'core:notification_read' notification.id %}">Recurso</a></p> | ||
20 | + <p class="timePost"><i> {{ notification.datetime|timesince }} {% trans "ago" %} </i></p> | ||
17 | </div> | 21 | </div> |
18 | - </li> | 22 | + </div> |
23 | +</div> | ||
19 | {% endfor %} | 24 | {% endfor %} |
20 | 25 |
core/admin.py
1 | from django.contrib import admin | 1 | from django.contrib import admin |
2 | - | ||
3 | from .models import Action, Resource, Action_Resource, Log, MimeType | 2 | from .models import Action, Resource, Action_Resource, Log, MimeType |
4 | 3 | ||
5 | class ActionAdmin(admin.ModelAdmin): | 4 | class ActionAdmin(admin.ModelAdmin): |
@@ -18,8 +17,12 @@ class LogAdmin(admin.ModelAdmin): | @@ -18,8 +17,12 @@ class LogAdmin(admin.ModelAdmin): | ||
18 | list_display = ['datetime', 'user', 'action_resource'] | 17 | list_display = ['datetime', 'user', 'action_resource'] |
19 | search_fields = ['user'] | 18 | search_fields = ['user'] |
20 | 19 | ||
20 | +class MimeTypeAdmin(admin.ModelAdmin): | ||
21 | + list_display = ['typ', 'icon'] | ||
22 | + search_fields = ['typ', 'icon'] | ||
23 | + | ||
21 | admin.site.register(Action, ActionAdmin) | 24 | admin.site.register(Action, ActionAdmin) |
22 | admin.site.register(Resource, ResourceAdmin) | 25 | admin.site.register(Resource, ResourceAdmin) |
23 | admin.site.register(Action_Resource, ActionResourceAdmin) | 26 | admin.site.register(Action_Resource, ActionResourceAdmin) |
24 | admin.site.register(Log, LogAdmin) | 27 | admin.site.register(Log, LogAdmin) |
25 | -admin.site.register(MimeType) | ||
26 | \ No newline at end of file | 28 | \ No newline at end of file |
29 | +admin.site.register(MimeType, MimeTypeAdmin) |
core/migrations/0001_initial.py
1 | # -*- coding: utf-8 -*- | 1 | # -*- coding: utf-8 -*- |
2 | -# Generated by Django 1.10 on 2016-10-17 12:25 | 2 | +# Generated by Django 1.10 on 2016-10-18 02:46 |
3 | from __future__ import unicode_literals | 3 | from __future__ import unicode_literals |
4 | 4 | ||
5 | import autoslug.fields | 5 | import autoslug.fields |
@@ -25,8 +25,8 @@ class Migration(migrations.Migration): | @@ -25,8 +25,8 @@ class Migration(migrations.Migration): | ||
25 | ('created_date', models.DateField(auto_now_add=True, verbose_name='Created Date')), | 25 | ('created_date', models.DateField(auto_now_add=True, verbose_name='Created Date')), |
26 | ], | 26 | ], |
27 | options={ | 27 | options={ |
28 | - 'verbose_name_plural': 'Actions', | ||
29 | 'verbose_name': 'Action', | 28 | 'verbose_name': 'Action', |
29 | + 'verbose_name_plural': 'Actions', | ||
30 | }, | 30 | }, |
31 | ), | 31 | ), |
32 | migrations.CreateModel( | 32 | migrations.CreateModel( |
@@ -36,8 +36,8 @@ class Migration(migrations.Migration): | @@ -36,8 +36,8 @@ class Migration(migrations.Migration): | ||
36 | ('action', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.Action', verbose_name='Action_Applied')), | 36 | ('action', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.Action', verbose_name='Action_Applied')), |
37 | ], | 37 | ], |
38 | options={ | 38 | options={ |
39 | - 'verbose_name_plural': 'Action_Resources', | ||
40 | 'verbose_name': 'Action_Resource', | 39 | 'verbose_name': 'Action_Resource', |
40 | + 'verbose_name_plural': 'Action_Resources', | ||
41 | }, | 41 | }, |
42 | ), | 42 | ), |
43 | migrations.CreateModel( | 43 | migrations.CreateModel( |
@@ -49,8 +49,8 @@ class Migration(migrations.Migration): | @@ -49,8 +49,8 @@ class Migration(migrations.Migration): | ||
49 | ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL, verbose_name='Actor')), | 49 | ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL, verbose_name='Actor')), |
50 | ], | 50 | ], |
51 | options={ | 51 | options={ |
52 | - 'verbose_name_plural': 'Logs', | ||
53 | 'verbose_name': 'Log', | 52 | 'verbose_name': 'Log', |
53 | + 'verbose_name_plural': 'Logs', | ||
54 | }, | 54 | }, |
55 | ), | 55 | ), |
56 | migrations.CreateModel( | 56 | migrations.CreateModel( |
@@ -61,8 +61,8 @@ class Migration(migrations.Migration): | @@ -61,8 +61,8 @@ class Migration(migrations.Migration): | ||
61 | ('icon', models.CharField(max_length=50, unique=True, verbose_name='Icon')), | 61 | ('icon', models.CharField(max_length=50, unique=True, verbose_name='Icon')), |
62 | ], | 62 | ], |
63 | options={ | 63 | options={ |
64 | - 'verbose_name_plural': 'Amadeus Mime Types', | ||
65 | 'verbose_name': 'Amadeus Mime Type', | 64 | 'verbose_name': 'Amadeus Mime Type', |
65 | + 'verbose_name_plural': 'Amadeus Mime Types', | ||
66 | }, | 66 | }, |
67 | ), | 67 | ), |
68 | migrations.CreateModel( | 68 | migrations.CreateModel( |
@@ -77,8 +77,8 @@ class Migration(migrations.Migration): | @@ -77,8 +77,8 @@ class Migration(migrations.Migration): | ||
77 | ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='notification_Actor', to=settings.AUTH_USER_MODEL, verbose_name='User')), | 77 | ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='notification_Actor', to=settings.AUTH_USER_MODEL, verbose_name='User')), |
78 | ], | 78 | ], |
79 | options={ | 79 | options={ |
80 | - 'verbose_name_plural': 'Notifications', | ||
81 | 'verbose_name': 'Notification', | 80 | 'verbose_name': 'Notification', |
81 | + 'verbose_name_plural': 'Notifications', | ||
82 | }, | 82 | }, |
83 | ), | 83 | ), |
84 | migrations.CreateModel( | 84 | migrations.CreateModel( |
@@ -91,8 +91,8 @@ class Migration(migrations.Migration): | @@ -91,8 +91,8 @@ class Migration(migrations.Migration): | ||
91 | ('url', models.CharField(default='', max_length=100, verbose_name='URL')), | 91 | ('url', models.CharField(default='', max_length=100, verbose_name='URL')), |
92 | ], | 92 | ], |
93 | options={ | 93 | options={ |
94 | - 'verbose_name_plural': 'Resources', | ||
95 | 'verbose_name': 'Resource', | 94 | 'verbose_name': 'Resource', |
95 | + 'verbose_name_plural': 'Resources', | ||
96 | }, | 96 | }, |
97 | ), | 97 | ), |
98 | migrations.AddField( | 98 | migrations.AddField( |
@@ -0,0 +1,315 @@ | @@ -0,0 +1,315 @@ | ||
1 | +.navbar .logo {position: absolute; top: 6px; text-align: center; height: 48px; width: 48px;} | ||
2 | + | ||
3 | +/* Modal */ | ||
4 | +.modal-header {min-height: 60px; border-bottom: 1px solid #E6E7E8 !important; padding-bottom: 15px !important;} | ||
5 | +.modal-footer {text-align: right; padding-top: 5px !important; border-top: 1px solid #E6E7E8 !important;} | ||
6 | + | ||
7 | +/* HEADER */ | ||
8 | +#notification-dropdown{ | ||
9 | + max-height: 500%; | ||
10 | + overflow: auto; | ||
11 | + width: 200px; | ||
12 | +} | ||
13 | + | ||
14 | +/* HEADER */ | ||
15 | + | ||
16 | + | ||
17 | +.logoLogin{ | ||
18 | + padding-bottom: 1%; | ||
19 | + width: 15%; | ||
20 | +} | ||
21 | +.navigation{ | ||
22 | + margin: 10% 10% 5% 5%; | ||
23 | +} | ||
24 | +.breadcrumb{ | ||
25 | + margin-bottom: 5px; | ||
26 | +} | ||
27 | +.courseHome{ | ||
28 | + text-align: center; | ||
29 | +} | ||
30 | +.courseHome ul{ | ||
31 | + list-style-type: none; | ||
32 | + margin: 0; | ||
33 | + padding: 0; | ||
34 | + overflow: hidden; | ||
35 | + margin-left: 2%; | ||
36 | +} | ||
37 | +.courseHome ul li{ | ||
38 | + display:inline; | ||
39 | + text-align: center; | ||
40 | + padding: 16px; | ||
41 | +} | ||
42 | +.goal{ | ||
43 | + margin: 0%; | ||
44 | + margin-top: 10%; | ||
45 | + padding-bottom: 200px; | ||
46 | +} | ||
47 | +.favorites{ | ||
48 | + margin: 0%; | ||
49 | + margin-top: 20%; | ||
50 | + padding-bottom: 200px; | ||
51 | +} | ||
52 | +.panel-info{ | ||
53 | +} | ||
54 | +.panel-default{ | ||
55 | +} | ||
56 | +.panel-primary .panel-body{ | ||
57 | + padding: 0% 0% 0% 0%; | ||
58 | +} | ||
59 | +.end{ | ||
60 | + text-align: right; | ||
61 | +} | ||
62 | +h5{ | ||
63 | + text-align: center; | ||
64 | +} | ||
65 | +#img { | ||
66 | + | ||
67 | + display: block; | ||
68 | + margin: auto; | ||
69 | + width: 50%; | ||
70 | + | ||
71 | +} | ||
72 | +ul { | ||
73 | + list-style-type:none | ||
74 | +} | ||
75 | + | ||
76 | + | ||
77 | +/*CSS TIMELINE*/ | ||
78 | + | ||
79 | +.panel-title{ /*Because we use an outer a tag*/ | ||
80 | + color: rgba(255,255,255,.84); | ||
81 | +} | ||
82 | + | ||
83 | +.bubble { | ||
84 | + width: 100%; | ||
85 | + padding: .5em 1em; | ||
86 | + line-height: 1.4em; | ||
87 | + padding: 20px; | ||
88 | + background-color: #ecf0f1; | ||
89 | + position: relative; | ||
90 | + -webkit-border-radius: 8px; | ||
91 | + -moz-border-radius: 8px; | ||
92 | + -ms-border-radius: 8px; | ||
93 | + -o-border-radius: 8px; | ||
94 | + border-radius: 8px; | ||
95 | + text-align: left; | ||
96 | + display: inline-block; } | ||
97 | + .bubble:hover > .over-bubble { | ||
98 | + opacity: 1; } | ||
99 | + | ||
100 | +.bubble-container { | ||
101 | + width: 75%; | ||
102 | + display: block; | ||
103 | + position: relative; | ||
104 | + padding-left: 20px; | ||
105 | + vertical-align: top; | ||
106 | + display: inline-block; } | ||
107 | + | ||
108 | +.arrow { | ||
109 | + content: ''; | ||
110 | + display: block; | ||
111 | + position: absolute; | ||
112 | + left: 12px; | ||
113 | + bottom: 25%; | ||
114 | + height: 0; | ||
115 | + width: 0; | ||
116 | + border-top: 20px solid transparent; | ||
117 | + border-bottom: 20px solid transparent; | ||
118 | + border-right: 20px solid #ecf0f1; } | ||
119 | + | ||
120 | +.timeline { | ||
121 | + width: 560px; | ||
122 | + display: block; | ||
123 | + margin: auto; | ||
124 | + background-color: #dde1e2; | ||
125 | + padding-bottom: 2em; | ||
126 | + -webkit-box-shadow: #bdc3c7 0 5px 5px; | ||
127 | + -moz-box-shadow: #bdc3c7 0 5px 5px; | ||
128 | + box-shadow: #bdc3c7 0 5px 5px; | ||
129 | + -moz-border-radius-bottomleft: 8px; | ||
130 | + -webkit-border-bottom-left-radius: 8px; | ||
131 | + border-bottom-left-radius: 8px; | ||
132 | + -moz-border-radius-bottomright: 8px; | ||
133 | + -webkit-border-bottom-right-radius: 8px; | ||
134 | + border-bottom-right-radius: 8px; | ||
135 | + margin-bottom: 2em; } | ||
136 | + .timeline li { | ||
137 | + padding: 1em 0; } | ||
138 | + .timeline li.not_read { | ||
139 | + background-color: #d3d7d8; } | ||
140 | + | ||
141 | +.avatar { | ||
142 | + width: 18%; | ||
143 | + display: inline-block; | ||
144 | + vertical-align: top; | ||
145 | + position: relative; | ||
146 | + overflow: hidden; | ||
147 | + margin-left: 2%; } | ||
148 | + .avatar img { | ||
149 | + width: 100%; | ||
150 | + -webkit-border-radius: 50%; | ||
151 | + -moz-border-radius: 50%; | ||
152 | + -ms-border-radius: 50%; | ||
153 | + -o-border-radius: 50%; | ||
154 | + border-radius: 50%; | ||
155 | + border: 5px solid #ecf0f1; | ||
156 | + position: relative; } | ||
157 | + | ||
158 | + | ||
159 | + | ||
160 | +.first { | ||
161 | + width: 560px; | ||
162 | + display: block; | ||
163 | + margin: auto; | ||
164 | + background-color: #3498db; | ||
165 | + text-shadow: #2084c7 1px 1px 0; | ||
166 | + padding: 1em 0 !important; | ||
167 | + color: white; | ||
168 | + text-align: center; | ||
169 | + margin-top: 1em; | ||
170 | + font-family: "Lato"; | ||
171 | + font-size: 1.6em; | ||
172 | + -moz-border-radius-topleft: 8px; | ||
173 | + -webkit-border-top-left-radius: 8px; | ||
174 | + border-top-left-radius: 8px; | ||
175 | + -moz-border-radius-topright: 8px; | ||
176 | + -webkit-border-top-right-radius: 8px; | ||
177 | + border-top-right-radius: 8px; | ||
178 | + position: relative; } | ||
179 | + | ||
180 | + | ||
181 | +.over-bubble { | ||
182 | + line-height: 1.4em; | ||
183 | + padding-top: 10%; | ||
184 | + background-color: rgba(236, 240, 241, 0.8); | ||
185 | + position: relative; | ||
186 | + -webkit-border-radius: 8px; | ||
187 | + -moz-border-radius: 8px; | ||
188 | + -ms-border-radius: 8px; | ||
189 | + -o-border-radius: 8px; | ||
190 | + border-radius: 8px; | ||
191 | + text-align: center; | ||
192 | + display: inline-block; | ||
193 | + position: absolute !important; | ||
194 | + height: 100%; | ||
195 | + width: 100%; | ||
196 | + opacity: 0; | ||
197 | + top: 0; | ||
198 | + left: 0; | ||
199 | + z-index: 999; | ||
200 | + -webkit-transition-property: all; | ||
201 | + -moz-transition-property: all; | ||
202 | + -o-transition-property: all; | ||
203 | + transition-property: all; | ||
204 | + -webkit-transition-duration: 0.3s; | ||
205 | + -moz-transition-duration: 0.3s; | ||
206 | + -o-transition-duration: 0.3s; | ||
207 | + transition-duration: 0.3s; | ||
208 | + -webkit-transition-timing-function: ease-in; | ||
209 | + -moz-transition-timing-function: ease-in; | ||
210 | + -o-transition-timing-function: ease-in; | ||
211 | + transition-timing-function: ease-in; | ||
212 | + font-size: 2.8em; | ||
213 | + text-shadow: white 1px 1px 0; } | ||
214 | + | ||
215 | +.action { | ||
216 | + margin-right: .3em; | ||
217 | + -webkit-transition-property: all; | ||
218 | + -moz-transition-property: all; | ||
219 | + -o-transition-property: all; | ||
220 | + transition-property: all; | ||
221 | + -webkit-transition-duration: 0.2s; | ||
222 | + -moz-transition-duration: 0.2s; | ||
223 | + -o-transition-duration: 0.2s; | ||
224 | + transition-duration: 0.2s; | ||
225 | + -webkit-transition-timing-function: ease-in; | ||
226 | + -moz-transition-timing-function: ease-in; | ||
227 | + -o-transition-timing-function: ease-in; | ||
228 | + transition-timing-function: ease-in; } | ||
229 | + | ||
230 | + | ||
231 | + | ||
232 | +.icon-more-horiz {margin-top: 0px; margin-bottom: 0px; padding-left: 0px;} | ||
233 | + | ||
234 | +.retweet { | ||
235 | + position: absolute; | ||
236 | + opacity: 1; | ||
237 | + top: 0; | ||
238 | + right: 1em; | ||
239 | + display: block; | ||
240 | + background-color: #16a085; | ||
241 | + padding: 4px; | ||
242 | + -moz-border-radius-bottomleft: 5px; | ||
243 | + -webkit-border-bottom-left-radius: 5px; | ||
244 | + border-bottom-left-radius: 5px; | ||
245 | + -moz-border-radius-bottomright: 5px; | ||
246 | + -webkit-border-bottom-right-radius: 5px; | ||
247 | + border-bottom-right-radius: 5px; } | ||
248 | + .retweet .icon-retweet { | ||
249 | + color: white; | ||
250 | + margin: auto; | ||
251 | + width: 100%; | ||
252 | + display: block; | ||
253 | + font-size: 1.2em; } | ||
254 | + | ||
255 | +/*CSS NOTIFICACIONS*/ | ||
256 | + | ||
257 | +.alert_list{font-size: 11px; color:grey} | ||
258 | +li.alert_li { | ||
259 | + font-size: 11px; | ||
260 | + color:grey; | ||
261 | + padding:10px 0px 2px 0px; | ||
262 | + border-bottom: thin solid #c0c0c0; | ||
263 | +} | ||
264 | +li.alert_li:hover{background-color:#eee} | ||
265 | +.turn_off_alert{float:right;margin-bottom :1px} | ||
266 | +a.alert_message{color : grey} | ||
267 | +a.alert_message:hover{color : grey} | ||
268 | + | ||
269 | +/*=================== Ailson - Please Don't touch*/ | ||
270 | +.breadcrumb .divider{ | ||
271 | + display: none; | ||
272 | +} | ||
273 | + | ||
274 | +.accordion { | ||
275 | + background: #c0c0c0; | ||
276 | +} | ||
277 | +.accordion_list { | ||
278 | + background: #e0e0e0; | ||
279 | +} | ||
280 | + | ||
281 | +body .container .jumbotron-inverse, body .container .well-inverse, body .container-fluid .jumbotron-inverse, body .container-fluid .well-inverse { | ||
282 | + background-color: white; | ||
283 | +} | ||
284 | +.forum_collapse { | ||
285 | + color: #000; | ||
286 | +} | ||
287 | +.forum_collapse:hover, .forum_collapse:focus { | ||
288 | + text-decoration: none; | ||
289 | + color: #000; | ||
290 | +} | ||
291 | + | ||
292 | +.timeline.post { | ||
293 | + border-top-left-radius: 8px; | ||
294 | + border-top-right-radius: 8px; | ||
295 | + padding-bottom: 0px; | ||
296 | + -webkit-padding-start: 0px !important; | ||
297 | + width: 100%; | ||
298 | +} | ||
299 | +.timeline.post a { | ||
300 | + color: #000; | ||
301 | +} | ||
302 | +.timeline.post li { | ||
303 | + padding: 10px; | ||
304 | + border-bottom: 1px solid #fff; | ||
305 | +} | ||
306 | +.timeline.post li:last-child { | ||
307 | + border: none; | ||
308 | +} | ||
309 | +.timeline.post h3 { | ||
310 | + margin-top: 5px; | ||
311 | +} | ||
312 | + | ||
313 | +.notification-count { | ||
314 | + background-color: #FF0000; | ||
315 | +} |
core/static/css/base/amadeus.css
@@ -300,27 +300,25 @@ body .container .jumbotron-inverse, body .container .well-inverse, body .contain | @@ -300,27 +300,25 @@ body .container .jumbotron-inverse, body .container .well-inverse, body .contain | ||
300 | color: #000; | 300 | color: #000; |
301 | } | 301 | } |
302 | 302 | ||
303 | -.timeline.post { | ||
304 | - border-top-left-radius: 8px; | ||
305 | - border-top-right-radius: 8px; | ||
306 | - padding-bottom: 0px; | ||
307 | - -webkit-padding-start: 0px !important; | ||
308 | - width: 100%; | ||
309 | -} | ||
310 | -.timeline.post a { | ||
311 | - color: #000; | 303 | +/*TIMELINE CLASSES BEGIN */ |
304 | +.resource_inline{ | ||
305 | + display: inline-block; | ||
312 | } | 306 | } |
313 | -.timeline.post li { | ||
314 | - padding: 10px; | ||
315 | - border-bottom: 1px solid #fff; | 307 | + |
308 | +.imgTimeLine{ | ||
309 | + width: 100%; | ||
310 | + height: auto; | ||
311 | + padding-top: 10px; | ||
316 | } | 312 | } |
317 | -.timeline.post li:last-child { | ||
318 | - border: none; | 313 | +.timeLine div .col-md-11{ |
314 | + padding-left: 0px; | ||
319 | } | 315 | } |
320 | -.timeline.post h3 { | ||
321 | - margin-top: 5px; | 316 | +.timeLine div .col-md-11 i{ |
317 | + padding-right: 5px; | ||
322 | } | 318 | } |
323 | 319 | ||
320 | +/*TIMELINE CLASSES END*/ | ||
321 | + | ||
324 | .notification-count { | 322 | .notification-count { |
325 | background-color: #FF0000; | 323 | background-color: #FF0000; |
326 | } | 324 | } |
courses/admin.py
1 | from django.contrib import admin | 1 | from django.contrib import admin |
2 | 2 | ||
3 | -from .models import CourseCategory, Course, Subject,Topic, Activity, Material | 3 | +from .models import CourseCategory, Course, Subject,Topic, Activity, Material, CategorySubject |
4 | 4 | ||
5 | class CategoryAdmin(admin.ModelAdmin): | 5 | class CategoryAdmin(admin.ModelAdmin): |
6 | list_display = ['name', 'slug'] | 6 | list_display = ['name', 'slug'] |
7 | search_fields = ['name', 'slug'] | 7 | search_fields = ['name', 'slug'] |
8 | 8 | ||
9 | +class CategorySubjectAdmin(admin.ModelAdmin): | ||
10 | + list_display = ['name', 'slug'] | ||
11 | + search_fields = ['name', 'slug'] | ||
12 | + | ||
9 | class CourseAdmin(admin.ModelAdmin): | 13 | class CourseAdmin(admin.ModelAdmin): |
10 | list_display = ['name', 'slug'] | 14 | list_display = ['name', 'slug'] |
11 | search_fields = ['name', 'slug'] | 15 | search_fields = ['name', 'slug'] |
@@ -32,3 +36,4 @@ admin.site.register(Subject, SubjectAdmin) | @@ -32,3 +36,4 @@ admin.site.register(Subject, SubjectAdmin) | ||
32 | admin.site.register(Topic, TopicAdmin) | 36 | admin.site.register(Topic, TopicAdmin) |
33 | admin.site.register(Activity,ActivityAdmin) | 37 | admin.site.register(Activity,ActivityAdmin) |
34 | admin.site.register(Material,MaterialAdmin) | 38 | admin.site.register(Material,MaterialAdmin) |
39 | +admin.site.register(CategorySubject, CategorySubjectAdmin) |
courses/forms.py
1 | from django import forms | 1 | from django import forms |
2 | from django.utils.translation import ugettext_lazy as _ | 2 | from django.utils.translation import ugettext_lazy as _ |
3 | -from .models import CourseCategory, Course, Subject, Topic, ActivityFile, Activity | 3 | +from .models import CourseCategory, Course, Subject, Topic, ActivityFile, Activity, FileMaterial, LinkMaterial |
4 | from s3direct.widgets import S3DirectWidget | 4 | from s3direct.widgets import S3DirectWidget |
5 | 5 | ||
6 | 6 | ||
@@ -128,15 +128,19 @@ class SubjectForm(forms.ModelForm): | @@ -128,15 +128,19 @@ class SubjectForm(forms.ModelForm): | ||
128 | 128 | ||
129 | class Meta: | 129 | class Meta: |
130 | model = Subject | 130 | model = Subject |
131 | - fields = ('name', 'description', 'visible',) | 131 | + fields = ('name', 'description','init_date', 'end_date', 'visible',) |
132 | labels = { | 132 | labels = { |
133 | 'name': _('Name'), | 133 | 'name': _('Name'), |
134 | 'description': _('Description'), | 134 | 'description': _('Description'), |
135 | + 'init_date': _('Start date'), | ||
136 | + 'end_date': _('End date'), | ||
135 | 'visible': _('Is it visible?'), | 137 | 'visible': _('Is it visible?'), |
136 | } | 138 | } |
137 | help_texts = { | 139 | help_texts = { |
138 | 'name': _("Subjects's name"), | 140 | 'name': _("Subjects's name"), |
139 | 'description': _("Subjects's description"), | 141 | 'description': _("Subjects's description"), |
142 | + 'init_date': _('Start date of the subject'), | ||
143 | + 'end_date': _('End date of the subject'), | ||
140 | 'visible': _('Is the subject visible?'), | 144 | 'visible': _('Is the subject visible?'), |
141 | } | 145 | } |
142 | 146 | ||
@@ -184,7 +188,17 @@ class ActivityFileForm(forms.ModelForm): | @@ -184,7 +188,17 @@ class ActivityFileForm(forms.ModelForm): | ||
184 | model = ActivityFile | 188 | model = ActivityFile |
185 | fields = ['pdf','name'] | 189 | fields = ['pdf','name'] |
186 | 190 | ||
187 | -class ActivityForm(forms.ModelForm): | 191 | +class ActivityForm(forms.ModelForm): |
188 | class Meta: | 192 | class Meta: |
189 | model = Activity | 193 | model = Activity |
190 | fields = ['topic', 'limit_date', 'students','all_students'] | 194 | fields = ['topic', 'limit_date', 'students','all_students'] |
195 | + | ||
196 | +class FileMaterialForm(forms.ModelForm): | ||
197 | + class Meta: | ||
198 | + model = FileMaterial | ||
199 | + fields = ['name', 'file'] | ||
200 | + | ||
201 | +class LinkMaterialForm(forms.ModelForm): | ||
202 | + class Meta: | ||
203 | + model = LinkMaterial | ||
204 | + fields = ['material', 'name', 'description','url'] |
courses/migrations/0001_initial.py
1 | # -*- coding: utf-8 -*- | 1 | # -*- coding: utf-8 -*- |
2 | -# Generated by Django 1.10 on 2016-10-17 12:25 | 2 | +# Generated by Django 1.10 on 2016-10-18 02:46 |
3 | from __future__ import unicode_literals | 3 | from __future__ import unicode_literals |
4 | 4 | ||
5 | import autoslug.fields | 5 | import autoslug.fields |
@@ -38,8 +38,21 @@ class Migration(migrations.Migration): | @@ -38,8 +38,21 @@ class Migration(migrations.Migration): | ||
38 | ('diet', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='files', to='courses.Activity')), | 38 | ('diet', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='files', to='courses.Activity')), |
39 | ], | 39 | ], |
40 | options={ | 40 | options={ |
41 | - 'verbose_name': 'Activity File', | ||
42 | 'verbose_name_plural': 'Activitys Files', | 41 | 'verbose_name_plural': 'Activitys Files', |
42 | + 'verbose_name': 'Activity File', | ||
43 | + }, | ||
44 | + ), | ||
45 | + migrations.CreateModel( | ||
46 | + name='CategorySubject', | ||
47 | + fields=[ | ||
48 | + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
49 | + ('name', models.CharField(max_length=100, unique=True, verbose_name='Name')), | ||
50 | + ('slug', autoslug.fields.AutoSlugField(editable=False, populate_from='name', unique=True, verbose_name='Slug')), | ||
51 | + ('create_date', models.DateField(auto_now_add=True, verbose_name='Creation Date')), | ||
52 | + ], | ||
53 | + options={ | ||
54 | + 'verbose_name_plural': 'Categories', | ||
55 | + 'verbose_name': 'Category', | ||
43 | }, | 56 | }, |
44 | ), | 57 | ), |
45 | migrations.CreateModel( | 58 | migrations.CreateModel( |
@@ -59,9 +72,9 @@ class Migration(migrations.Migration): | @@ -59,9 +72,9 @@ class Migration(migrations.Migration): | ||
59 | ('image', models.ImageField(blank=True, upload_to='courses/', verbose_name='Image')), | 72 | ('image', models.ImageField(blank=True, upload_to='courses/', verbose_name='Image')), |
60 | ], | 73 | ], |
61 | options={ | 74 | options={ |
62 | - 'verbose_name': 'Course', | ||
63 | - 'ordering': ('create_date', 'name'), | ||
64 | 'verbose_name_plural': 'Courses', | 75 | 'verbose_name_plural': 'Courses', |
76 | + 'ordering': ('create_date', 'name'), | ||
77 | + 'verbose_name': 'Course', | ||
65 | }, | 78 | }, |
66 | ), | 79 | ), |
67 | migrations.CreateModel( | 80 | migrations.CreateModel( |
@@ -73,11 +86,28 @@ class Migration(migrations.Migration): | @@ -73,11 +86,28 @@ class Migration(migrations.Migration): | ||
73 | ('create_date', models.DateField(auto_now_add=True, verbose_name='Creation Date')), | 86 | ('create_date', models.DateField(auto_now_add=True, verbose_name='Creation Date')), |
74 | ], | 87 | ], |
75 | options={ | 88 | options={ |
76 | - 'verbose_name': 'Category', | ||
77 | 'verbose_name_plural': 'Categories', | 89 | 'verbose_name_plural': 'Categories', |
90 | + 'verbose_name': 'Category', | ||
78 | }, | 91 | }, |
79 | ), | 92 | ), |
80 | migrations.CreateModel( | 93 | migrations.CreateModel( |
94 | + name='FileMaterial', | ||
95 | + fields=[ | ||
96 | + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
97 | + ('file', models.FileField(upload_to='uploads/%Y/%m/%d')), | ||
98 | + ('name', models.CharField(max_length=100)), | ||
99 | + ], | ||
100 | + ), | ||
101 | + migrations.CreateModel( | ||
102 | + name='LinkMaterial', | ||
103 | + fields=[ | ||
104 | + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
105 | + ('name', models.CharField(max_length=100)), | ||
106 | + ('description', models.TextField()), | ||
107 | + ('url', models.URLField(max_length=300, verbose_name='Link')), | ||
108 | + ], | ||
109 | + ), | ||
110 | + migrations.CreateModel( | ||
81 | name='Material', | 111 | name='Material', |
82 | fields=[ | 112 | fields=[ |
83 | ('resource_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='core.Resource')), | 113 | ('resource_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='core.Resource')), |
@@ -98,14 +128,15 @@ class Migration(migrations.Migration): | @@ -98,14 +128,15 @@ class Migration(migrations.Migration): | ||
98 | ('end_date', models.DateField(verbose_name='End of Subject Date')), | 128 | ('end_date', models.DateField(verbose_name='End of Subject Date')), |
99 | ('create_date', models.DateTimeField(auto_now_add=True, verbose_name='Creation Date')), | 129 | ('create_date', models.DateTimeField(auto_now_add=True, verbose_name='Creation Date')), |
100 | ('update_date', models.DateTimeField(auto_now=True, verbose_name='Date of last update')), | 130 | ('update_date', models.DateTimeField(auto_now=True, verbose_name='Date of last update')), |
131 | + ('category', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='subject_category', to='courses.CategorySubject', verbose_name='Category')), | ||
101 | ('course', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='subjects', to='courses.Course', verbose_name='Course')), | 132 | ('course', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='subjects', to='courses.Course', verbose_name='Course')), |
102 | ('professors', models.ManyToManyField(related_name='professors_subjects', to=settings.AUTH_USER_MODEL, verbose_name='Professors')), | 133 | ('professors', models.ManyToManyField(related_name='professors_subjects', to=settings.AUTH_USER_MODEL, verbose_name='Professors')), |
103 | ('students', models.ManyToManyField(related_name='subject_student', to=settings.AUTH_USER_MODEL, verbose_name='Students')), | 134 | ('students', models.ManyToManyField(related_name='subject_student', to=settings.AUTH_USER_MODEL, verbose_name='Students')), |
104 | ], | 135 | ], |
105 | options={ | 136 | options={ |
106 | - 'verbose_name': 'Subject', | ||
107 | - 'ordering': ('create_date', 'name'), | ||
108 | 'verbose_name_plural': 'Subjects', | 137 | 'verbose_name_plural': 'Subjects', |
138 | + 'ordering': ('create_date', 'name'), | ||
139 | + 'verbose_name': 'Subject', | ||
109 | }, | 140 | }, |
110 | ), | 141 | ), |
111 | migrations.CreateModel( | 142 | migrations.CreateModel( |
@@ -118,8 +149,8 @@ class Migration(migrations.Migration): | @@ -118,8 +149,8 @@ class Migration(migrations.Migration): | ||
118 | ('subjects', models.ManyToManyField(to='courses.Subject')), | 149 | ('subjects', models.ManyToManyField(to='courses.Subject')), |
119 | ], | 150 | ], |
120 | options={ | 151 | options={ |
121 | - 'verbose_name': 'subject category', | ||
122 | 'verbose_name_plural': 'subject categories', | 152 | 'verbose_name_plural': 'subject categories', |
153 | + 'verbose_name': 'subject category', | ||
123 | }, | 154 | }, |
124 | ), | 155 | ), |
125 | migrations.CreateModel( | 156 | migrations.CreateModel( |
@@ -136,9 +167,9 @@ class Migration(migrations.Migration): | @@ -136,9 +167,9 @@ class Migration(migrations.Migration): | ||
136 | ('subject', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='courses.Subject', verbose_name='Subject')), | 167 | ('subject', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='courses.Subject', verbose_name='Subject')), |
137 | ], | 168 | ], |
138 | options={ | 169 | options={ |
139 | - 'verbose_name': 'Topic', | ||
140 | - 'ordering': ('create_date', 'name'), | ||
141 | 'verbose_name_plural': 'Topics', | 170 | 'verbose_name_plural': 'Topics', |
171 | + 'ordering': ('create_date', 'name'), | ||
172 | + 'verbose_name': 'Topic', | ||
142 | }, | 173 | }, |
143 | ), | 174 | ), |
144 | migrations.AddField( | 175 | migrations.AddField( |
@@ -147,6 +178,16 @@ class Migration(migrations.Migration): | @@ -147,6 +178,16 @@ class Migration(migrations.Migration): | ||
147 | field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='materials', to='courses.Topic', verbose_name='Topic'), | 178 | field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='materials', to='courses.Topic', verbose_name='Topic'), |
148 | ), | 179 | ), |
149 | migrations.AddField( | 180 | migrations.AddField( |
181 | + model_name='linkmaterial', | ||
182 | + name='material', | ||
183 | + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='material_link', to='courses.Material', verbose_name='Material'), | ||
184 | + ), | ||
185 | + migrations.AddField( | ||
186 | + model_name='filematerial', | ||
187 | + name='material', | ||
188 | + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='material_file', to='courses.Material', verbose_name='Material'), | ||
189 | + ), | ||
190 | + migrations.AddField( | ||
150 | model_name='course', | 191 | model_name='course', |
151 | name='category', | 192 | name='category', |
152 | field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='course_category', to='courses.CourseCategory', verbose_name='Category'), | 193 | field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='course_category', to='courses.CourseCategory', verbose_name='Category'), |
courses/models.py
@@ -18,6 +18,18 @@ class CourseCategory(models.Model): | @@ -18,6 +18,18 @@ class CourseCategory(models.Model): | ||
18 | def __str__(self): | 18 | def __str__(self): |
19 | return self.name | 19 | return self.name |
20 | 20 | ||
21 | +class CategorySubject(models.Model): | ||
22 | + name = models.CharField(_('Name'), max_length=100, unique=True) | ||
23 | + slug = AutoSlugField(_("Slug"), populate_from='name', unique=True) | ||
24 | + create_date = models.DateField(_('Creation Date'), auto_now_add=True) | ||
25 | + | ||
26 | + class Meta: | ||
27 | + verbose_name = _('Category') | ||
28 | + verbose_name_plural = _('Categories') | ||
29 | + | ||
30 | + def __str__(self): | ||
31 | + return self.name | ||
32 | + | ||
21 | class Course(models.Model): | 33 | class Course(models.Model): |
22 | 34 | ||
23 | name = models.CharField(_('Name'), max_length = 100) | 35 | name = models.CharField(_('Name'), max_length = 100) |
@@ -54,6 +66,7 @@ class Subject(models.Model): | @@ -54,6 +66,7 @@ class Subject(models.Model): | ||
54 | create_date = models.DateTimeField(_('Creation Date'), auto_now_add = True) | 66 | create_date = models.DateTimeField(_('Creation Date'), auto_now_add = True) |
55 | update_date = models.DateTimeField(_('Date of last update'), auto_now=True) | 67 | update_date = models.DateTimeField(_('Date of last update'), auto_now=True) |
56 | course = models.ForeignKey(Course, verbose_name = _('Course'), related_name="subjects") | 68 | course = models.ForeignKey(Course, verbose_name = _('Course'), related_name="subjects") |
69 | + category = models.ForeignKey(CategorySubject, verbose_name = _('Category'), related_name='subject_category',null=True) | ||
57 | professors = models.ManyToManyField(User,verbose_name=_('Professors'), related_name='professors_subjects') | 70 | professors = models.ManyToManyField(User,verbose_name=_('Professors'), related_name='professors_subjects') |
58 | students = models.ManyToManyField(User,verbose_name=_('Students'), related_name='subject_student') | 71 | students = models.ManyToManyField(User,verbose_name=_('Students'), related_name='subject_student') |
59 | 72 | ||
@@ -114,6 +127,17 @@ class Material(Resource): | @@ -114,6 +127,17 @@ class Material(Resource): | ||
114 | topic = models.ForeignKey(Topic, verbose_name = _('Topic'), related_name='materials') | 127 | topic = models.ForeignKey(Topic, verbose_name = _('Topic'), related_name='materials') |
115 | students = models.ManyToManyField(User, verbose_name = _('Students'), related_name='materials') | 128 | students = models.ManyToManyField(User, verbose_name = _('Students'), related_name='materials') |
116 | all_students = models.BooleanField(_('All Students'), default=False) | 129 | all_students = models.BooleanField(_('All Students'), default=False) |
130 | + | ||
131 | +class FileMaterial(models.Model): | ||
132 | + material = models.ForeignKey(Material, verbose_name = _('Material'), related_name='material_file') | ||
133 | + file = models.FileField(upload_to='uploads/%Y/%m/%d') | ||
134 | + name = models.CharField(max_length=100) | ||
135 | + | ||
136 | +class LinkMaterial(models.Model): | ||
137 | + material = models.ForeignKey(Material, verbose_name = _('Material'), related_name='material_link') | ||
138 | + name = models.CharField(max_length=100) | ||
139 | + description = models.TextField() | ||
140 | + url = models.URLField('Link', max_length=300) | ||
117 | 141 | ||
118 | """ | 142 | """ |
119 | It is a category for each subject. | 143 | It is a category for each subject. |
@@ -0,0 +1,82 @@ | @@ -0,0 +1,82 @@ | ||
1 | +function getCookie(name) { | ||
2 | + var cookieValue = null; | ||
3 | + if (document.cookie && document.cookie !== '') { | ||
4 | + var cookies = document.cookie.split(';'); | ||
5 | + for (var i = 0; i < cookies.length; i++) { | ||
6 | + var cookie = jQuery.trim(cookies[i]); | ||
7 | + // Does this cookie string begin with the name we want? | ||
8 | + if (cookie.substring(0, name.length + 1) === (name + '=')) { | ||
9 | + cookieValue = decodeURIComponent(cookie.substring(name.length + 1)); | ||
10 | + break; | ||
11 | + } | ||
12 | + } | ||
13 | + } | ||
14 | + return cookieValue; | ||
15 | +} | ||
16 | + | ||
17 | + | ||
18 | +function createMaterial(url, topic) { | ||
19 | + $.ajax({ | ||
20 | + url: url, | ||
21 | + data: {'topic': topic}, | ||
22 | + success: function(data) { | ||
23 | + $(".material_form").html(data); | ||
24 | + $("#id_topic").val(topic); | ||
25 | + | ||
26 | + setMaterialCreateFormSubmit(); | ||
27 | + } | ||
28 | + }); | ||
29 | + | ||
30 | + $("#editFileModal").modal(); | ||
31 | +} | ||
32 | + | ||
33 | +function setMaterialCreateFormSubmit() { | ||
34 | + | ||
35 | + var frm = $('#material_create'); | ||
36 | + frm.submit(function () { | ||
37 | + $.ajax({ | ||
38 | + type: frm.attr('method'), | ||
39 | + url: frm.attr('action'), | ||
40 | + data: frm.serialize(), | ||
41 | + success: function (data) { | ||
42 | + data = data.split('-'); | ||
43 | + | ||
44 | + $('.foruns_list').append("<li><i class='fa fa-commenting' aria-hidden='true'></i> <a id='forum_"+data[1]+"' href='"+data[0]+"'> "+data[2]+"</a></li>"); | ||
45 | + | ||
46 | + $("#createForum").modal('hide'); | ||
47 | + | ||
48 | + showForum(data[0], data[1]); | ||
49 | + }, | ||
50 | + error: function(data) { | ||
51 | + $(".forum_form").html(data.responseText); | ||
52 | + setMaterialCreateFormSubmit(); | ||
53 | + } | ||
54 | + }); | ||
55 | + return false; | ||
56 | + }); | ||
57 | +} | ||
58 | + | ||
59 | +function setMaterialUpdateFormSubmit(success_message) { | ||
60 | + | ||
61 | + var frm = $('#material_create'); | ||
62 | + frm.submit(function () { | ||
63 | + $.ajax({ | ||
64 | + type: frm.attr('method'), | ||
65 | + url: frm.attr('action'), | ||
66 | + data: frm.serialize(), | ||
67 | + success: function (data) { | ||
68 | + $('.forum_view').html(data); | ||
69 | + | ||
70 | + alertify.success(success_message); | ||
71 | + | ||
72 | + $("#editForum").modal('hide'); | ||
73 | + }, | ||
74 | + error: function(data) { | ||
75 | + $(".forum_form").html(data.responseText); | ||
76 | + | ||
77 | + setMaterialUpdateFormSubmit(success_message); | ||
78 | + } | ||
79 | + }); | ||
80 | + return false; | ||
81 | + }); | ||
82 | +} | ||
0 | \ No newline at end of file | 83 | \ No newline at end of file |
courses/templates/category/create.html
@@ -23,7 +23,7 @@ | @@ -23,7 +23,7 @@ | ||
23 | </div> | 23 | </div> |
24 | </div> | 24 | </div> |
25 | 25 | ||
26 | -{% if user|has_role:'professor, system_admin' %} | 26 | +{% if user|has_role:'professor' or user|has_role:'system_admin' %} |
27 | 27 | ||
28 | <div class="panel panel-primary navigation"> | 28 | <div class="panel panel-primary navigation"> |
29 | <div class="panel-heading"> | 29 | <div class="panel-heading"> |
courses/templates/category/delete.html
@@ -23,7 +23,7 @@ | @@ -23,7 +23,7 @@ | ||
23 | </div> | 23 | </div> |
24 | </div> | 24 | </div> |
25 | 25 | ||
26 | -{% if user|has_role:'professor, system_admin' %} | 26 | +{% if user|has_role:'professor' or user|has_role:'system_admin' %} |
27 | 27 | ||
28 | <div class="panel panel-primary navigation"> | 28 | <div class="panel panel-primary navigation"> |
29 | <div class="panel-heading"> | 29 | <div class="panel-heading"> |
courses/templates/category/index.html
@@ -23,8 +23,8 @@ | @@ -23,8 +23,8 @@ | ||
23 | </ul> | 23 | </ul> |
24 | </div> | 24 | </div> |
25 | </div> | 25 | </div> |
26 | - | ||
27 | - {% if user|has_role:'professor, system_admin' %} | 26 | + |
27 | + {% if user|has_role:'professor' or user|has_role:'system_admin' %} | ||
28 | 28 | ||
29 | <div class="panel panel-primary navigation"> | 29 | <div class="panel panel-primary navigation"> |
30 | <div class="panel-heading"> | 30 | <div class="panel-heading"> |
courses/templates/category/update.html
@@ -24,7 +24,7 @@ | @@ -24,7 +24,7 @@ | ||
24 | </div> | 24 | </div> |
25 | </div> | 25 | </div> |
26 | 26 | ||
27 | -{% if user|has_role:'professor, system_admin' %} | 27 | +{% if user|has_role:'professor' or user|has_role:'system_admin' %} |
28 | 28 | ||
29 | <div class="panel panel-primary navigation"> | 29 | <div class="panel panel-primary navigation"> |
30 | <div class="panel-heading"> | 30 | <div class="panel-heading"> |
@@ -87,7 +87,7 @@ | @@ -87,7 +87,7 @@ | ||
87 | {% endif %} | 87 | {% endif %} |
88 | {% endfor %} | 88 | {% endfor %} |
89 | <div class="row text-center"> | 89 | <div class="row text-center"> |
90 | - <input type="submit" value="{% trans 'Save' %}" class="btn btn-sm btn-success" /> | 90 | + <input type="submit" value="{% trans 'Save' %}" class="btn btn-sm btn-success" /> |
91 | </div> | 91 | </div> |
92 | </form> | 92 | </form> |
93 | </div> | 93 | </div> |
courses/templates/category/view.html
@@ -24,7 +24,7 @@ | @@ -24,7 +24,7 @@ | ||
24 | </ul> | 24 | </ul> |
25 | </div> | 25 | </div> |
26 | </div> | 26 | </div> |
27 | - {% if user|has_role:'professor, system_admin' %} | 27 | + {% if user|has_role:'professor' or user|has_role:'system_admin' %} |
28 | 28 | ||
29 | <div class="panel panel-primary navigation"> | 29 | <div class="panel panel-primary navigation"> |
30 | <div class="panel-heading"> | 30 | <div class="panel-heading"> |
courses/templates/course/index.html
@@ -17,13 +17,14 @@ | @@ -17,13 +17,14 @@ | ||
17 | </div> | 17 | </div> |
18 | <div class="panel-body"> | 18 | <div class="panel-body"> |
19 | <ul class="nav nav-pills nav-stacked"> | 19 | <ul class="nav nav-pills nav-stacked"> |
20 | + <li><a href="{% url 'core:home' %}">{% trans 'Home' %}</a></li> | ||
20 | <li><a href="{% url 'users:profile' %}">{% trans 'Profile' %}</a></li> | 21 | <li><a href="{% url 'users:profile' %}">{% trans 'Profile' %}</a></li> |
21 | <li><a href="{% url 'course:manage' %}">{% trans 'My Courses' %}</a></li> | 22 | <li><a href="{% url 'course:manage' %}">{% trans 'My Courses' %}</a></li> |
22 | </ul> | 23 | </ul> |
23 | </div> | 24 | </div> |
24 | </div> | 25 | </div> |
25 | 26 | ||
26 | -{% if user|has_role:'professor, system_admin' %} | 27 | +{% if user|has_role:'professor' or user|has_role:'system_admin' %} |
27 | 28 | ||
28 | <div class="panel panel-primary navigation"> | 29 | <div class="panel panel-primary navigation"> |
29 | <div class="panel-heading"> | 30 | <div class="panel-heading"> |
@@ -75,7 +76,7 @@ | @@ -75,7 +76,7 @@ | ||
75 | <i class="material-icons">search</i> | 76 | <i class="material-icons">search</i> |
76 | </button> | 77 | </button> |
77 | </span> | 78 | </span> |
78 | - </div> | 79 | + </div> |
79 | </form> | 80 | </form> |
80 | </div> | 81 | </div> |
81 | <div class="col-md-12"> | 82 | <div class="col-md-12"> |
@@ -102,7 +103,7 @@ | @@ -102,7 +103,7 @@ | ||
102 | <h4 style="color:white">{{course.name}}</h4> | 103 | <h4 style="color:white">{{course.name}}</h4> |
103 | </a> | 104 | </a> |
104 | </div> | 105 | </div> |
105 | - {% if user|has_role:'professor, system_admin' %} | 106 | + {% if user|has_role:'professor' or user|has_role:'system_admin' %} |
106 | <div class="col-xs-4 col-md-3" id="divMoreActions"> | 107 | <div class="col-xs-4 col-md-3" id="divMoreActions"> |
107 | <div class="btn-group"> | 108 | <div class="btn-group"> |
108 | <button class="btn btn-default btn-sm dropdown-toggle" type="button" id="moreActions" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> | 109 | <button class="btn btn-default btn-sm dropdown-toggle" type="button" id="moreActions" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> |
@@ -149,7 +150,7 @@ | @@ -149,7 +150,7 @@ | ||
149 | <h4 style="color:white">{{course.name}}</h4> | 150 | <h4 style="color:white">{{course.name}}</h4> |
150 | </a> | 151 | </a> |
151 | </div> | 152 | </div> |
152 | - {% if user|has_role:'professor, system_admin' %} | 153 | + {% if user|has_role:'professor' or user|has_role:'system_admin' %} |
153 | <div class="col-xs-4 col-md-3" id="divMoreActions"> | 154 | <div class="col-xs-4 col-md-3" id="divMoreActions"> |
154 | <div class="btn-group"> | 155 | <div class="btn-group"> |
155 | <button class="btn btn-default btn-sm dropdown-toggle" type="button" id="moreActions" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> | 156 | <button class="btn btn-default btn-sm dropdown-toggle" type="button" id="moreActions" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> |
courses/templates/course/view.html
@@ -21,13 +21,14 @@ | @@ -21,13 +21,14 @@ | ||
21 | </div> | 21 | </div> |
22 | <div class="panel-body"> | 22 | <div class="panel-body"> |
23 | <ul class="nav nav-pills nav-stacked"> | 23 | <ul class="nav nav-pills nav-stacked"> |
24 | + <li><a href="{% url 'core:home' %}">{% trans "Home" %}</a></li> | ||
24 | <li><a href="{% url 'users:profile' %}">{% trans 'Profile' %}</a></li> | 25 | <li><a href="{% url 'users:profile' %}">{% trans 'Profile' %}</a></li> |
25 | <li><a href="{% url 'course:manage' %}">{% trans 'My Courses' %}</a></li> | 26 | <li><a href="{% url 'course:manage' %}">{% trans 'My Courses' %}</a></li> |
26 | </ul> | 27 | </ul> |
27 | </div> | 28 | </div> |
28 | </div> | 29 | </div> |
29 | 30 | ||
30 | -{% if user|has_role:'professor, system_admin' %} | 31 | +{% if user|has_role:'professor' or user|has_role:'system_admin' %} |
31 | 32 | ||
32 | <div class="panel panel-primary navigation"> | 33 | <div class="panel panel-primary navigation"> |
33 | <div class="panel-heading"> | 34 | <div class="panel-heading"> |
@@ -47,7 +48,14 @@ | @@ -47,7 +48,14 @@ | ||
47 | {% endblock %} | 48 | {% endblock %} |
48 | 49 | ||
49 | {% block content %} | 50 | {% block content %} |
50 | - | 51 | +<div class="col-md-12"> |
52 | + <div class="btn-group btn-group-justified btn-group-raised"> | ||
53 | + <a href="?category=all" class="btn btn-raised btn-info">Todos</a> | ||
54 | + {% for category_subject in categorys_subjects %} | ||
55 | + <a href="?category={{category_subject.name}}" class="btn btn-raised btn-primary">{{category_subject.name}}</a> | ||
56 | + {% endfor %} | ||
57 | + </div> | ||
58 | +</div> | ||
51 | <div class="col-md-12"> | 59 | <div class="col-md-12"> |
52 | <div class="panel panel-info"> | 60 | <div class="panel panel-info"> |
53 | <div class="panel-heading headingOne"> | 61 | <div class="panel-heading headingOne"> |
@@ -55,7 +63,7 @@ | @@ -55,7 +63,7 @@ | ||
55 | <div class="col-xs-8 col-md-10 titleTopic"> | 63 | <div class="col-xs-8 col-md-10 titleTopic"> |
56 | <h4>{{course}}</h4> | 64 | <h4>{{course}}</h4> |
57 | </div> | 65 | </div> |
58 | - {% if user|has_role:'professor, system_admin' %} | 66 | + {% if user|has_role:'professor' or user|has_role:'system_admin' %} |
59 | <div class="col-xs-4 col-md-2" id="divMoreActions"> | 67 | <div class="col-xs-4 col-md-2" id="divMoreActions"> |
60 | <div class="btn-group"> | 68 | <div class="btn-group"> |
61 | <button class="btn btn-default btn-sm dropdown-toggle" type="button" id="moreActions" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> | 69 | <button class="btn btn-default btn-sm dropdown-toggle" type="button" id="moreActions" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> |
@@ -156,7 +164,9 @@ | @@ -156,7 +164,9 @@ | ||
156 | </div> | 164 | </div> |
157 | 165 | ||
158 | <div class="panel-group ui-accordion ui-widget ui-helper-reset ui-sortable" id="accordion" role="tablist" aria-multiselectable="false"> | 166 | <div class="panel-group ui-accordion ui-widget ui-helper-reset ui-sortable" id="accordion" role="tablist" aria-multiselectable="false"> |
159 | - <div><div class="panel panel-info"> | 167 | + <div> |
168 | + | ||
169 | + <div class="panel panel-info"> | ||
160 | </div> | 170 | </div> |
161 | 171 | ||
162 | 172 | ||
@@ -181,55 +191,104 @@ | @@ -181,55 +191,104 @@ | ||
181 | </div> | 191 | </div> |
182 | </div> | 192 | </div> |
183 | <div> | 193 | <div> |
184 | - | ||
185 | -{% for subject in subjects %} | ||
186 | -<div class="panel panel-info"> | ||
187 | - <div class="panel-heading headingTwo ui-sortable-handle" role="tab"> | ||
188 | - <div class="row"> | ||
189 | - <div class="col-xs-9 col-md-10 titleTopic"> | ||
190 | - <a role="button" data-toggle="collapse" data-parent="#accordion" href=".collapseTwo" aria-expanded="true" aria-controls="collapseTwo"> | ||
191 | - <h4 style="color:white">{{subject.name}}</h4> | ||
192 | - </a> | ||
193 | - </div> | ||
194 | - <div class="col-xs-3 col-md-2" id="divMoreActions"> | ||
195 | - <div class="btn-group"> | ||
196 | - <button class="btn btn-default btn-sm dropdown-toggle" type="button" id="moreActions" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> | ||
197 | - <i class="fa fa-ellipsis-v fa-2x" aria-hidden="true"></i> | ||
198 | - </button> | ||
199 | - <ul class="dropdown-menu" aria-labelledby="moreActions"> | ||
200 | - <li><a href="javascript:void(0)" data-toggle="modal" data-target="#myModal3"><i class="fa fa-pencil fa-fw" aria-hidden="true"></i> Replicate</a></li> | ||
201 | - <li><a href="javascript:void(0)" data-toggle="modal" data-target="#removeSubject2"><i class="fa fa-trash fa-fw" aria-hidden="true"></i> Remove</a></li> | ||
202 | - </ul> | 194 | + {% if request.GET.category == 'all' or none or request.GET.category == '' %} |
195 | + {% for subject in subjects %} | ||
196 | + <div class="panel panel-info"> | ||
197 | + <div class="panel-heading headingTwo ui-sortable-handle" role="tab"> | ||
198 | + <div class="row"> | ||
199 | + <div class="col-xs-9 col-md-10 titleTopic"> | ||
200 | + <a role="button" data-toggle="collapse" data-parent="#accordion" href=".collapseTwo" aria-expanded="true" aria-controls="collapseTwo"> | ||
201 | + <h4 style="color:white">{{subject.name}}</h4> | ||
202 | + </a> | ||
203 | + </div> | ||
204 | + <div class="col-xs-3 col-md-2" id="divMoreActions"> | ||
205 | + <div class="btn-group"> | ||
206 | + <button class="btn btn-default btn-sm dropdown-toggle" type="button" id="moreActions" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> | ||
207 | + <i class="fa fa-ellipsis-v fa-2x" aria-hidden="true"></i> | ||
208 | + </button> | ||
209 | + <ul class="dropdown-menu" aria-labelledby="moreActions"> | ||
210 | + <li><a href="javascript:void(0)" data-toggle="modal" data-target="#myModal3"><i class="fa fa-pencil fa-fw" aria-hidden="true"></i> Replicate</a></li> | ||
211 | + <li><a href="javascript:void(0)" data-toggle="modal" data-target="#removeSubject2"><i class="fa fa-trash fa-fw" aria-hidden="true"></i> Remove</a></li> | ||
212 | + </ul> | ||
213 | + </div> | ||
214 | + </div> | ||
215 | + </div> | ||
203 | </div> | 216 | </div> |
217 | + <div class="panel-body"> | ||
218 | + <p><b>{% trans "Professor" %}: </b>{% for professor in subject.professors.all %}{% if not forloop.first %},{% endif %} | ||
219 | + {{professor}}{% if forloop.last %}.{% endif %}{% endfor %}</p> | ||
220 | + <p> | ||
221 | + <b>{% trans "Description" %}: </b> | ||
222 | + <i> | ||
223 | + {{subject.description}} | ||
224 | + </i> | ||
225 | + </p> | ||
226 | + <div class="row"> | ||
227 | + <div class="col-xs-6 col-md-6"> | ||
228 | + <p><b>{% trans "Begining" %}: </b>{{subject.init_date}}</p> | ||
229 | + </div> | ||
230 | + <div class="col-xs-6 col-md-6"> | ||
231 | + <p><b>{% trans "End" %}: </b>{{subject.end_date}}</p> | ||
232 | + </div> | ||
233 | + </div> | ||
234 | + <a href="{% url 'course:view_subject' subject.slug %}" class="btn btn-raised btn-default center-block">{% trans 'View Subject' %}<div class="ripple-container"></div></a> | ||
235 | + </div> | ||
204 | </div> | 236 | </div> |
205 | - </div> | ||
206 | - </div> | ||
207 | - <div class="panel-body"> | ||
208 | - <p><b>{% trans "Professor" %}: </b>{% for professor in subject.professors.all %}{% if not forloop.first %},{% endif %} | ||
209 | - {{professor}}{% if forloop.last %}.{% endif %}{% endfor %}</p> | ||
210 | - <p> | ||
211 | - <b>{% trans "Description" %}: </b> | ||
212 | - <i> | ||
213 | - {{subject.description}} | ||
214 | - </i> | ||
215 | - </p> | ||
216 | - <div class="row"> | ||
217 | - <div class="col-xs-6 col-md-6"> | ||
218 | - <p><b>{% trans "Begining" %}: </b>{{subject.init_date}}</p> | ||
219 | - </div> | ||
220 | - <div class="col-xs-6 col-md-6"> | ||
221 | - <p><b>{% trans "End" %}: </b>{{subject.end_date}}</p> | 237 | + {% endfor %} |
238 | + {% else %} | ||
239 | + {% for subject in subjects_category %} | ||
240 | + {% if subject.category.name == request.GET.category %} | ||
241 | + <div class="panel panel-info"> | ||
242 | + <div class="panel-heading headingTwo ui-sortable-handle" role="tab"> | ||
243 | + <div class="row"> | ||
244 | + <div class="col-xs-9 col-md-10 titleTopic"> | ||
245 | + <a role="button" data-toggle="collapse" data-parent="#accordion" href=".collapseTwo" aria-expanded="true" aria-controls="collapseTwo"> | ||
246 | + <h4 style="color:white">{{subject.name}}</h4> | ||
247 | + </a> | ||
248 | + </div> | ||
249 | + <div class="col-xs-3 col-md-2" id="divMoreActions"> | ||
250 | + <div class="btn-group"> | ||
251 | + <button class="btn btn-default btn-sm dropdown-toggle" type="button" id="moreActions" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> | ||
252 | + <i class="fa fa-ellipsis-v fa-2x" aria-hidden="true"></i> | ||
253 | + </button> | ||
254 | + <ul class="dropdown-menu" aria-labelledby="moreActions"> | ||
255 | + <li><a href="javascript:void(0)" data-toggle="modal" data-target="#myModal3"><i class="fa fa-pencil fa-fw" aria-hidden="true"></i> Replicate</a></li> | ||
256 | + <li><a href="javascript:void(0)" data-toggle="modal" data-target="#removeSubject2"><i class="fa fa-trash fa-fw" aria-hidden="true"></i> Remove</a></li> | ||
257 | + </ul> | ||
258 | + </div> | ||
259 | + </div> | ||
260 | + </div> | ||
222 | </div> | 261 | </div> |
262 | + <div class="panel-body"> | ||
263 | + <p><b>{% trans "Professor" %}: </b>{% for professor in subject.professors.all %}{% if not forloop.first %},{% endif %} | ||
264 | + {{professor}}{% if forloop.last %}.{% endif %}{% endfor %}</p> | ||
265 | + <p> | ||
266 | + <b>{% trans "Description" %}: </b> | ||
267 | + <i> | ||
268 | + {{subject.description}} | ||
269 | + </i> | ||
270 | + </p> | ||
271 | + <div class="row"> | ||
272 | + <div class="col-xs-6 col-md-6"> | ||
273 | + <p><b>{% trans "Begining" %}: </b>{{subject.init_date}}</p> | ||
274 | + </div> | ||
275 | + <div class="col-xs-6 col-md-6"> | ||
276 | + <p><b>{% trans "End" %}: </b>{{subject.end_date}}</p> | ||
277 | + </div> | ||
278 | + </div> | ||
279 | + <a href="{% url 'course:view_subject' subject.slug %}" class="btn btn-raised btn-default center-block">{% trans 'View Subject' %}<div class="ripple-container"></div></a> | ||
280 | + </div> | ||
223 | </div> | 281 | </div> |
224 | - <a href="{% url 'course:view_subject' subject.slug %}" class="btn btn-raised btn-default center-block">{% trans 'View Subject' %}<div class="ripple-container"></div></a> | ||
225 | - </div> | ||
226 | -</div> | ||
227 | -<div class="form-group"> | ||
228 | - <a href="{% url 'course:create_subject' subject.slug %}" data-toggle="modal" data-target="" class="btn btn-primary btn-lg btn-block btn-raised">{% trans 'Create Subject' %}<div class="ripple-container"></div></a> | ||
229 | -</div> | 282 | + {% endif %} |
283 | + {% endfor %} | ||
284 | + {% endif %} | ||
230 | 285 | ||
231 | -{% endfor %} | 286 | +{% if user|has_role:'professor' or user|has_role:'system_admin' %} |
232 | 287 | ||
288 | + <div class="form-group"> | ||
289 | + <a href="#" data-toggle="modal" data-target="" class="btn btn-primary btn-lg btn-block btn-raised">{% trans 'Create Subject' %}<div class="ripple-container"></div></a> | ||
290 | + </div> | ||
291 | +{% endif %} | ||
233 | 292 | ||
234 | <!-- MODAL REMOVE --> | 293 | <!-- MODAL REMOVE --> |
235 | <div class="modal" id="removeSubject2"> | 294 | <div class="modal" id="removeSubject2"> |
@@ -257,4 +316,3 @@ | @@ -257,4 +316,3 @@ | ||
257 | </div> | 316 | </div> |
258 | 317 | ||
259 | {% endblock %} | 318 | {% endblock %} |
260 | - |
courses/templates/subject/form_view_teacher.html
1 | - {% load static i18n list_topic_foruns permission_tags %} | 1 | + {% load static i18n list_topic_foruns permission_tags widget_tweaks professor_access%} |
2 | 2 | ||
3 | {% block javascript %} | 3 | {% block javascript %} |
4 | <script type="text/javascript" src="{% static 'js/forum.js' %}"></script> | 4 | <script type="text/javascript" src="{% static 'js/forum.js' %}"></script> |
5 | <script src="{% static 'js/file.js' %}"></script> | 5 | <script src="{% static 'js/file.js' %}"></script> |
6 | + <script type="text/javascript" src="{% static 'js/material.js' %}"></script> | ||
6 | {% endblock %} | 7 | {% endblock %} |
7 | 8 | ||
8 | <div class="panel-group accordion ui-accordion ui-widget ui-helper-reset ui-sortable" role="tablist" aria-multiselectable="false"> | 9 | <div class="panel-group accordion ui-accordion ui-widget ui-helper-reset ui-sortable" role="tablist" aria-multiselectable="false"> |
@@ -24,7 +25,8 @@ | @@ -24,7 +25,8 @@ | ||
24 | <button class="btn btn-default btn-sm dropdown-toggle" type="button" id="moreActions" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> | 25 | <button class="btn btn-default btn-sm dropdown-toggle" type="button" id="moreActions" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> |
25 | <i class="fa fa-ellipsis-v fa-2x" aria-hidden="true"></i> | 26 | <i class="fa fa-ellipsis-v fa-2x" aria-hidden="true"></i> |
26 | </button> | 27 | </button> |
27 | - {% if user|has_role:'system_admin' or topic.owner == user %} | 28 | + {% professor_subject topic.subject user as dropdown_topic %} |
29 | + {% if dropdown_topic %} | ||
28 | <ul class="dropdown-menu pull-right" aria-labelledby="moreActions"> | 30 | <ul class="dropdown-menu pull-right" aria-labelledby="moreActions"> |
29 | <li><a href="javascript:void(0)" data-toggle="modal" data-target="#myModal4"><i class="fa fa-files-o fa-fw" aria-hidden="true"></i> {% trans "Replicate" %}</a></li> | 31 | <li><a href="javascript:void(0)" data-toggle="modal" data-target="#myModal4"><i class="fa fa-files-o fa-fw" aria-hidden="true"></i> {% trans "Replicate" %}</a></li> |
30 | <li><a href="javascript:void(0)" class="edit_card"><i class="fa fa-pencil fa-fw" aria-hidden="true"></i> {% trans "Edit" %}</a></li> | 32 | <li><a href="javascript:void(0)" class="edit_card"><i class="fa fa-pencil fa-fw" aria-hidden="true"></i> {% trans "Edit" %}</a></li> |
@@ -55,7 +57,7 @@ | @@ -55,7 +57,7 @@ | ||
55 | <li><a href="javascript:void(0)" data-toggle="modal" data-target="#createLinksModal">Create a Link<div class="ripple-container"><div class="ripple ripple-on ripple-out" style="left: 54.5312px; top: 22px; background-color: rgb(0, 150, 136); transform: scale(20);"></div></div></a></li> | 57 | <li><a href="javascript:void(0)" data-toggle="modal" data-target="#createLinksModal">Create a Link<div class="ripple-container"><div class="ripple ripple-on ripple-out" style="left: 54.5312px; top: 22px; background-color: rgb(0, 150, 136); transform: scale(20);"></div></div></a></li> |
56 | <li> | 58 | <li> |
57 | <a href="javascript:get_modal_file('{% url 'course:file:create_file' topic.slug %}', '#fileModal', '#divModalFile')"> | 59 | <a href="javascript:get_modal_file('{% url 'course:file:create_file' topic.slug %}', '#fileModal', '#divModalFile')"> |
58 | - Create a file | 60 | + {% trans "Create a file" %} |
59 | <div class="ripple-container"> | 61 | <div class="ripple-container"> |
60 | <div class="ripple ripple-on ripple-out" style="left: 33.5312px; top: 11px; background-color: rgb(0, 150, 136); transform: scale(20);"> | 62 | <div class="ripple ripple-on ripple-out" style="left: 33.5312px; top: 11px; background-color: rgb(0, 150, 136); transform: scale(20);"> |
61 | </div> | 63 | </div> |
@@ -79,22 +81,17 @@ | @@ -79,22 +81,17 @@ | ||
79 | <div class="dropdown"> | 81 | <div class="dropdown"> |
80 | <a href="#" type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"><i class="fa fa-plus-circle fa-lg" aria-hidden="true"></i></a> | 82 | <a href="#" type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"><i class="fa fa-plus-circle fa-lg" aria-hidden="true"></i></a> |
81 | <ul class="dropdown-menu" aria-labelledby="dLabel"> | 83 | <ul class="dropdown-menu" aria-labelledby="dLabel"> |
82 | - <li>Qualquer coisa</li> | 84 | + <li><a href="javascript:createForum('{% url 'course:forum:create' %}', '{{ topic.id }}')">{% trans 'Create Forum' %}<div class="ripple-container"><div class="ripple ripple-on ripple-out" style="left: 33.5312px; top: 11px; background-color: rgb(0, 150, 136); transform: scale(20);"></div></div></a></li> |
83 | </ul> | 85 | </ul> |
84 | </div> | 86 | </div> |
85 | </div> | 87 | </div> |
86 | <ul> | 88 | <ul> |
87 | <li><i class="fa fa-file-text" aria-hidden="true"></i> <a href="#" data-toggle="modal" data-target="#ActivityModal">Activitie 1</a></li> | 89 | <li><i class="fa fa-file-text" aria-hidden="true"></i> <a href="#" data-toggle="modal" data-target="#ActivityModal">Activitie 1</a></li> |
88 | - </ul> | ||
89 | - </div> | ||
90 | - <div class="col-xs-4 col-md-4"> | ||
91 | - <div class="panel-body"> | ||
92 | - <button class="btn btn-primary btn-raised" onclick="createForum('{% url 'course:forum:create' %}', '{{ topic.id }}')">{% trans '+ Create Forum' %}</button> | ||
93 | <div class="foruns_list"> | 90 | <div class="foruns_list"> |
94 | {% list_topic_foruns request topic %} | 91 | {% list_topic_foruns request topic %} |
95 | </div> | 92 | </div> |
96 | - </div> | ||
97 | - </div> | 93 | + </ul> |
94 | + </div> | ||
98 | {% list_topic_poll request topic %} | 95 | {% list_topic_poll request topic %} |
99 | </div> | 96 | </div> |
100 | </div> | 97 | </div> |
@@ -134,6 +131,7 @@ | @@ -134,6 +131,7 @@ | ||
134 | <a href="#" type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"><i class="fa fa-plus-circle fa-lg" aria-hidden="true"></i></a> | 131 | <a href="#" type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"><i class="fa fa-plus-circle fa-lg" aria-hidden="true"></i></a> |
135 | <ul class="dropdown-menu" aria-labelledby="dLabel"> | 132 | <ul class="dropdown-menu" aria-labelledby="dLabel"> |
136 | <li>Qualquer coisa</li> | 133 | <li>Qualquer coisa</li> |
134 | + <li><i class="material-icons">poll</i> <a href="javascript:modal.get('{% url 'course:poll:create_poll' topic.slug%}','#poll','#modal_poll');">{% trans 'Create Poll' %}</a></li> | ||
137 | </ul> | 135 | </ul> |
138 | </div> | 136 | </div> |
139 | </div> | 137 | </div> |
@@ -201,60 +199,11 @@ | @@ -201,60 +199,11 @@ | ||
201 | </div> | 199 | </div> |
202 | </div> | 200 | </div> |
203 | <!-- EndModal --> | 201 | <!-- EndModal --> |
204 | - | ||
205 | - <!--MODAL CREATE LINK--> | ||
206 | - <div class="modal fade" id="createLinksModal" tabindex="-1" role="dialog" aria-labelledby="createLink" style="display: none;"> | ||
207 | - <div class="modal-dialog" role="document"> | ||
208 | - <div class="modal-content"> | ||
209 | - <div class="modal-header"> | ||
210 | - <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> | ||
211 | - <h4 class="modal-title" id="createLink">Create a New Link</h4> | ||
212 | - </div> | ||
213 | - <div class="modal-body"> | ||
214 | - <!-- Card --> | ||
215 | - <div class="form-group is-empty"> | ||
216 | - <label class="control-label" for="inputDefault">Name</label> | ||
217 | - <input type="text" class="form-control" id="inputDefault"> | ||
218 | - </div> | ||
219 | - <div class="form-group is-empty"> | ||
220 | - <label class="control-label" for="inputDefault">Url</label> | ||
221 | - <input type="text" class="form-control" id="inputDefault"> | ||
222 | - </div> | ||
223 | - <div class="form-group is-empty"> | ||
224 | - <label class="control-label" for="inputDefault">Descrição</label> | ||
225 | - <textarea class="form-control" rows="3"></textarea> | ||
226 | - </div> | ||
227 | - <div class="form-group"> | ||
228 | - <a href="javascript:void(0)" class="btn btn-raised btn-default">Cancel</a> | ||
229 | - <a href="javascript:void(0)" class="btn btn-raised btn-primary">Submit</a> | ||
230 | - </div> | ||
231 | - <!-- .end Card --> | ||
232 | - </div> | ||
233 | - </div> | ||
234 | - </div> | ||
235 | - </div> | ||
236 | - <!-- EndModal --> | ||
237 | - | ||
238 | - <!-- MODAL REMOVE LINK --> | ||
239 | - <div class="modal" id="removeLink"> | ||
240 | - <div class="modal-dialog"> | ||
241 | - <div class="modal-content"> | ||
242 | - <div class="modal-header"> | ||
243 | - <button type="button" class="close" data-dismiss="modal" aria-hidden="true">X</button> | ||
244 | - <h4 class="modal-title"></h4> | ||
245 | - </div> | ||
246 | - <div class="modal-body"> | ||
247 | - <p>Do you really want to delete this link?</p> | ||
248 | - </div> | ||
249 | - <div class="modal-footer"> | ||
250 | - | ||
251 | - <a href="#" target="_self"><button type="button" class="btn btn-primary" data-dismiss="modal" aria-hidden="true">Confirm</button></a> | ||
252 | - | ||
253 | - </div> | ||
254 | - </div> | ||
255 | - </div> | ||
256 | - </div> | ||
257 | - <!-- END --> | 202 | + {% professor_subject topic.subject user as professor_links %} |
203 | + {% if professor_links%} | ||
204 | + {% include "links/create_link.html" %} | ||
205 | + {% include "links/delete_link.html" %} | ||
206 | + {% endif %} | ||
258 | 207 | ||
259 | <!-- MODAL EMBEED--> | 208 | <!-- MODAL EMBEED--> |
260 | <div class="modal fade" id="embedModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"> | 209 | <div class="modal fade" id="embedModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"> |
@@ -308,7 +257,7 @@ | @@ -308,7 +257,7 @@ | ||
308 | <!-- EndModal --> | 257 | <!-- EndModal --> |
309 | 258 | ||
310 | <!-- MODAL ACTIVITIES--> | 259 | <!-- MODAL ACTIVITIES--> |
311 | - <div class="modal fade" id="ActivityModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"> | 260 | + <div class="modal fade" id="ActivityModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"> |
312 | <div class="modal-dialog" role="document"> | 261 | <div class="modal-dialog" role="document"> |
313 | <div class="modal-content"> | 262 | <div class="modal-content"> |
314 | <div class="modal-header"> | 263 | <div class="modal-header"> |
@@ -317,7 +266,7 @@ | @@ -317,7 +266,7 @@ | ||
317 | </div> | 266 | </div> |
318 | <div class="modal-body"> | 267 | <div class="modal-body"> |
319 | <form class="form-horizontal"> | 268 | <form class="form-horizontal"> |
320 | - | 269 | + |
321 | <fieldset> | 270 | <fieldset> |
322 | <legend>Atividade Proposta</legend> | 271 | <legend>Atividade Proposta</legend> |
323 | <div class="form-group is-empty"> | 272 | <div class="form-group is-empty"> |
@@ -369,168 +318,14 @@ | @@ -369,168 +318,14 @@ | ||
369 | </div> | 318 | </div> |
370 | <!--EndModal--> | 319 | <!--EndModal--> |
371 | 320 | ||
372 | - <!-- MODAL FORUM --> | ||
373 | - <div class="modal fade" id="forumModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"> | ||
374 | - <div class="modal-dialog" role="document"> | ||
375 | - <div class="modal-content"> | ||
376 | - <div class="modal-header"> | ||
377 | - <h4 class="modal-title" id="myModalLabel">Forum</h4> | ||
378 | - </div> | ||
379 | - <div class="modal-body"> | ||
380 | - <!--Forum--> | ||
381 | - <!--Main wrapper--> | ||
382 | - <div class="comments-list"> | ||
383 | - <div class="section-heading"> | ||
384 | - <h1>Python</h1> | ||
385 | - <h4><b>Description:</b>High-level Language</h4> | ||
386 | - <h4><b>Opened in:</b> September 1st</h4> | ||
387 | - </div> | ||
388 | - <!--First row--> | ||
389 | - <div class="row"> | ||
390 | - | ||
391 | - <!--Content column--> | ||
392 | - <div class="col-sm-10 col-xs-12"> | ||
393 | - <h3 class="user-name">Gerson Jefferson</h3> | ||
394 | - | ||
395 | - <div class="card-data"> | ||
396 | - <p class="comment-date"><i class="fa fa-clock-o"></i> 05/10/2015</p> | ||
397 | - </div> | ||
398 | - | ||
399 | - <p class="comment-text">Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat | ||
400 | - cupidatat non proident.</p> | ||
401 | - </div> | ||
402 | - <!--/.Content column--> | ||
403 | - </div> | ||
404 | - <a class="btn btn-sm" style="float: right;" data-toggle="collapse" href="#collapse1" aria-expanded="false" aria-controls="collapseExample">Reply</a> | ||
405 | - <div class="collapse" id="collapse1"> | ||
406 | - <div class="md-form"> | ||
407 | - <div class="form-group is-empty"><input type="text" id="form1" class="form-control" placeholder="comment on the cometary"></div><span class="input-group-btn"> | ||
408 | - <button type="button" class="btn btn-sm"> | ||
409 | - <i class="fa fa-paper-plane"> Send</i> | ||
410 | - </button> | ||
411 | - </span> | ||
412 | - </div> | ||
413 | - </div> | ||
414 | - </div> | ||
415 | - | ||
416 | - <!--/.First row--> | ||
417 | - | ||
418 | - <!--Second row--> | ||
419 | - <div class="row"> | ||
420 | - | ||
421 | - <!--Content column--> | ||
422 | - <div class="col-sm-10 col-xs-12"> | ||
423 | - <h3 class="user-name">Cherielly</h3> | ||
424 | - | ||
425 | - <div class="card-data"> | ||
426 | - <p class="comment-date"><i class="fa fa-clock-o"></i> 08/10/2015</p> | ||
427 | - </div> | ||
428 | - | ||
429 | - <p class="comment-text">Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam | ||
430 | - voluptatem quia voluptas sit aspernatur.</p> | ||
431 | - </div> | ||
432 | - <!--/.Content column--> | ||
433 | - </div> | ||
434 | - <a class="btn btn-sm" style="float: right;" data-toggle="collapse" href="#collapse2" aria-expanded="false" aria-controls="collapseExample">Reply</a> | ||
435 | - <div class="collapse" id="collapse2"> | ||
436 | - <div class="md-form"> | ||
437 | - <div class="form-group is-empty"><input type="text" id="form1" class="form-control" placeholder="comment on the cometary"></div><span class="input-group-btn"> | ||
438 | - <button type="button" class="btn btn-sm"> | ||
439 | - <i class="fa fa-paper-plane"> Send</i> | ||
440 | - </button> | ||
441 | - </span> | ||
442 | - </div> | ||
443 | - </div> | ||
444 | - | ||
445 | - | ||
446 | - <!--/.Second row--> | ||
447 | 321 | ||
448 | - <!--Third row--> | ||
449 | - <div class="row"> | ||
450 | - | ||
451 | - | ||
452 | - <!--Content column--> | ||
453 | - <div class="col-sm-10 col-xs-12"> | ||
454 | - <h3 class="user-name">Gemozecleia</h3> | ||
455 | - | ||
456 | - <div class="card-data"> | ||
457 | - <p class="comment-date"><i class="fa fa-clock-o"></i> 17/10/2015 | ||
458 | - </p></div> | ||
459 | - | ||
460 | - <p class="comment-text">At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa | ||
461 | - qui officia. | ||
462 | - </p> | ||
463 | - </div> | ||
464 | - <!--/.Content column--> | ||
465 | - | ||
466 | - </div> | ||
467 | - <a class="btn btn-sm" style="float: right;" data-toggle="collapse" href="#collapse3" aria-expanded="false" aria-controls="collapseExample">Reply</a> | ||
468 | - <div class="collapse" id="collapse3"> | ||
469 | - <div class="md-form"> | ||
470 | - <div class="form-group is-empty"><input type="text" id="form1" class="form-control" placeholder="comment on the cometary"></div><span class="input-group-btn"> | ||
471 | - <button type="button" class="btn btn-sm"> | ||
472 | - <i class="fa fa-paper-plane"> Send</i> | ||
473 | - </button> | ||
474 | - </span> | ||
475 | - </div> | ||
476 | - </div> | ||
477 | - | ||
478 | - <!--/.Third row--> | ||
479 | - <div class="row"> | ||
480 | - <div class="form-group is-empty"> | ||
481 | - <div class="col-sm-10 col-xs-12"> | ||
482 | - <input type="text" id="addon3a" class="form-control" placeholder="Add Comment"> | ||
483 | - | ||
484 | - <span class="input-group-btn"> | ||
485 | - <button type="button" class="btn btn-fab btn-fab-mini"> | ||
486 | - <i class="material-icons">send</i> | ||
487 | - </button> | ||
488 | - </span> | ||
489 | - </div> | ||
490 | - </div> | ||
491 | - </div> | ||
492 | - | ||
493 | - </div> | ||
494 | - <div class="modal-footer"> | ||
495 | - <button type="button" class="btn btn-default" data-dismiss="modal">Close</button> | ||
496 | - <button type="button" class="btn btn-primary">Save changes</button> | ||
497 | - </div> | ||
498 | - </div> | ||
499 | - </div> | ||
500 | - </div> | ||
501 | - <!--EndForumModal--> | ||
502 | 322 | ||
503 | <!-- MODAL LINK EDIT--> | 323 | <!-- MODAL LINK EDIT--> |
504 | - <div class="modal fade" id="linksModalEdit" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"> | ||
505 | - <div class="modal-dialog" role="document"> | ||
506 | - <div class="modal-content"> | ||
507 | - <div class="modal-header"> | ||
508 | - <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> | ||
509 | - <h4 class="modal-title" id="myModalLabel">Links</h4> | ||
510 | - </div> | ||
511 | - <div class="modal-body"> | ||
512 | - <!-- Card --> | ||
513 | - <div class="form-group"> | ||
514 | - <label class="control-label" for="inputDefault">Name</label> | ||
515 | - <input value="Python" type="text" class="form-control" id="inputDefault"> | ||
516 | - </div> | ||
517 | - <div class="form-group"> | ||
518 | - <label class="control-label" for="inputDefault">Url</label> | ||
519 | - <input value="https://www.python.org/" type="text" class="form-control" id="inputDefault"> | ||
520 | - </div> | ||
521 | - <div class="form-group is-empty"> | ||
522 | - <label class="control-label" for="inputDefault">Descrição</label> | ||
523 | - <textarea class="form-control" rows="3"></textarea> | ||
524 | - </div> | ||
525 | - <div class="form-group"> | ||
526 | - <a href="javascript:void(0)" class="btn btn-raised btn-default">Cancel</a> | ||
527 | - <a href="javascript:void(0)" class="btn btn-raised btn-primary">Submit</a> | ||
528 | - </div> | ||
529 | - <!-- .end Card --> | ||
530 | - </div> | ||
531 | - </div> | ||
532 | - </div> | ||
533 | - </div> | 324 | + {% professor_subject topic.subject user as links_update %} |
325 | + {% if links_update%} | ||
326 | + {% include "links/update_link.html" %} | ||
327 | + {% endif %} | ||
328 | + | ||
534 | <!-- EndModal --> | 329 | <!-- EndModal --> |
535 | </div> | 330 | </div> |
536 | </div> | 331 | </div> |
@@ -553,4 +348,4 @@ | @@ -553,4 +348,4 @@ | ||
553 | </div> | 348 | </div> |
554 | </div> | 349 | </div> |
555 | </div> | 350 | </div> |
556 | - </div> | ||
557 | \ No newline at end of file | 351 | \ No newline at end of file |
352 | + </div> |
courses/templates/subject/index.html
1 | {% extends 'base.html' %} | 1 | {% extends 'base.html' %} |
2 | 2 | ||
3 | -{% load static i18n permission_tags %} | 3 | +{% load static i18n permission_tags professor_access%} |
4 | 4 | ||
5 | {% block breadcrumbs %} | 5 | {% block breadcrumbs %} |
6 | 6 | ||
@@ -12,7 +12,7 @@ | @@ -12,7 +12,7 @@ | ||
12 | {% else %} | 12 | {% else %} |
13 | <li class="active">{{ subject.name }}</li> | 13 | <li class="active">{{ subject.name }}</li> |
14 | {% endif %} | 14 | {% endif %} |
15 | - | 15 | + |
16 | </ol> | 16 | </ol> |
17 | {% endblock %} | 17 | {% endblock %} |
18 | 18 | ||
@@ -28,7 +28,7 @@ | @@ -28,7 +28,7 @@ | ||
28 | </ul> | 28 | </ul> |
29 | </div> | 29 | </div> |
30 | </div> | 30 | </div> |
31 | - | 31 | + |
32 | 32 | ||
33 | {% endblock %} | 33 | {% endblock %} |
34 | 34 | ||
@@ -39,7 +39,8 @@ | @@ -39,7 +39,8 @@ | ||
39 | <div class="col-md-9 col-sm-9"> | 39 | <div class="col-md-9 col-sm-9"> |
40 | <h3>{{subject}}</h3> | 40 | <h3>{{subject}}</h3> |
41 | </div> | 41 | </div> |
42 | - {% if user|has_role:'system_admin' or user in subject.professors %} | 42 | + {% professor_subject subject user as subject_professor%} |
43 | + {% if subject_professor %} | ||
43 | <div class="col-xs-4 col-md-3 divMoreActions"> | 44 | <div class="col-xs-4 col-md-3 divMoreActions"> |
44 | <div class="btn-group"> | 45 | <div class="btn-group"> |
45 | <button class="btn btn-default btn-sm dropdown-toggle" type="button" id="moreActions" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> | 46 | <button class="btn btn-default btn-sm dropdown-toggle" type="button" id="moreActions" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> |
@@ -71,19 +72,20 @@ | @@ -71,19 +72,20 @@ | ||
71 | </div> | 72 | </div> |
72 | </div> | 73 | </div> |
73 | </div> | 74 | </div> |
74 | - | 75 | + |
75 | {% for topic in topics %} | 76 | {% for topic in topics %} |
76 | - {% if user|has_role:'system_admin' or topic.owner == user%} | 77 | + {% professor_subject topic.subject user as topic_professor%} |
78 | + {% if topic_professor %} | ||
77 | {% include "subject/form_view_teacher.html" %} | 79 | {% include "subject/form_view_teacher.html" %} |
78 | {% else %} | 80 | {% else %} |
79 | {% include "subject/form_view_student.html" %} | 81 | {% include "subject/form_view_student.html" %} |
80 | {% endif %} | 82 | {% endif %} |
81 | {% endfor %} | 83 | {% endfor %} |
82 | - | ||
83 | - {% if user|has_role:'system_admin' or topic.owner == user%} | 84 | + {% professor_subject subject user as professor_sub %} |
85 | + {% if professor_sub %} | ||
84 | <div class="form-group"> | 86 | <div class="form-group"> |
85 | <a href="{% url 'course:create_topic' subject.slug %}" data-toggle="modal" data-target="" class="btn btn-primary btn-lg btn-block btn-raised" name="create_topic">{% trans "Create Topic" %}<div class="ripple-container"></div></a> | 87 | <a href="{% url 'course:create_topic' subject.slug %}" data-toggle="modal" data-target="" class="btn btn-primary btn-lg btn-block btn-raised" name="create_topic">{% trans "Create Topic" %}<div class="ripple-container"></div></a> |
86 | </div> | 88 | </div> |
87 | - {% endif %} | 89 | + {% endif %} |
88 | 90 | ||
89 | {% endblock %} | 91 | {% endblock %} |
courses/templates/subject/poll_item_actions.html
1 | -{% load static i18n permission_tags%} | 1 | +{% load static i18n permission_tags professor_access %} |
2 | 2 | ||
3 | <script src="{% static 'js/modals_requisitions.js'%}"></script> | 3 | <script src="{% static 'js/modals_requisitions.js'%}"></script> |
4 | <script src="{% static 'js/modal_poll.js'%}"></script> | 4 | <script src="{% static 'js/modal_poll.js'%}"></script> |
5 | 5 | ||
6 | -{% if request.user|has_role:'professor, system_admin'%} | ||
7 | {% for poll in polls %} | 6 | {% for poll in polls %} |
8 | - <li id="poll_{{poll.slug}}"><i class="material-icons">poll</i> <a href="javascript:get('{% url 'course:poll:update_poll' poll.slug %}','#poll','#modal_poll');">{{ poll.name }}</a><a href="javascript:get('{% url 'course:poll:delete_poll' poll.slug %}','#poll','#modal_poll');"><span class="glyphicon glyphicon-remove"></span></a></li> | ||
9 | -{% endfor %} | ||
10 | -<button class="btn btn-primary btn-raised" onclick="javascript:get('{% url 'course:poll:create_poll' topic.slug%}','#poll','#modal_poll');">{% trans '+ Create Poll' %}</button> | ||
11 | -{% else %} | ||
12 | -{% for poll in polls %} | ||
13 | - <li id="poll_{{poll.slug}}"><i class="material-icons">poll</i> <a href="javascript:get('{% url 'course:poll:view_poll' poll.slug %}','#poll','#modal_poll');">{{ poll.name }}</a></li> | ||
14 | -{% endfor %} | ||
15 | -{% endif %} | 7 | + {% professor_subject poll.topic.subject request.user as permission%} |
8 | + {% if permission %} | ||
9 | + <li id="poll_{{poll.slug}}"><i class="material-icons">poll</i> <a href="javascript:modal.get('{% url 'course:poll:update_poll' poll.slug %}','#poll','#modal_poll');">{{ poll.name }}</a><a href="javascript:modal.get('{% url 'course:poll:delete_poll' poll.slug %}','#poll','#modal_poll');"><span class="glyphicon glyphicon-remove"></span></a></li> | ||
10 | + {% else %} | ||
11 | + <li id="poll_{{poll.slug}}"><i class="material-icons">poll</i> <a href="javascript:modal.get('{% url 'course:poll:view_poll' poll.slug %}','#poll','#modal_poll');">{{ poll.name }}</a></li> | ||
12 | + {% endif %} | ||
13 | + {% endfor %} | ||
14 | +{# <button class="btn btn-primary btn-raised" onclick="javascript:modal.get('{% url 'course:poll:create_poll' topic.slug%}','#poll','#modal_poll');">{% trans '+ Create Poll' %}</button> #} | ||
16 | <div class="row" id="modal_poll"> | 15 | <div class="row" id="modal_poll"> |
17 | 16 | ||
18 | </div> | 17 | </div> |
courses/templates/subject_category/index.html
1 | {% extends 'base.html' %} | 1 | {% extends 'base.html' %} |
2 | 2 | ||
3 | -{% load static i18n permission_tags %} | 3 | +{% load static i18n permission_tags professor_access%} |
4 | 4 | ||
5 | {% block breadcrumbs %} | 5 | {% block breadcrumbs %} |
6 | 6 | ||
7 | <ol class="breadcrumb"> | 7 | <ol class="breadcrumb"> |
8 | <li><a href="{% url 'app:index' %}">{% trans 'Home' %}</a></li> | 8 | <li><a href="{% url 'app:index' %}">{% trans 'Home' %}</a></li> |
9 | - | ||
10 | - | 9 | + |
10 | + | ||
11 | </ol> | 11 | </ol> |
12 | {% endblock %} | 12 | {% endblock %} |
13 | 13 | ||
@@ -43,12 +43,14 @@ | @@ -43,12 +43,14 @@ | ||
43 | <h3>{{subject}}</h3> | 43 | <h3>{{subject}}</h3> |
44 | </div> | 44 | </div> |
45 | <div class="col-md-2 col-sm-2"> | 45 | <div class="col-md-2 col-sm-2"> |
46 | - {% if user|has_role:'system_admin' or user in subject.professors %} | 46 | + {% professor_subject subject user as professor_sub%} |
47 | + {% if professor_sub %} | ||
47 | <a href="" class="btn">{% trans "edit" %}</a> | 48 | <a href="" class="btn">{% trans "edit" %}</a> |
48 | {% endif %} | 49 | {% endif %} |
49 | </div> | 50 | </div> |
50 | <div class="col-md-3 col-sm-3"> | 51 | <div class="col-md-3 col-sm-3"> |
51 | - {% if user|has_role:'system_admin' or user in subject.professors %} | 52 | + {% professor_subject subject user as delete_sub%} |
53 | + {% if delete_sub %} | ||
52 | <a href="" class="btn">{% trans "delete" %}</a> | 54 | <a href="" class="btn">{% trans "delete" %}</a> |
53 | {% endif %} | 55 | {% endif %} |
54 | </div> | 56 | </div> |
@@ -60,6 +62,6 @@ | @@ -60,6 +62,6 @@ | ||
60 | </p> | 62 | </p> |
61 | </div> | 63 | </div> |
62 | </div> | 64 | </div> |
63 | - | 65 | + |
64 | 66 | ||
65 | {% endblock %} | 67 | {% endblock %} |
courses/templates/topic/index.html
1 | {% extends 'base.html' %} | 1 | {% extends 'base.html' %} |
2 | 2 | ||
3 | -{% load static i18n permission_tags %} | 3 | +{% load static i18n permission_tags professor_access %} |
4 | 4 | ||
5 | {% block breadcrumbs %} | 5 | {% block breadcrumbs %} |
6 | 6 | ||
7 | <ol class="breadcrumb"> | 7 | <ol class="breadcrumb"> |
8 | <li><a href="{% url 'app:index' %}">{% trans 'Home' %}</a></li> | 8 | <li><a href="{% url 'app:index' %}">{% trans 'Home' %}</a></li> |
9 | <li><a href="{% url 'course:view_subject' subject.slug %}">{{ subject }}</a></li> | 9 | <li><a href="{% url 'course:view_subject' subject.slug %}">{{ subject }}</a></li> |
10 | - {% if user|has_role:'professor' or user|has_role:'system_admin' %} | 10 | + {% professor_subject subject user as maneger_topic%} |
11 | + {% if maneger_topic %} | ||
11 | <li class="active">{% trans 'Manage Topic' %}</li> | 12 | <li class="active">{% trans 'Manage Topic' %}</li> |
12 | {% else %} | 13 | {% else %} |
13 | <li class="active">{{ topic.name }}</li> | 14 | <li class="active">{{ topic.name }}</li> |
@@ -54,7 +55,8 @@ | @@ -54,7 +55,8 @@ | ||
54 | <h3>{{subject}}</h3> | 55 | <h3>{{subject}}</h3> |
55 | </div> | 56 | </div> |
56 | <div class="col-xs-4 col-md-2 divMoreActions"> | 57 | <div class="col-xs-4 col-md-2 divMoreActions"> |
57 | - {% if user|has_role:'system_admin' or user in subject.professors %} | 58 | + {% professor_subject subject user as permissions%} |
59 | + {% if permissions %} | ||
58 | <div class="btn-group"> | 60 | <div class="btn-group"> |
59 | <button class="btn btn-default btn-sm dropdown-toggle" type="button" id="moreActions" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> | 61 | <button class="btn btn-default btn-sm dropdown-toggle" type="button" id="moreActions" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> |
60 | <i class="fa fa-ellipsis-v fa-2x" aria-hidden="true"></i> | 62 | <i class="fa fa-ellipsis-v fa-2x" aria-hidden="true"></i> |
@@ -105,7 +107,8 @@ | @@ -105,7 +107,8 @@ | ||
105 | <div class="col-md-4"> | 107 | <div class="col-md-4"> |
106 | <i class="fa fa-file-archive-o fa-lg" aria-hidden="true">Atividade.doc</i> | 108 | <i class="fa fa-file-archive-o fa-lg" aria-hidden="true">Atividade.doc</i> |
107 | </div> | 109 | </div> |
108 | - {% if user|has_role:'professor, system_admin' %} | 110 | + {% professor_subject subject user as permi_test%} |
111 | + {% if permi_test %} | ||
109 | <div class="col-md-4"> | 112 | <div class="col-md-4"> |
110 | <label> Nota:</label> | 113 | <label> Nota:</label> |
111 | <input type="number" step="0.01"> | 114 | <input type="number" step="0.01"> |
courses/templates/topic/list_topic_foruns.html
1 | {% for forum in foruns %} | 1 | {% for forum in foruns %} |
2 | - <a id="forum_{{ forum.id }}" href="{% url 'course:forum:view' forum.slug %}">{{ forum }}<br /></a> | 2 | + <li><i class="fa fa-commenting" aria-hidden="true"></i> <a id="forum_{{ forum.id }}" href="{% url 'course:forum:view' forum.slug %}"> {{ forum }}</a></li> |
3 | {% endfor %} | 3 | {% endfor %} |
4 | \ No newline at end of file | 4 | \ No newline at end of file |
courses/urls.py
@@ -22,12 +22,14 @@ urlpatterns = [ | @@ -22,12 +22,14 @@ urlpatterns = [ | ||
22 | url(r'^topics/update/(?P<slug>[\w_-]+)/$', views.UpdateTopicView.as_view(), name='update_topic'), | 22 | url(r'^topics/update/(?P<slug>[\w_-]+)/$', views.UpdateTopicView.as_view(), name='update_topic'), |
23 | url(r'^topics/createlink/$', linkviews.CreateLink.as_view(),name = 'create_link'), | 23 | url(r'^topics/createlink/$', linkviews.CreateLink.as_view(),name = 'create_link'), |
24 | url(r'^topics/deletelink/(?P<linkname>[\w_-]+)/$', linkviews.deleteLink,name = 'delete_link'), | 24 | url(r'^topics/deletelink/(?P<linkname>[\w_-]+)/$', linkviews.deleteLink,name = 'delete_link'), |
25 | + url(r'^topics/updatelink/(?P<linkname>[\w_-]+)/$', linkviews.UpdateLink.as_view(),name = 'update_link'), | ||
25 | url(r'^topics/(?P<slug>[\w_-]+)/$', views.TopicsView.as_view(), name='view_topic'), | 26 | url(r'^topics/(?P<slug>[\w_-]+)/$', views.TopicsView.as_view(), name='view_topic'), |
26 | url(r'^subjects/categories$',views.IndexSubjectCategoryView.as_view(), name='subject_category_index'), | 27 | url(r'^subjects/categories$',views.IndexSubjectCategoryView.as_view(), name='subject_category_index'), |
27 | url(r'^forum/', include('forum.urls', namespace = 'forum')), | 28 | url(r'^forum/', include('forum.urls', namespace = 'forum')), |
28 | url(r'^poll/', include('poll.urls', namespace = 'poll')), | 29 | url(r'^poll/', include('poll.urls', namespace = 'poll')), |
29 | url(r'^exam/', include('exam.urls', namespace = 'exam')), | 30 | url(r'^exam/', include('exam.urls', namespace = 'exam')), |
30 | url(r'^files/', include('files.urls', namespace = 'file')), | 31 | url(r'^files/', include('files.urls', namespace = 'file')), |
32 | + url(r'^upload-material/$', views.UploadMaterialView.as_view(), name='upload_material'), | ||
31 | 33 | ||
32 | 34 | ||
33 | 35 |
courses/views.py
@@ -13,10 +13,11 @@ from rolepermissions.verifications import has_object_permission | @@ -13,10 +13,11 @@ from rolepermissions.verifications import has_object_permission | ||
13 | from django.http import HttpResponseRedirect | 13 | from django.http import HttpResponseRedirect |
14 | 14 | ||
15 | from .forms import CourseForm, UpdateCourseForm, CategoryCourseForm, SubjectForm,TopicForm,ActivityForm | 15 | from .forms import CourseForm, UpdateCourseForm, CategoryCourseForm, SubjectForm,TopicForm,ActivityForm |
16 | -from .models import Course, Subject, CourseCategory,Topic, SubjectCategory,Activity | 16 | +from .models import Course, Subject, CourseCategory,Topic, SubjectCategory,Activity, CategorySubject |
17 | from core.mixins import NotificationMixin | 17 | from core.mixins import NotificationMixin |
18 | from users.models import User | 18 | from users.models import User |
19 | from files.forms import FileForm | 19 | from files.forms import FileForm |
20 | +from files.models import TopicFile | ||
20 | 21 | ||
21 | from datetime import date | 22 | from datetime import date |
22 | 23 | ||
@@ -191,6 +192,23 @@ class CourseView(LoginRequiredMixin, NotificationMixin, generic.DetailView): | @@ -191,6 +192,23 @@ class CourseView(LoginRequiredMixin, NotificationMixin, generic.DetailView): | ||
191 | courses = self.request.user.courses.all() | 192 | courses = self.request.user.courses.all() |
192 | elif has_role(self.request.user, 'student'): | 193 | elif has_role(self.request.user, 'student'): |
193 | courses = self.request.user.courses_student.all() | 194 | courses = self.request.user.courses_student.all() |
195 | + | ||
196 | + categorys_subjects = None | ||
197 | + if has_role(self.request.user,'professor') or has_role(self.request.user,'system_admin'): | ||
198 | + categorys_subjects = CategorySubject.objects.filter(subject_category__professors__name = self.request.user.name).distinct() | ||
199 | + else: | ||
200 | + categorys_subjects = CategorySubject.objects.filter(subject_category__students__name = self.request.user.name).distinct() | ||
201 | + | ||
202 | + subjects_category = Subject.objects.filter(category__name = self.request.GET.get('category')) | ||
203 | + | ||
204 | + none = None | ||
205 | + q = self.request.GET.get('category', None) | ||
206 | + if q is None: | ||
207 | + none = True | ||
208 | + context['none'] = none | ||
209 | + | ||
210 | + context['subjects_category'] = subjects_category | ||
211 | + context['categorys_subjects'] = categorys_subjects | ||
194 | context['courses'] = courses | 212 | context['courses'] = courses |
195 | context['title'] = course.name | 213 | context['title'] = course.name |
196 | 214 | ||
@@ -300,14 +318,36 @@ class SubjectsView(LoginRequiredMixin, generic.ListView): | @@ -300,14 +318,36 @@ class SubjectsView(LoginRequiredMixin, generic.ListView): | ||
300 | return context | 318 | return context |
301 | 319 | ||
302 | def get_context_data(self, **kwargs): | 320 | def get_context_data(self, **kwargs): |
303 | - subject = get_object_or_404(Subject, slug = self.kwargs.get('slug')) | 321 | + |
304 | context = super(SubjectsView, self).get_context_data(**kwargs) | 322 | context = super(SubjectsView, self).get_context_data(**kwargs) |
323 | + subject = get_object_or_404(Subject, slug = self.kwargs.get('slug')) | ||
305 | context['course'] = subject.course | 324 | context['course'] = subject.course |
306 | context['subject'] = subject | 325 | context['subject'] = subject |
307 | - context['form_file'] = FileForm | ||
308 | context['topics'] = Topic.objects.filter(subject = subject) | 326 | context['topics'] = Topic.objects.filter(subject = subject) |
327 | + if has_role(self.request.user,'professor') or has_role(self.request.user,'system_admin'): | ||
328 | + context['files'] = TopicFile.objects.filter(professor__name = self.request.user.name) | ||
329 | + else: | ||
330 | + context['files'] = TopicFile.objects.filter(students__name = self.request.user.name) | ||
331 | + return context | ||
332 | + | ||
333 | +class UploadMaterialView(LoginRequiredMixin, generic.edit.CreateView): | ||
334 | + login_url = reverse_lazy("core:home") | ||
335 | + redirect_field_name = 'next' | ||
336 | + | ||
337 | + template_name = 'files/create_file.html' | ||
338 | + form_class = FileForm | ||
339 | + | ||
340 | + def form_invalid(self, form): | ||
341 | + context = super(UploadMaterialView, self).form_invalid(form) | ||
342 | + context.status_code = 400 | ||
343 | + | ||
309 | return context | 344 | return context |
310 | 345 | ||
346 | + def get_success_url(self): | ||
347 | + self.success_url = reverse('course:view_subject', args = (self.object.slug, )) | ||
348 | + | ||
349 | + return self.success_url | ||
350 | + | ||
311 | class TopicsView(LoginRequiredMixin, generic.ListView): | 351 | class TopicsView(LoginRequiredMixin, generic.ListView): |
312 | 352 | ||
313 | login_url = reverse_lazy("core:home") | 353 | login_url = reverse_lazy("core:home") |
exam/migrations/0001_initial.py
1 | # -*- coding: utf-8 -*- | 1 | # -*- coding: utf-8 -*- |
2 | -# Generated by Django 1.10 on 2016-10-17 12:31 | 2 | +# Generated by Django 1.10 on 2016-10-18 02:47 |
3 | from __future__ import unicode_literals | 3 | from __future__ import unicode_literals |
4 | 4 | ||
5 | from django.db import migrations, models | 5 | from django.db import migrations, models |
@@ -23,9 +23,9 @@ class Migration(migrations.Migration): | @@ -23,9 +23,9 @@ class Migration(migrations.Migration): | ||
23 | ('order', models.PositiveSmallIntegerField(verbose_name='Order')), | 23 | ('order', models.PositiveSmallIntegerField(verbose_name='Order')), |
24 | ], | 24 | ], |
25 | options={ | 25 | options={ |
26 | + 'verbose_name_plural': 'Answers', | ||
26 | 'verbose_name': 'Answer', | 27 | 'verbose_name': 'Answer', |
27 | 'ordering': ('order',), | 28 | 'ordering': ('order',), |
28 | - 'verbose_name_plural': 'Answers', | ||
29 | }, | 29 | }, |
30 | ), | 30 | ), |
31 | migrations.CreateModel( | 31 | migrations.CreateModel( |
files/admin.py
1 | from django.contrib import admin | 1 | from django.contrib import admin |
2 | 2 | ||
3 | from .models import TopicFile | 3 | from .models import TopicFile |
4 | +class TopicFileAdmin(admin.ModelAdmin): | ||
5 | + list_display = ['name', 'slug'] | ||
6 | + search_fields = ['name', 'slug'] | ||
4 | 7 | ||
5 | -admin.site.register(TopicFile) | ||
6 | \ No newline at end of file | 8 | \ No newline at end of file |
9 | +admin.site.register(TopicFile, TopicFileAdmin) |
files/migrations/0001_initial.py
1 | # -*- coding: utf-8 -*- | 1 | # -*- coding: utf-8 -*- |
2 | -# Generated by Django 1.10 on 2016-10-17 12:25 | 2 | +# Generated by Django 1.10 on 2016-10-18 02:47 |
3 | from __future__ import unicode_literals | 3 | from __future__ import unicode_literals |
4 | 4 | ||
5 | +from django.conf import settings | ||
5 | from django.db import migrations, models | 6 | from django.db import migrations, models |
6 | import django.db.models.deletion | 7 | import django.db.models.deletion |
7 | import files.models | 8 | import files.models |
@@ -12,8 +13,9 @@ class Migration(migrations.Migration): | @@ -12,8 +13,9 @@ class Migration(migrations.Migration): | ||
12 | initial = True | 13 | initial = True |
13 | 14 | ||
14 | dependencies = [ | 15 | dependencies = [ |
15 | - ('core', '0001_initial'), | ||
16 | ('courses', '0001_initial'), | 16 | ('courses', '0001_initial'), |
17 | + migrations.swappable_dependency(settings.AUTH_USER_MODEL), | ||
18 | + ('core', '0001_initial'), | ||
17 | ] | 19 | ] |
18 | 20 | ||
19 | operations = [ | 21 | operations = [ |
@@ -24,10 +26,11 @@ class Migration(migrations.Migration): | @@ -24,10 +26,11 @@ class Migration(migrations.Migration): | ||
24 | ('description', models.TextField(blank=True, verbose_name='Description')), | 26 | ('description', models.TextField(blank=True, verbose_name='Description')), |
25 | ('file_url', models.FileField(upload_to=files.models.file_path, verbose_name='File')), | 27 | ('file_url', models.FileField(upload_to=files.models.file_path, verbose_name='File')), |
26 | ('file_type', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='topic_files', to='core.MimeType', verbose_name='Type file')), | 28 | ('file_type', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='topic_files', to='core.MimeType', verbose_name='Type file')), |
29 | + ('professor', models.ManyToManyField(related_name='file_professors', to=settings.AUTH_USER_MODEL, verbose_name='Professors')), | ||
27 | ], | 30 | ], |
28 | options={ | 31 | options={ |
29 | - 'verbose_name': 'File', | ||
30 | 'verbose_name_plural': 'Files', | 32 | 'verbose_name_plural': 'Files', |
33 | + 'verbose_name': 'File', | ||
31 | 'ordering': ('-id',), | 34 | 'ordering': ('-id',), |
32 | }, | 35 | }, |
33 | bases=('courses.material',), | 36 | bases=('courses.material',), |
files/models.py
@@ -2,6 +2,7 @@ from django.db import models | @@ -2,6 +2,7 @@ from django.db import models | ||
2 | from django.utils.translation import ugettext_lazy as _ | 2 | from django.utils.translation import ugettext_lazy as _ |
3 | from core.models import MimeType | 3 | from core.models import MimeType |
4 | from courses.models import Material | 4 | from courses.models import Material |
5 | +from users.models import User | ||
5 | 6 | ||
6 | """ | 7 | """ |
7 | Function to return the path where the file should be saved | 8 | Function to return the path where the file should be saved |
@@ -15,6 +16,8 @@ def file_path(instance, filename): | @@ -15,6 +16,8 @@ def file_path(instance, filename): | ||
15 | It's like a support material for the students. | 16 | It's like a support material for the students. |
16 | """ | 17 | """ |
17 | class TopicFile(Material): | 18 | class TopicFile(Material): |
19 | + | ||
20 | + professor = models.ManyToManyField(User,verbose_name=_('Professors'), related_name='file_professors') | ||
18 | description = models.TextField(_('Description'), blank=True) | 21 | description = models.TextField(_('Description'), blank=True) |
19 | file_url = models.FileField(verbose_name = _("File"), upload_to = file_path) | 22 | file_url = models.FileField(verbose_name = _("File"), upload_to = file_path) |
20 | file_type = models.ForeignKey(MimeType, verbose_name=_('Type file'), related_name='topic_files') | 23 | file_type = models.ForeignKey(MimeType, verbose_name=_('Type file'), related_name='topic_files') |
files/templates/files/create_file.html
@@ -111,5 +111,4 @@ | @@ -111,5 +111,4 @@ | ||
111 | event.preventDefault(); | 111 | event.preventDefault(); |
112 | }); | 112 | }); |
113 | </script> | 113 | </script> |
114 | -{% endblock script_file %} | ||
115 | -<!-- EndModal --> | ||
116 | \ No newline at end of file | 114 | \ No newline at end of file |
115 | +{% endblock script_file %} | ||
117 | \ No newline at end of file | 116 | \ No newline at end of file |
forum/migrations/0001_initial.py
1 | # -*- coding: utf-8 -*- | 1 | # -*- coding: utf-8 -*- |
2 | -# Generated by Django 1.10 on 2016-10-17 12:25 | 2 | +# Generated by Django 1.10 on 2016-10-18 02:48 |
3 | from __future__ import unicode_literals | 3 | from __future__ import unicode_literals |
4 | 4 | ||
5 | from django.conf import settings | 5 | from django.conf import settings |
forum/static/js/forum.js
@@ -83,7 +83,7 @@ function setForumCreateFormSubmit() { | @@ -83,7 +83,7 @@ function setForumCreateFormSubmit() { | ||
83 | success: function (data) { | 83 | success: function (data) { |
84 | data = data.split('-'); | 84 | data = data.split('-'); |
85 | 85 | ||
86 | - $('.foruns_list').append("<a id='forum_"+data[1]+"' href='"+data[0]+"'>"+data[2]+"<br /></a>"); | 86 | + $('.foruns_list').append("<li><i class='fa fa-commenting' aria-hidden='true'></i> <a id='forum_"+data[1]+"' href='"+data[0]+"'> "+data[2]+"</a></li>"); |
87 | 87 | ||
88 | $("#createForum").modal('hide'); | 88 | $("#createForum").modal('hide'); |
89 | 89 |
forum/templates/post/post_list.html
@@ -27,7 +27,7 @@ | @@ -27,7 +27,7 @@ | ||
27 | <div class="post_content"> | 27 | <div class="post_content"> |
28 | <div class="card-data"> | 28 | <div class="card-data"> |
29 | <p class="comment-date"> | 29 | <p class="comment-date"> |
30 | - <i class="fa fa-clock-o"></i> {{ post.post_date }} | 30 | + <i class="fa fa-clock-o"></i> {{ post.post_date|timesince }} {% trans 'ago' %} |
31 | {% if post.is_modified %} | 31 | {% if post.is_modified %} |
32 | <em> - {% trans 'Edited' %}</em> | 32 | <em> - {% trans 'Edited' %}</em> |
33 | {% endif %} | 33 | {% endif %} |
forum/templates/post/post_render.html
@@ -25,7 +25,7 @@ | @@ -25,7 +25,7 @@ | ||
25 | <div class="post_content"> | 25 | <div class="post_content"> |
26 | <div class="card-data"> | 26 | <div class="card-data"> |
27 | <p class="comment-date"> | 27 | <p class="comment-date"> |
28 | - <i class="fa fa-clock-o"></i> {{ post.post_date }} | 28 | + <i class="fa fa-clock-o"></i> {{ post.post_date|timesince }} {% trans 'ago' %} |
29 | {% if post.post_date != post.modifiction_date %} | 29 | {% if post.post_date != post.modifiction_date %} |
30 | <em> - {% trans 'Edited' %}</em> | 30 | <em> - {% trans 'Edited' %}</em> |
31 | {% endif %} | 31 | {% endif %} |
links/forms.py
@@ -3,11 +3,12 @@ from .models import Link | @@ -3,11 +3,12 @@ from .models import Link | ||
3 | import validators | 3 | import validators |
4 | 4 | ||
5 | class CreateLinkForm(forms.ModelForm): | 5 | class CreateLinkForm(forms.ModelForm): |
6 | - def validate_link(self,link): | 6 | + |
7 | + def clean_link(self): | ||
8 | + link = self.cleaned_data['link'] | ||
7 | if not validators.url(link): | 9 | if not validators.url(link): |
8 | raise forms.ValidationError(_('Please enter a valid URL')) | 10 | raise forms.ValidationError(_('Please enter a valid URL')) |
9 | - else: | ||
10 | - return link | 11 | + return link |
11 | 12 | ||
12 | class Meta: | 13 | class Meta: |
13 | model = Link | 14 | model = Link |
links/migrations/0001_initial.py
1 | # -*- coding: utf-8 -*- | 1 | # -*- coding: utf-8 -*- |
2 | -# Generated by Django 1.10 on 2016-10-17 12:25 | 2 | +# Generated by Django 1.10 on 2016-10-18 02:47 |
3 | from __future__ import unicode_literals | 3 | from __future__ import unicode_literals |
4 | 4 | ||
5 | from django.db import migrations, models | 5 | from django.db import migrations, models |
@@ -22,8 +22,8 @@ class Migration(migrations.Migration): | @@ -22,8 +22,8 @@ class Migration(migrations.Migration): | ||
22 | ('description', models.CharField(max_length=200)), | 22 | ('description', models.CharField(max_length=200)), |
23 | ], | 23 | ], |
24 | options={ | 24 | options={ |
25 | - 'verbose_name': 'Link', | ||
26 | 'verbose_name_plural': 'Links', | 25 | 'verbose_name_plural': 'Links', |
26 | + 'verbose_name': 'Link', | ||
27 | }, | 27 | }, |
28 | ), | 28 | ), |
29 | ] | 29 | ] |
@@ -0,0 +1,32 @@ | @@ -0,0 +1,32 @@ | ||
1 | +<!--MODAL CREATE LINK--> | ||
2 | +<div class="modal fade" id="createLinksModal" tabindex="-1" role="dialog" aria-labelledby="createLink" style="display: none;"> | ||
3 | + <div class="modal-dialog" role="document"> | ||
4 | + <div class="modal-content"> | ||
5 | + <div class="modal-header"> | ||
6 | + <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> | ||
7 | + <h4 class="modal-title" id="createLink">Create a New Link</h4> | ||
8 | + </div> | ||
9 | + <div class="modal-body"> | ||
10 | + <!-- Card --> | ||
11 | + <div class="form-group is-empty"> | ||
12 | + <label class="control-label" for="inputDefault">Name</label> | ||
13 | + <input type="text" class="form-control" id="inputDefault"> | ||
14 | + </div> | ||
15 | + <div class="form-group is-empty"> | ||
16 | + <label class="control-label" for="inputDefault">Url</label> | ||
17 | + <input type="text" class="form-control" id="inputDefault"> | ||
18 | + </div> | ||
19 | + <div class="form-group is-empty"> | ||
20 | + <label class="control-label" for="inputDefault">Descrição</label> | ||
21 | + <textarea class="form-control" rows="3"></textarea> | ||
22 | + </div> | ||
23 | + <div class="form-group"> | ||
24 | + <a href="javascript:void(0)" class="btn btn-raised btn-default" data-dismiss="modal">Cancel</a> | ||
25 | + <a href="javascript:void(0)" class="btn btn-raised btn-primary">Submit</a> | ||
26 | + </div> | ||
27 | + <!-- .end Card --> | ||
28 | + </div> | ||
29 | + </div> | ||
30 | + </div> | ||
31 | +</div> | ||
32 | +<!-- EndModal --> |
@@ -0,0 +1,21 @@ | @@ -0,0 +1,21 @@ | ||
1 | +<!-- MODAL REMOVE LINK --> | ||
2 | +<div class="modal" id="removeLink"> | ||
3 | + <div class="modal-dialog"> | ||
4 | + <div class="modal-content"> | ||
5 | + <div class="modal-header"> | ||
6 | + <button type="button" class="close" data-dismiss="modal" aria-hidden="true">X</button> | ||
7 | + <h4 class="modal-title"></h4> | ||
8 | + </div> | ||
9 | + <div class="modal-body"> | ||
10 | + <p>Do you really want to delete this link?</p> | ||
11 | + </div> | ||
12 | + <div class="modal-footer"> | ||
13 | + <!-- --> | ||
14 | + <button type="button" class="btn btn-primary btn-default" data-dismiss="modal">Cancel</button> | ||
15 | + <a href="http://www.google.com" target="_self"><button type="button" class="btn btn-primary" data-dismiss="modal" aria-hidden="true">Confirm</button></a> | ||
16 | + | ||
17 | + </div> | ||
18 | + </div> | ||
19 | + </div> | ||
20 | +</div> | ||
21 | +<!-- END --> |
links/templates/links/link_modal.html
@@ -1,35 +0,0 @@ | @@ -1,35 +0,0 @@ | ||
1 | -{% extends 'base.html'%} | ||
2 | - | ||
3 | -{% for link in links%} | ||
4 | -<!-- <h1> TESTE {{link.name}} </h1> --> | ||
5 | -{% block content%} | ||
6 | - | ||
7 | -<div class="modal-content"> | ||
8 | - <div class="modal-header"> | ||
9 | - <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> | ||
10 | - <h4 class="modal-title" id="createLink">Create a New Link</h4> | ||
11 | - </div> | ||
12 | - <div class="modal-body"> | ||
13 | - | ||
14 | - <!-- Card --> | ||
15 | - <div class="form-group is-empty"> | ||
16 | - <label class="control-label" for="inputDefault">Name</label> | ||
17 | - <input type="text" class="form-control" id="inputDefault"> | ||
18 | - </div> | ||
19 | - <div class="form-group is-empty"> | ||
20 | - <label class="control-label" for="inputDefault">Url</label> | ||
21 | - <input type="text" class="form-control" id="inputDefault"> | ||
22 | - </div> | ||
23 | - <div class="form-group is-empty"> | ||
24 | - <label class="control-label" for="inputDefault">Descrição</label> | ||
25 | - <textarea class="form-control" rows="3"></textarea><grammarly-btn><div style="visibility: hidden; z-index: 2;" class="_9b5ef6-textarea_btn _9b5ef6-anonymous _9b5ef6-not_focused" data-grammarly-reactid=".i"><div class="_9b5ef6-transform_wrap" data-grammarly-reactid=".i.0"><div title="Protected by Grammarly" class="_9b5ef6-status" data-grammarly-reactid=".i.0.0"> </div></div><span class="_9b5ef6-btn_text" data-grammarly-reactid=".i.1">Not signed in</span></div></grammarly-btn> | ||
26 | - </div> | ||
27 | - <div class="form-group"> | ||
28 | - <a href="javascript:void(0)" class="btn btn-raised btn-default">Cancel</a> | ||
29 | - <a href="javascript:void(0)" class="btn btn-raised btn-primary">Submit</a> | ||
30 | - </div> | ||
31 | - <!-- .end Card --> | ||
32 | - </div> | ||
33 | - </div> | ||
34 | -{% endblock %} | ||
35 | -{%endfor%} |
@@ -0,0 +1,32 @@ | @@ -0,0 +1,32 @@ | ||
1 | +<!-- MODAL LINK EDIT--> | ||
2 | +<div class="modal fade" id="linksModalEdit" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"> | ||
3 | + <div class="modal-dialog" role="document"> | ||
4 | + <div class="modal-content"> | ||
5 | + <div class="modal-header"> | ||
6 | + <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> | ||
7 | + <h4 class="modal-title" id="myModalLabel">Links</h4> | ||
8 | + </div> | ||
9 | + <div class="modal-body"> | ||
10 | + <!-- Card --> | ||
11 | + <div class="form-group"> | ||
12 | + <label class="control-label" for="inputDefault">Name</label> | ||
13 | + <input value="Python" type="text" class="form-control" id="inputDefault"> | ||
14 | + </div> | ||
15 | + <div class="form-group"> | ||
16 | + <label class="control-label" for="inputDefault">Url</label> | ||
17 | + <input value="https://www.python.org/" type="text" class="form-control" id="inputDefault"> | ||
18 | + </div> | ||
19 | + <div class="form-group is-empty"> | ||
20 | + <label class="control-label" for="inputDefault">Descrição</label> | ||
21 | + <textarea class="form-control" rows="3"></textarea> | ||
22 | + </div> | ||
23 | + <div class="form-group"> | ||
24 | + <a href="javascript:void(0)" class="btn btn-raised btn-default" data-dismiss="modal">Cancel</a> | ||
25 | + <a href="javascript:void(0)" class="btn btn-raised btn-primary">Submit</a> | ||
26 | + </div> | ||
27 | + <!-- .end Card --> | ||
28 | + </div> | ||
29 | + </div> | ||
30 | + </div> | ||
31 | +</div> | ||
32 | +<!-- EndModal --> |
links/tests.py
@@ -29,12 +29,20 @@ class LinkTestCase(TestCase): | @@ -29,12 +29,20 @@ class LinkTestCase(TestCase): | ||
29 | "description" : 'testdescription', | 29 | "description" : 'testdescription', |
30 | "link" : 'teste.com' | 30 | "link" : 'teste.com' |
31 | } | 31 | } |
32 | - response = self.client.post(url, data) | ||
33 | - #self.assertEqual(response.status_code, 200) | ||
34 | - self.assertFormError(response,'form',"link",_("Please enter a valid URL")) | ||
35 | - self.assertEqual(Link.objects.all().count(),links+1) #After creating one link, if OK, the link was created successfully. | 32 | + response = self.client.post(url, data,format = 'json') |
33 | + link1 = Link.objects.get(name = data['name']) #Link criado com os dados inseridos corretamente | ||
34 | + self.assertEqual(Link.objects.filter(name= link1.name).exists(),True) #Verificada existência do link | ||
35 | + self.assertEqual(Link.objects.all().count(),links+1) #After creating link1, if OK, the link was created successfully. | ||
36 | self.assertEqual(response.status_code, 302) #If OK, User is getting redirected correctly. | 36 | self.assertEqual(response.status_code, 302) #If OK, User is getting redirected correctly. |
37 | - self.assertTemplateUsed(template_name = 'links/link_modal.html') | 37 | + self.assertTemplateUsed(template_name = 'links/create_link.html') |
38 | + data = { | ||
39 | + 'name' : 'testlink2', | ||
40 | + "description" : 'testdescription2', | ||
41 | + "link" : 'teste' | ||
42 | + } | ||
43 | + response = self.client.post(url, data,format = 'json') | ||
44 | + self.assertEqual(Link.objects.filter(name= data['name']).exists(),False) #Verificada não existência do link com campo errado | ||
45 | + | ||
38 | # def test_update_link(): | 46 | # def test_update_link(): |
39 | # pass | 47 | # pass |
40 | def test_delete_link(self): | 48 | def test_delete_link(self): |
links/views.py
@@ -10,7 +10,7 @@ from .forms import * | @@ -10,7 +10,7 @@ from .forms import * | ||
10 | 10 | ||
11 | # Create your views here. | 11 | # Create your views here. |
12 | class CreateLink(generic.CreateView): | 12 | class CreateLink(generic.CreateView): |
13 | - template_name = 'links/link_modal.html' | 13 | + template_name = 'links/create_link.html' |
14 | form_class = CreateLinkForm | 14 | form_class = CreateLinkForm |
15 | success_url = reverse_lazy('course:manage') | 15 | success_url = reverse_lazy('course:manage') |
16 | context_object_name = 'links' | 16 | context_object_name = 'links' |
@@ -18,22 +18,27 @@ class CreateLink(generic.CreateView): | @@ -18,22 +18,27 @@ class CreateLink(generic.CreateView): | ||
18 | def form_valid(self, form): | 18 | def form_valid(self, form): |
19 | form.save() | 19 | form.save() |
20 | messages.success(self.request, _('Link created successfully!')) | 20 | messages.success(self.request, _('Link created successfully!')) |
21 | + messages.error(self.request, _("An error occurred when trying to create the link")) | ||
21 | return super(CreateLink, self).form_valid(form) | 22 | return super(CreateLink, self).form_valid(form) |
22 | - def get_context_data(self, **kwargs): | ||
23 | - context = {} | ||
24 | - context['links'] = Link.objects.all() | ||
25 | - return context | 23 | + def get_context_data(self,**kwargs): |
24 | + context = {} | ||
25 | + context['links'] = Link.objects.all() | ||
26 | + context['form'] = CreateLinkForm | ||
27 | + return context | ||
26 | 28 | ||
27 | 29 | ||
28 | def deleteLink(request,linkname): | 30 | def deleteLink(request,linkname): |
29 | link = get_object_or_404(Link,name = linkname) | 31 | link = get_object_or_404(Link,name = linkname) |
30 | link.delete() | 32 | link.delete() |
33 | + template_name = 'links/delete_link.html' | ||
31 | messages.success(request,_("Link deleted Successfully!")) | 34 | messages.success(request,_("Link deleted Successfully!")) |
35 | + messages.error(request, _("An error occurred when trying to delete the link")) | ||
32 | return redirect('course:manage') | 36 | return redirect('course:manage') |
37 | +#Referencia no delete link para adicionar quando resolver o problema do context {% url 'course:delete' link.name %} | ||
33 | class UpdateLink(generic.UpdateView): | 38 | class UpdateLink(generic.UpdateView): |
34 | - template_name = 'links/' | 39 | + template_name = 'links/update_link.html' |
35 | form_class = UpdateLinkForm | 40 | form_class = UpdateLinkForm |
36 | - success_url = reverse_lazy() | 41 | + success_url = reverse_lazy('course:manage') |
37 | def form_valid(self, form): | 42 | def form_valid(self, form): |
38 | form.save() | 43 | form.save() |
39 | messages.success(self.request, _('Link updated successfully!')) | 44 | messages.success(self.request, _('Link updated successfully!')) |
poll/migrations/0001_initial.py
1 | # -*- coding: utf-8 -*- | 1 | # -*- coding: utf-8 -*- |
2 | -# Generated by Django 1.10 on 2016-10-17 12:25 | 2 | +# Generated by Django 1.10 on 2016-10-18 02:47 |
3 | from __future__ import unicode_literals | 3 | from __future__ import unicode_literals |
4 | 4 | ||
5 | from django.conf import settings | 5 | from django.conf import settings |
@@ -25,9 +25,9 @@ class Migration(migrations.Migration): | @@ -25,9 +25,9 @@ class Migration(migrations.Migration): | ||
25 | ('order', models.PositiveSmallIntegerField(verbose_name='Order')), | 25 | ('order', models.PositiveSmallIntegerField(verbose_name='Order')), |
26 | ], | 26 | ], |
27 | options={ | 27 | options={ |
28 | - 'ordering': ('order',), | ||
29 | 'verbose_name_plural': 'Answers', | 28 | 'verbose_name_plural': 'Answers', |
30 | 'verbose_name': 'Answer', | 29 | 'verbose_name': 'Answer', |
30 | + 'ordering': ('order',), | ||
31 | }, | 31 | }, |
32 | ), | 32 | ), |
33 | migrations.CreateModel( | 33 | migrations.CreateModel( |
poll/static/js/modal_poll.js
@@ -25,8 +25,7 @@ var Submite = { | @@ -25,8 +25,7 @@ var Submite = { | ||
25 | $("#modal_poll").empty(); | 25 | $("#modal_poll").empty(); |
26 | $("#modal_poll").append(data.responseText); | 26 | $("#modal_poll").append(data.responseText); |
27 | }); | 27 | }); |
28 | - } | ||
29 | - , | 28 | + }, |
30 | remove: function(url,dados, id_li_link){ | 29 | remove: function(url,dados, id_li_link){ |
31 | $('#poll').modal('hide'); | 30 | $('#poll').modal('hide'); |
32 | $.post(url,dados, function(data){ | 31 | $.post(url,dados, function(data){ |
poll/static/js/modals_requisitions.js
1 | -function get(url, id_modal, id_div_modal){ | ||
2 | - $.get(url, function(data){ | ||
3 | - if($(id_modal).length){ | ||
4 | - $(id_div_modal).empty(); | ||
5 | - $(id_div_modal).append(data); | ||
6 | - } else { | ||
7 | - $(id_div_modal).append(data); | ||
8 | - } | ||
9 | - $(id_modal).modal('show'); | ||
10 | - }); | ||
11 | -} | ||
12 | - | ||
13 | -// function remove(url, id_li_link){ | ||
14 | -// $.post(url, function(data){ | ||
15 | -// $(id_li_link).remove(); | ||
16 | -// }).fail(function(data){ | ||
17 | -// alert("Error ao excluir a enquete"); | ||
18 | -// alert(data); | ||
19 | -// }); | ||
20 | -// } | 1 | +var modal = { |
2 | + get: function (url, id_modal, id_div_modal){ | ||
3 | + $.get(url, function(data){ | ||
4 | + if($(id_modal).length){ | ||
5 | + $(id_div_modal).empty(); | ||
6 | + $(id_div_modal).append(data); | ||
7 | + } else { | ||
8 | + $(id_div_modal).append(data); | ||
9 | + } | ||
10 | + $(id_modal).modal('show'); | ||
11 | + }); | ||
12 | + } | ||
13 | +}; |
poll/static/sample.txt
poll/templates/poll/view.html
@@ -30,6 +30,6 @@ | @@ -30,6 +30,6 @@ | ||
30 | {% block button_save %} | 30 | {% block button_save %} |
31 | <!-- Put curtom buttons here!!! --> | 31 | <!-- Put curtom buttons here!!! --> |
32 | {% if not status %} | 32 | {% if not status %} |
33 | -<button type="button" onclick="javascript:get('{% url 'course:poll:answer_student_poll' poll.slug%}','#poll','#modal_poll');$('div.modal-backdrop.fade.in').remove();" class="btn btn-primary btn-raised">{% trans "Answer" %}</button> | 33 | +<button type="button" onclick="javascript:modal.get('{% url 'course:poll:answer_student_poll' poll.slug%}','#poll','#modal_poll');$('div.modal-backdrop.fade.in').remove();" class="btn btn-primary btn-raised">{% trans "Answer" %}</button> |
34 | {% endif %} | 34 | {% endif %} |
35 | {% endblock button_save %} | 35 | {% endblock button_save %} |
@@ -0,0 +1,14 @@ | @@ -0,0 +1,14 @@ | ||
1 | +from django import template | ||
2 | +from rolepermissions.verifications import has_role | ||
3 | + | ||
4 | +register = template.Library() | ||
5 | + | ||
6 | +@register.simple_tag | ||
7 | +def professor_subject(subject, user): | ||
8 | + if (has_role(user,'system_admin')): | ||
9 | + return True | ||
10 | + | ||
11 | + if (user in subject.professors.all()): | ||
12 | + return True | ||
13 | + | ||
14 | + return False |
poll/tests/poll.py
@@ -80,21 +80,23 @@ class PollTestCase(TestCase): | @@ -80,21 +80,23 @@ class PollTestCase(TestCase): | ||
80 | self.poll.save() | 80 | self.poll.save() |
81 | 81 | ||
82 | def test_poll_create(self): | 82 | def test_poll_create(self): |
83 | - self.client.login(username='professor', password='testing') | ||
84 | - poll = self.topic.activities.all().count() | ||
85 | url = reverse('course:poll:create_poll',kwargs={'slug':self.topic.slug}) | 83 | url = reverse('course:poll:create_poll',kwargs={'slug':self.topic.slug}) |
86 | data = { | 84 | data = { |
87 | "name": 'create poll test', | 85 | "name": 'create poll test', |
88 | "limit_date":'2016-10-06', | 86 | "limit_date":'2016-10-06', |
89 | "all_students":True, | 87 | "all_students":True, |
90 | } | 88 | } |
91 | - response = self.client.post(url, data) | ||
92 | - self.assertEqual(poll + 1, self.topic.activities.all().count()) # create a new poll | 89 | + |
93 | self.client.login(username='student', password='testing') | 90 | self.client.login(username='student', password='testing') |
94 | poll = self.topic.activities.all().count() | 91 | poll = self.topic.activities.all().count() |
95 | response = self.client.post(url, data) | 92 | response = self.client.post(url, data) |
96 | self.assertEqual(poll, self.topic.activities.all().count()) # don't create a new poll | 93 | self.assertEqual(poll, self.topic.activities.all().count()) # don't create a new poll |
97 | 94 | ||
95 | + self.client.login(username='professor', password='testing') | ||
96 | + poll = self.topic.activities.all().count() | ||
97 | + response = self.client.post(url, data) | ||
98 | + self.assertEqual(poll + 1, self.topic.activities.all().count()) # create a new poll | ||
99 | + | ||
98 | def test_poll_update(self): | 100 | def test_poll_update(self): |
99 | self.client.login(username='professor', password='testing') | 101 | self.client.login(username='professor', password='testing') |
100 | url = reverse('course:poll:update_poll',kwargs={'slug':self.poll.slug}) | 102 | url = reverse('course:poll:update_poll',kwargs={'slug':self.poll.slug}) |
poll/views.py
@@ -145,6 +145,8 @@ class UpdatePoll(LoginRequiredMixin,HasRoleMixin,generic.UpdateView): | @@ -145,6 +145,8 @@ class UpdatePoll(LoginRequiredMixin,HasRoleMixin,generic.UpdateView): | ||
145 | context['subject'] = poll.topic.subject | 145 | context['subject'] = poll.topic.subject |
146 | context['subjects'] = poll.topic.subject.course.subjects.all() | 146 | context['subjects'] = poll.topic.subject.course.subjects.all() |
147 | 147 | ||
148 | + print (self.request.user) | ||
149 | + | ||
148 | answers = {} | 150 | answers = {} |
149 | for answer in poll.answers.all(): | 151 | for answer in poll.answers.all(): |
150 | # print (key.answer) | 152 | # print (key.answer) |
requirements.txt
@@ -12,7 +12,6 @@ django-role-permissions==1.2.1 | @@ -12,7 +12,6 @@ django-role-permissions==1.2.1 | ||
12 | django-s3direct==0.4.2 | 12 | django-s3direct==0.4.2 |
13 | django-widget-tweaks==1.4.1 | 13 | django-widget-tweaks==1.4.1 |
14 | djangorestframework==3.4.6 | 14 | djangorestframework==3.4.6 |
15 | -itsdangerous==0.24 | ||
16 | gunicorn==19.6.0 | 15 | gunicorn==19.6.0 |
17 | Jinja2==2.8 | 16 | Jinja2==2.8 |
18 | MarkupSafe==0.23 | 17 | MarkupSafe==0.23 |
@@ -20,8 +19,6 @@ Pillow==3.3.1 | @@ -20,8 +19,6 @@ Pillow==3.3.1 | ||
20 | psycopg2==2.6.2 | 19 | psycopg2==2.6.2 |
21 | pycpfcnpj==1.0.2 | 20 | pycpfcnpj==1.0.2 |
22 | six==1.10.0 | 21 | six==1.10.0 |
23 | -slugify==0.0.1 | ||
24 | validators==0.11.0 | 22 | validators==0.11.0 |
25 | -virtualenv==15.0.3 | ||
26 | Werkzeug==0.11.11 | 23 | Werkzeug==0.11.11 |
27 | whitenoise==3.2.2 | 24 | whitenoise==3.2.2 |
28 | \ No newline at end of file | 25 | \ No newline at end of file |
users/admin.py
@@ -5,6 +5,5 @@ from .forms import AdminUserForm | @@ -5,6 +5,5 @@ from .forms import AdminUserForm | ||
5 | class UserAdmin(admin.ModelAdmin): | 5 | class UserAdmin(admin.ModelAdmin): |
6 | list_display = ['username', 'name', 'email', 'is_staff', 'is_active'] | 6 | list_display = ['username', 'name', 'email', 'is_staff', 'is_active'] |
7 | search_fields = ['username', 'name', 'email'] | 7 | search_fields = ['username', 'name', 'email'] |
8 | - # form = AdminUserForm | ||
9 | 8 | ||
10 | -admin.site.register(User, UserAdmin) | ||
11 | \ No newline at end of file | 9 | \ No newline at end of file |
10 | +admin.site.register(User, UserAdmin) |
users/migrations/0001_initial.py
1 | # -*- coding: utf-8 -*- | 1 | # -*- coding: utf-8 -*- |
2 | -# Generated by Django 1.10 on 2016-10-05 13:37 | 2 | +# Generated by Django 1.10 on 2016-10-17 15:49 |
3 | from __future__ import unicode_literals | 3 | from __future__ import unicode_literals |
4 | 4 | ||
5 | import django.contrib.auth.models | 5 | import django.contrib.auth.models |
@@ -42,8 +42,8 @@ class Migration(migrations.Migration): | @@ -42,8 +42,8 @@ class Migration(migrations.Migration): | ||
42 | ('user_permissions', models.ManyToManyField(blank=True, help_text='Specific permissions for this user.', related_name='user_set', related_query_name='user', to='auth.Permission', verbose_name='user permissions')), | 42 | ('user_permissions', models.ManyToManyField(blank=True, help_text='Specific permissions for this user.', related_name='user_set', related_query_name='user', to='auth.Permission', verbose_name='user permissions')), |
43 | ], | 43 | ], |
44 | options={ | 44 | options={ |
45 | - 'verbose_name': 'User', | ||
46 | 'verbose_name_plural': 'Users', | 45 | 'verbose_name_plural': 'Users', |
46 | + 'verbose_name': 'User', | ||
47 | }, | 47 | }, |
48 | managers=[ | 48 | managers=[ |
49 | ('objects', django.contrib.auth.models.UserManager()), | 49 | ('objects', django.contrib.auth.models.UserManager()), |
users/templates/list_users.html
@@ -16,6 +16,7 @@ | @@ -16,6 +16,7 @@ | ||
16 | </div> | 16 | </div> |
17 | <div class="panel-body"> | 17 | <div class="panel-body"> |
18 | <ul class="nav nav-pills nav-stacked"> | 18 | <ul class="nav nav-pills nav-stacked"> |
19 | + <li><a href="{% url 'core:home' %}">{% trans "Home" %}</a></li> | ||
19 | <li><a href="{% url 'users:create' %}">{% trans 'Add user' %}</a></li> | 20 | <li><a href="{% url 'users:create' %}">{% trans 'Add user' %}</a></li> |
20 | <li><a href="javascript:void(0)">{% trans 'Send email' %}</a></li> | 21 | <li><a href="javascript:void(0)">{% trans 'Send email' %}</a></li> |
21 | </ul> | 22 | </ul> |