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 @@ |
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 @@ |
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 @@ |
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 | -{% 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 | 0 | \ No newline at end of file |
app/templates/app/index.html
... | ... | @@ -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 | 119 | </div> |
120 | 120 | |
121 | 121 | {% else %} |
122 | - <ul class="timeline" style="-webkit-padding-start: 0px"> | |
122 | + | |
123 | 123 | <div id="timeline"> |
124 | 124 | {% include page_template %} |
125 | 125 | </div> |
126 | - </ul> | |
126 | + | |
127 | 127 | {% endif %} |
128 | 128 | |
129 | 129 | <div id="loading" class="alert alert-primary" role="alert" style="display: none"> | ... | ... |
app/templates/home_teacher_student_content.html
1 | 1 | {% load static i18n %} |
2 | 2 | |
3 | 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 | 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 | 21 | </div> |
18 | - </li> | |
22 | + </div> | |
23 | +</div> | |
19 | 24 | {% endfor %} |
20 | 25 | ... | ... |
core/admin.py
1 | 1 | from django.contrib import admin |
2 | - | |
3 | 2 | from .models import Action, Resource, Action_Resource, Log, MimeType |
4 | 3 | |
5 | 4 | class ActionAdmin(admin.ModelAdmin): |
... | ... | @@ -18,8 +17,12 @@ class LogAdmin(admin.ModelAdmin): |
18 | 17 | list_display = ['datetime', 'user', 'action_resource'] |
19 | 18 | search_fields = ['user'] |
20 | 19 | |
20 | +class MimeTypeAdmin(admin.ModelAdmin): | |
21 | + list_display = ['typ', 'icon'] | |
22 | + search_fields = ['typ', 'icon'] | |
23 | + | |
21 | 24 | admin.site.register(Action, ActionAdmin) |
22 | 25 | admin.site.register(Resource, ResourceAdmin) |
23 | 26 | admin.site.register(Action_Resource, ActionResourceAdmin) |
24 | 27 | admin.site.register(Log, LogAdmin) |
25 | -admin.site.register(MimeType) | |
26 | 28 | \ No newline at end of file |
29 | +admin.site.register(MimeType, MimeTypeAdmin) | ... | ... |
core/migrations/0001_initial.py
1 | 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 | 3 | from __future__ import unicode_literals |
4 | 4 | |
5 | 5 | import autoslug.fields |
... | ... | @@ -25,8 +25,8 @@ class Migration(migrations.Migration): |
25 | 25 | ('created_date', models.DateField(auto_now_add=True, verbose_name='Created Date')), |
26 | 26 | ], |
27 | 27 | options={ |
28 | - 'verbose_name_plural': 'Actions', | |
29 | 28 | 'verbose_name': 'Action', |
29 | + 'verbose_name_plural': 'Actions', | |
30 | 30 | }, |
31 | 31 | ), |
32 | 32 | migrations.CreateModel( |
... | ... | @@ -36,8 +36,8 @@ class Migration(migrations.Migration): |
36 | 36 | ('action', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.Action', verbose_name='Action_Applied')), |
37 | 37 | ], |
38 | 38 | options={ |
39 | - 'verbose_name_plural': 'Action_Resources', | |
40 | 39 | 'verbose_name': 'Action_Resource', |
40 | + 'verbose_name_plural': 'Action_Resources', | |
41 | 41 | }, |
42 | 42 | ), |
43 | 43 | migrations.CreateModel( |
... | ... | @@ -49,8 +49,8 @@ class Migration(migrations.Migration): |
49 | 49 | ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL, verbose_name='Actor')), |
50 | 50 | ], |
51 | 51 | options={ |
52 | - 'verbose_name_plural': 'Logs', | |
53 | 52 | 'verbose_name': 'Log', |
53 | + 'verbose_name_plural': 'Logs', | |
54 | 54 | }, |
55 | 55 | ), |
56 | 56 | migrations.CreateModel( |
... | ... | @@ -61,8 +61,8 @@ class Migration(migrations.Migration): |
61 | 61 | ('icon', models.CharField(max_length=50, unique=True, verbose_name='Icon')), |
62 | 62 | ], |
63 | 63 | options={ |
64 | - 'verbose_name_plural': 'Amadeus Mime Types', | |
65 | 64 | 'verbose_name': 'Amadeus Mime Type', |
65 | + 'verbose_name_plural': 'Amadeus Mime Types', | |
66 | 66 | }, |
67 | 67 | ), |
68 | 68 | migrations.CreateModel( |
... | ... | @@ -77,8 +77,8 @@ class Migration(migrations.Migration): |
77 | 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 | 79 | options={ |
80 | - 'verbose_name_plural': 'Notifications', | |
81 | 80 | 'verbose_name': 'Notification', |
81 | + 'verbose_name_plural': 'Notifications', | |
82 | 82 | }, |
83 | 83 | ), |
84 | 84 | migrations.CreateModel( |
... | ... | @@ -91,8 +91,8 @@ class Migration(migrations.Migration): |
91 | 91 | ('url', models.CharField(default='', max_length=100, verbose_name='URL')), |
92 | 92 | ], |
93 | 93 | options={ |
94 | - 'verbose_name_plural': 'Resources', | |
95 | 94 | 'verbose_name': 'Resource', |
95 | + 'verbose_name_plural': 'Resources', | |
96 | 96 | }, |
97 | 97 | ), |
98 | 98 | migrations.AddField( | ... | ... |
... | ... | @@ -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 | 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 | 322 | .notification-count { |
325 | 323 | background-color: #FF0000; |
326 | 324 | } | ... | ... |
courses/admin.py
1 | 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 | 5 | class CategoryAdmin(admin.ModelAdmin): |
6 | 6 | list_display = ['name', 'slug'] |
7 | 7 | search_fields = ['name', 'slug'] |
8 | 8 | |
9 | +class CategorySubjectAdmin(admin.ModelAdmin): | |
10 | + list_display = ['name', 'slug'] | |
11 | + search_fields = ['name', 'slug'] | |
12 | + | |
9 | 13 | class CourseAdmin(admin.ModelAdmin): |
10 | 14 | list_display = ['name', 'slug'] |
11 | 15 | search_fields = ['name', 'slug'] |
... | ... | @@ -32,3 +36,4 @@ admin.site.register(Subject, SubjectAdmin) |
32 | 36 | admin.site.register(Topic, TopicAdmin) |
33 | 37 | admin.site.register(Activity,ActivityAdmin) |
34 | 38 | admin.site.register(Material,MaterialAdmin) |
39 | +admin.site.register(CategorySubject, CategorySubjectAdmin) | ... | ... |
courses/forms.py
1 | 1 | from django import forms |
2 | 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 | 4 | from s3direct.widgets import S3DirectWidget |
5 | 5 | |
6 | 6 | |
... | ... | @@ -128,15 +128,19 @@ class SubjectForm(forms.ModelForm): |
128 | 128 | |
129 | 129 | class Meta: |
130 | 130 | model = Subject |
131 | - fields = ('name', 'description', 'visible',) | |
131 | + fields = ('name', 'description','init_date', 'end_date', 'visible',) | |
132 | 132 | labels = { |
133 | 133 | 'name': _('Name'), |
134 | 134 | 'description': _('Description'), |
135 | + 'init_date': _('Start date'), | |
136 | + 'end_date': _('End date'), | |
135 | 137 | 'visible': _('Is it visible?'), |
136 | 138 | } |
137 | 139 | help_texts = { |
138 | 140 | 'name': _("Subjects's name"), |
139 | 141 | 'description': _("Subjects's description"), |
142 | + 'init_date': _('Start date of the subject'), | |
143 | + 'end_date': _('End date of the subject'), | |
140 | 144 | 'visible': _('Is the subject visible?'), |
141 | 145 | } |
142 | 146 | |
... | ... | @@ -184,7 +188,17 @@ class ActivityFileForm(forms.ModelForm): |
184 | 188 | model = ActivityFile |
185 | 189 | fields = ['pdf','name'] |
186 | 190 | |
187 | -class ActivityForm(forms.ModelForm): | |
191 | +class ActivityForm(forms.ModelForm): | |
188 | 192 | class Meta: |
189 | 193 | model = Activity |
190 | 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 | 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 | 3 | from __future__ import unicode_literals |
4 | 4 | |
5 | 5 | import autoslug.fields |
... | ... | @@ -38,8 +38,21 @@ class Migration(migrations.Migration): |
38 | 38 | ('diet', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='files', to='courses.Activity')), |
39 | 39 | ], |
40 | 40 | options={ |
41 | - 'verbose_name': 'Activity File', | |
42 | 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 | 58 | migrations.CreateModel( |
... | ... | @@ -59,9 +72,9 @@ class Migration(migrations.Migration): |
59 | 72 | ('image', models.ImageField(blank=True, upload_to='courses/', verbose_name='Image')), |
60 | 73 | ], |
61 | 74 | options={ |
62 | - 'verbose_name': 'Course', | |
63 | - 'ordering': ('create_date', 'name'), | |
64 | 75 | 'verbose_name_plural': 'Courses', |
76 | + 'ordering': ('create_date', 'name'), | |
77 | + 'verbose_name': 'Course', | |
65 | 78 | }, |
66 | 79 | ), |
67 | 80 | migrations.CreateModel( |
... | ... | @@ -73,11 +86,28 @@ class Migration(migrations.Migration): |
73 | 86 | ('create_date', models.DateField(auto_now_add=True, verbose_name='Creation Date')), |
74 | 87 | ], |
75 | 88 | options={ |
76 | - 'verbose_name': 'Category', | |
77 | 89 | 'verbose_name_plural': 'Categories', |
90 | + 'verbose_name': 'Category', | |
78 | 91 | }, |
79 | 92 | ), |
80 | 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 | 111 | name='Material', |
82 | 112 | fields=[ |
83 | 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 | 128 | ('end_date', models.DateField(verbose_name='End of Subject Date')), |
99 | 129 | ('create_date', models.DateTimeField(auto_now_add=True, verbose_name='Creation Date')), |
100 | 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 | 132 | ('course', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='subjects', to='courses.Course', verbose_name='Course')), |
102 | 133 | ('professors', models.ManyToManyField(related_name='professors_subjects', to=settings.AUTH_USER_MODEL, verbose_name='Professors')), |
103 | 134 | ('students', models.ManyToManyField(related_name='subject_student', to=settings.AUTH_USER_MODEL, verbose_name='Students')), |
104 | 135 | ], |
105 | 136 | options={ |
106 | - 'verbose_name': 'Subject', | |
107 | - 'ordering': ('create_date', 'name'), | |
108 | 137 | 'verbose_name_plural': 'Subjects', |
138 | + 'ordering': ('create_date', 'name'), | |
139 | + 'verbose_name': 'Subject', | |
109 | 140 | }, |
110 | 141 | ), |
111 | 142 | migrations.CreateModel( |
... | ... | @@ -118,8 +149,8 @@ class Migration(migrations.Migration): |
118 | 149 | ('subjects', models.ManyToManyField(to='courses.Subject')), |
119 | 150 | ], |
120 | 151 | options={ |
121 | - 'verbose_name': 'subject category', | |
122 | 152 | 'verbose_name_plural': 'subject categories', |
153 | + 'verbose_name': 'subject category', | |
123 | 154 | }, |
124 | 155 | ), |
125 | 156 | migrations.CreateModel( |
... | ... | @@ -136,9 +167,9 @@ class Migration(migrations.Migration): |
136 | 167 | ('subject', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='courses.Subject', verbose_name='Subject')), |
137 | 168 | ], |
138 | 169 | options={ |
139 | - 'verbose_name': 'Topic', | |
140 | - 'ordering': ('create_date', 'name'), | |
141 | 170 | 'verbose_name_plural': 'Topics', |
171 | + 'ordering': ('create_date', 'name'), | |
172 | + 'verbose_name': 'Topic', | |
142 | 173 | }, |
143 | 174 | ), |
144 | 175 | migrations.AddField( |
... | ... | @@ -147,6 +178,16 @@ class Migration(migrations.Migration): |
147 | 178 | field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='materials', to='courses.Topic', verbose_name='Topic'), |
148 | 179 | ), |
149 | 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 | 191 | model_name='course', |
151 | 192 | name='category', |
152 | 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 | 18 | def __str__(self): |
19 | 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 | 33 | class Course(models.Model): |
22 | 34 | |
23 | 35 | name = models.CharField(_('Name'), max_length = 100) |
... | ... | @@ -54,6 +66,7 @@ class Subject(models.Model): |
54 | 66 | create_date = models.DateTimeField(_('Creation Date'), auto_now_add = True) |
55 | 67 | update_date = models.DateTimeField(_('Date of last update'), auto_now=True) |
56 | 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 | 70 | professors = models.ManyToManyField(User,verbose_name=_('Professors'), related_name='professors_subjects') |
58 | 71 | students = models.ManyToManyField(User,verbose_name=_('Students'), related_name='subject_student') |
59 | 72 | |
... | ... | @@ -114,6 +127,17 @@ class Material(Resource): |
114 | 127 | topic = models.ForeignKey(Topic, verbose_name = _('Topic'), related_name='materials') |
115 | 128 | students = models.ManyToManyField(User, verbose_name = _('Students'), related_name='materials') |
116 | 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 | 143 | It is a category for each subject. | ... | ... |
... | ... | @@ -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 | 83 | \ No newline at end of file | ... | ... |
courses/templates/category/create.html
courses/templates/category/delete.html
courses/templates/category/index.html
courses/templates/category/update.html
... | ... | @@ -24,7 +24,7 @@ |
24 | 24 | </div> |
25 | 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 | 29 | <div class="panel panel-primary navigation"> |
30 | 30 | <div class="panel-heading"> |
... | ... | @@ -87,7 +87,7 @@ |
87 | 87 | {% endif %} |
88 | 88 | {% endfor %} |
89 | 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 | 91 | </div> |
92 | 92 | </form> |
93 | 93 | </div> | ... | ... |
courses/templates/category/view.html
courses/templates/course/index.html
... | ... | @@ -17,13 +17,14 @@ |
17 | 17 | </div> |
18 | 18 | <div class="panel-body"> |
19 | 19 | <ul class="nav nav-pills nav-stacked"> |
20 | + <li><a href="{% url 'core:home' %}">{% trans 'Home' %}</a></li> | |
20 | 21 | <li><a href="{% url 'users:profile' %}">{% trans 'Profile' %}</a></li> |
21 | 22 | <li><a href="{% url 'course:manage' %}">{% trans 'My Courses' %}</a></li> |
22 | 23 | </ul> |
23 | 24 | </div> |
24 | 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 | 29 | <div class="panel panel-primary navigation"> |
29 | 30 | <div class="panel-heading"> |
... | ... | @@ -75,7 +76,7 @@ |
75 | 76 | <i class="material-icons">search</i> |
76 | 77 | </button> |
77 | 78 | </span> |
78 | - </div> | |
79 | + </div> | |
79 | 80 | </form> |
80 | 81 | </div> |
81 | 82 | <div class="col-md-12"> |
... | ... | @@ -102,7 +103,7 @@ |
102 | 103 | <h4 style="color:white">{{course.name}}</h4> |
103 | 104 | </a> |
104 | 105 | </div> |
105 | - {% if user|has_role:'professor, system_admin' %} | |
106 | + {% if user|has_role:'professor' or user|has_role:'system_admin' %} | |
106 | 107 | <div class="col-xs-4 col-md-3" id="divMoreActions"> |
107 | 108 | <div class="btn-group"> |
108 | 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 | 150 | <h4 style="color:white">{{course.name}}</h4> |
150 | 151 | </a> |
151 | 152 | </div> |
152 | - {% if user|has_role:'professor, system_admin' %} | |
153 | + {% if user|has_role:'professor' or user|has_role:'system_admin' %} | |
153 | 154 | <div class="col-xs-4 col-md-3" id="divMoreActions"> |
154 | 155 | <div class="btn-group"> |
155 | 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 | 21 | </div> |
22 | 22 | <div class="panel-body"> |
23 | 23 | <ul class="nav nav-pills nav-stacked"> |
24 | + <li><a href="{% url 'core:home' %}">{% trans "Home" %}</a></li> | |
24 | 25 | <li><a href="{% url 'users:profile' %}">{% trans 'Profile' %}</a></li> |
25 | 26 | <li><a href="{% url 'course:manage' %}">{% trans 'My Courses' %}</a></li> |
26 | 27 | </ul> |
27 | 28 | </div> |
28 | 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 | 33 | <div class="panel panel-primary navigation"> |
33 | 34 | <div class="panel-heading"> |
... | ... | @@ -47,7 +48,14 @@ |
47 | 48 | {% endblock %} |
48 | 49 | |
49 | 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 | 59 | <div class="col-md-12"> |
52 | 60 | <div class="panel panel-info"> |
53 | 61 | <div class="panel-heading headingOne"> |
... | ... | @@ -55,7 +63,7 @@ |
55 | 63 | <div class="col-xs-8 col-md-10 titleTopic"> |
56 | 64 | <h4>{{course}}</h4> |
57 | 65 | </div> |
58 | - {% if user|has_role:'professor, system_admin' %} | |
66 | + {% if user|has_role:'professor' or user|has_role:'system_admin' %} | |
59 | 67 | <div class="col-xs-4 col-md-2" id="divMoreActions"> |
60 | 68 | <div class="btn-group"> |
61 | 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 | 164 | </div> |
157 | 165 | |
158 | 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 | 170 | </div> |
161 | 171 | |
162 | 172 | |
... | ... | @@ -181,55 +191,104 @@ |
181 | 191 | </div> |
182 | 192 | </div> |
183 | 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 | 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 | 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 | 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 | 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 | 293 | <!-- MODAL REMOVE --> |
235 | 294 | <div class="modal" id="removeSubject2"> |
... | ... | @@ -257,4 +316,3 @@ |
257 | 316 | </div> |
258 | 317 | |
259 | 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 | 3 | {% block javascript %} |
4 | 4 | <script type="text/javascript" src="{% static 'js/forum.js' %}"></script> |
5 | 5 | <script src="{% static 'js/file.js' %}"></script> |
6 | + <script type="text/javascript" src="{% static 'js/material.js' %}"></script> | |
6 | 7 | {% endblock %} |
7 | 8 | |
8 | 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 | 25 | <button class="btn btn-default btn-sm dropdown-toggle" type="button" id="moreActions" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> |
25 | 26 | <i class="fa fa-ellipsis-v fa-2x" aria-hidden="true"></i> |
26 | 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 | 30 | <ul class="dropdown-menu pull-right" aria-labelledby="moreActions"> |
29 | 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 | 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 | 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 | 58 | <li> |
57 | 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 | 61 | <div class="ripple-container"> |
60 | 62 | <div class="ripple ripple-on ripple-out" style="left: 33.5312px; top: 11px; background-color: rgb(0, 150, 136); transform: scale(20);"> |
61 | 63 | </div> |
... | ... | @@ -79,22 +81,17 @@ |
79 | 81 | <div class="dropdown"> |
80 | 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 | 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 | 85 | </ul> |
84 | 86 | </div> |
85 | 87 | </div> |
86 | 88 | <ul> |
87 | 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 | 90 | <div class="foruns_list"> |
94 | 91 | {% list_topic_foruns request topic %} |
95 | 92 | </div> |
96 | - </div> | |
97 | - </div> | |
93 | + </ul> | |
94 | + </div> | |
98 | 95 | {% list_topic_poll request topic %} |
99 | 96 | </div> |
100 | 97 | </div> |
... | ... | @@ -134,6 +131,7 @@ |
134 | 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 | 132 | <ul class="dropdown-menu" aria-labelledby="dLabel"> |
136 | 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 | 135 | </ul> |
138 | 136 | </div> |
139 | 137 | </div> |
... | ... | @@ -201,60 +199,11 @@ |
201 | 199 | </div> |
202 | 200 | </div> |
203 | 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 | 208 | <!-- MODAL EMBEED--> |
260 | 209 | <div class="modal fade" id="embedModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"> |
... | ... | @@ -308,7 +257,7 @@ |
308 | 257 | <!-- EndModal --> |
309 | 258 | |
310 | 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 | 261 | <div class="modal-dialog" role="document"> |
313 | 262 | <div class="modal-content"> |
314 | 263 | <div class="modal-header"> |
... | ... | @@ -317,7 +266,7 @@ |
317 | 266 | </div> |
318 | 267 | <div class="modal-body"> |
319 | 268 | <form class="form-horizontal"> |
320 | - | |
269 | + | |
321 | 270 | <fieldset> |
322 | 271 | <legend>Atividade Proposta</legend> |
323 | 272 | <div class="form-group is-empty"> |
... | ... | @@ -369,168 +318,14 @@ |
369 | 318 | </div> |
370 | 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 | 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 | 329 | <!-- EndModal --> |
535 | 330 | </div> |
536 | 331 | </div> |
... | ... | @@ -553,4 +348,4 @@ |
553 | 348 | </div> |
554 | 349 | </div> |
555 | 350 | </div> |
556 | - </div> | |
557 | 351 | \ No newline at end of file |
352 | + </div> | ... | ... |
courses/templates/subject/index.html
1 | 1 | {% extends 'base.html' %} |
2 | 2 | |
3 | -{% load static i18n permission_tags %} | |
3 | +{% load static i18n permission_tags professor_access%} | |
4 | 4 | |
5 | 5 | {% block breadcrumbs %} |
6 | 6 | |
... | ... | @@ -12,7 +12,7 @@ |
12 | 12 | {% else %} |
13 | 13 | <li class="active">{{ subject.name }}</li> |
14 | 14 | {% endif %} |
15 | - | |
15 | + | |
16 | 16 | </ol> |
17 | 17 | {% endblock %} |
18 | 18 | |
... | ... | @@ -28,7 +28,7 @@ |
28 | 28 | </ul> |
29 | 29 | </div> |
30 | 30 | </div> |
31 | - | |
31 | + | |
32 | 32 | |
33 | 33 | {% endblock %} |
34 | 34 | |
... | ... | @@ -39,7 +39,8 @@ |
39 | 39 | <div class="col-md-9 col-sm-9"> |
40 | 40 | <h3>{{subject}}</h3> |
41 | 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 | 44 | <div class="col-xs-4 col-md-3 divMoreActions"> |
44 | 45 | <div class="btn-group"> |
45 | 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 | 72 | </div> |
72 | 73 | </div> |
73 | 74 | </div> |
74 | - | |
75 | + | |
75 | 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 | 79 | {% include "subject/form_view_teacher.html" %} |
78 | 80 | {% else %} |
79 | 81 | {% include "subject/form_view_student.html" %} |
80 | 82 | {% endif %} |
81 | 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 | 86 | <div class="form-group"> |
85 | 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 | 88 | </div> |
87 | - {% endif %} | |
89 | + {% endif %} | |
88 | 90 | |
89 | 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 | 3 | <script src="{% static 'js/modals_requisitions.js'%}"></script> |
4 | 4 | <script src="{% static 'js/modal_poll.js'%}"></script> |
5 | 5 | |
6 | -{% if request.user|has_role:'professor, system_admin'%} | |
7 | 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 | 15 | <div class="row" id="modal_poll"> |
17 | 16 | |
18 | 17 | </div> | ... | ... |
courses/templates/subject_category/index.html
1 | 1 | {% extends 'base.html' %} |
2 | 2 | |
3 | -{% load static i18n permission_tags %} | |
3 | +{% load static i18n permission_tags professor_access%} | |
4 | 4 | |
5 | 5 | {% block breadcrumbs %} |
6 | 6 | |
7 | 7 | <ol class="breadcrumb"> |
8 | 8 | <li><a href="{% url 'app:index' %}">{% trans 'Home' %}</a></li> |
9 | - | |
10 | - | |
9 | + | |
10 | + | |
11 | 11 | </ol> |
12 | 12 | {% endblock %} |
13 | 13 | |
... | ... | @@ -43,12 +43,14 @@ |
43 | 43 | <h3>{{subject}}</h3> |
44 | 44 | </div> |
45 | 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 | 48 | <a href="" class="btn">{% trans "edit" %}</a> |
48 | 49 | {% endif %} |
49 | 50 | </div> |
50 | 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 | 54 | <a href="" class="btn">{% trans "delete" %}</a> |
53 | 55 | {% endif %} |
54 | 56 | </div> |
... | ... | @@ -60,6 +62,6 @@ |
60 | 62 | </p> |
61 | 63 | </div> |
62 | 64 | </div> |
63 | - | |
65 | + | |
64 | 66 | |
65 | 67 | {% endblock %} | ... | ... |
courses/templates/topic/index.html
1 | 1 | {% extends 'base.html' %} |
2 | 2 | |
3 | -{% load static i18n permission_tags %} | |
3 | +{% load static i18n permission_tags professor_access %} | |
4 | 4 | |
5 | 5 | {% block breadcrumbs %} |
6 | 6 | |
7 | 7 | <ol class="breadcrumb"> |
8 | 8 | <li><a href="{% url 'app:index' %}">{% trans 'Home' %}</a></li> |
9 | 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 | 12 | <li class="active">{% trans 'Manage Topic' %}</li> |
12 | 13 | {% else %} |
13 | 14 | <li class="active">{{ topic.name }}</li> |
... | ... | @@ -54,7 +55,8 @@ |
54 | 55 | <h3>{{subject}}</h3> |
55 | 56 | </div> |
56 | 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 | 60 | <div class="btn-group"> |
59 | 61 | <button class="btn btn-default btn-sm dropdown-toggle" type="button" id="moreActions" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> |
60 | 62 | <i class="fa fa-ellipsis-v fa-2x" aria-hidden="true"></i> |
... | ... | @@ -105,7 +107,8 @@ |
105 | 107 | <div class="col-md-4"> |
106 | 108 | <i class="fa fa-file-archive-o fa-lg" aria-hidden="true">Atividade.doc</i> |
107 | 109 | </div> |
108 | - {% if user|has_role:'professor, system_admin' %} | |
110 | + {% professor_subject subject user as permi_test%} | |
111 | + {% if permi_test %} | |
109 | 112 | <div class="col-md-4"> |
110 | 113 | <label> Nota:</label> |
111 | 114 | <input type="number" step="0.01"> | ... | ... |
courses/templates/topic/list_topic_foruns.html
1 | 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 | 3 | {% endfor %} |
4 | 4 | \ No newline at end of file | ... | ... |
courses/urls.py
... | ... | @@ -22,12 +22,14 @@ urlpatterns = [ |
22 | 22 | url(r'^topics/update/(?P<slug>[\w_-]+)/$', views.UpdateTopicView.as_view(), name='update_topic'), |
23 | 23 | url(r'^topics/createlink/$', linkviews.CreateLink.as_view(),name = 'create_link'), |
24 | 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 | 26 | url(r'^topics/(?P<slug>[\w_-]+)/$', views.TopicsView.as_view(), name='view_topic'), |
26 | 27 | url(r'^subjects/categories$',views.IndexSubjectCategoryView.as_view(), name='subject_category_index'), |
27 | 28 | url(r'^forum/', include('forum.urls', namespace = 'forum')), |
28 | 29 | url(r'^poll/', include('poll.urls', namespace = 'poll')), |
29 | 30 | url(r'^exam/', include('exam.urls', namespace = 'exam')), |
30 | 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 | 13 | from django.http import HttpResponseRedirect |
14 | 14 | |
15 | 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 | 17 | from core.mixins import NotificationMixin |
18 | 18 | from users.models import User |
19 | 19 | from files.forms import FileForm |
20 | +from files.models import TopicFile | |
20 | 21 | |
21 | 22 | from datetime import date |
22 | 23 | |
... | ... | @@ -191,6 +192,23 @@ class CourseView(LoginRequiredMixin, NotificationMixin, generic.DetailView): |
191 | 192 | courses = self.request.user.courses.all() |
192 | 193 | elif has_role(self.request.user, 'student'): |
193 | 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 | 212 | context['courses'] = courses |
195 | 213 | context['title'] = course.name |
196 | 214 | |
... | ... | @@ -300,14 +318,36 @@ class SubjectsView(LoginRequiredMixin, generic.ListView): |
300 | 318 | return context |
301 | 319 | |
302 | 320 | def get_context_data(self, **kwargs): |
303 | - subject = get_object_or_404(Subject, slug = self.kwargs.get('slug')) | |
321 | + | |
304 | 322 | context = super(SubjectsView, self).get_context_data(**kwargs) |
323 | + subject = get_object_or_404(Subject, slug = self.kwargs.get('slug')) | |
305 | 324 | context['course'] = subject.course |
306 | 325 | context['subject'] = subject |
307 | - context['form_file'] = FileForm | |
308 | 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 | 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 | 351 | class TopicsView(LoginRequiredMixin, generic.ListView): |
312 | 352 | |
313 | 353 | login_url = reverse_lazy("core:home") | ... | ... |
exam/migrations/0001_initial.py
1 | 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 | 3 | from __future__ import unicode_literals |
4 | 4 | |
5 | 5 | from django.db import migrations, models |
... | ... | @@ -23,9 +23,9 @@ class Migration(migrations.Migration): |
23 | 23 | ('order', models.PositiveSmallIntegerField(verbose_name='Order')), |
24 | 24 | ], |
25 | 25 | options={ |
26 | + 'verbose_name_plural': 'Answers', | |
26 | 27 | 'verbose_name': 'Answer', |
27 | 28 | 'ordering': ('order',), |
28 | - 'verbose_name_plural': 'Answers', | |
29 | 29 | }, |
30 | 30 | ), |
31 | 31 | migrations.CreateModel( | ... | ... |
files/admin.py
1 | 1 | from django.contrib import admin |
2 | 2 | |
3 | 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 | 8 | \ No newline at end of file |
9 | +admin.site.register(TopicFile, TopicFileAdmin) | ... | ... |
files/migrations/0001_initial.py
1 | 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 | 3 | from __future__ import unicode_literals |
4 | 4 | |
5 | +from django.conf import settings | |
5 | 6 | from django.db import migrations, models |
6 | 7 | import django.db.models.deletion |
7 | 8 | import files.models |
... | ... | @@ -12,8 +13,9 @@ class Migration(migrations.Migration): |
12 | 13 | initial = True |
13 | 14 | |
14 | 15 | dependencies = [ |
15 | - ('core', '0001_initial'), | |
16 | 16 | ('courses', '0001_initial'), |
17 | + migrations.swappable_dependency(settings.AUTH_USER_MODEL), | |
18 | + ('core', '0001_initial'), | |
17 | 19 | ] |
18 | 20 | |
19 | 21 | operations = [ |
... | ... | @@ -24,10 +26,11 @@ class Migration(migrations.Migration): |
24 | 26 | ('description', models.TextField(blank=True, verbose_name='Description')), |
25 | 27 | ('file_url', models.FileField(upload_to=files.models.file_path, verbose_name='File')), |
26 | 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 | 31 | options={ |
29 | - 'verbose_name': 'File', | |
30 | 32 | 'verbose_name_plural': 'Files', |
33 | + 'verbose_name': 'File', | |
31 | 34 | 'ordering': ('-id',), |
32 | 35 | }, |
33 | 36 | bases=('courses.material',), | ... | ... |
files/models.py
... | ... | @@ -2,6 +2,7 @@ from django.db import models |
2 | 2 | from django.utils.translation import ugettext_lazy as _ |
3 | 3 | from core.models import MimeType |
4 | 4 | from courses.models import Material |
5 | +from users.models import User | |
5 | 6 | |
6 | 7 | """ |
7 | 8 | Function to return the path where the file should be saved |
... | ... | @@ -15,6 +16,8 @@ def file_path(instance, filename): |
15 | 16 | It's like a support material for the students. |
16 | 17 | """ |
17 | 18 | class TopicFile(Material): |
19 | + | |
20 | + professor = models.ManyToManyField(User,verbose_name=_('Professors'), related_name='file_professors') | |
18 | 21 | description = models.TextField(_('Description'), blank=True) |
19 | 22 | file_url = models.FileField(verbose_name = _("File"), upload_to = file_path) |
20 | 23 | file_type = models.ForeignKey(MimeType, verbose_name=_('Type file'), related_name='topic_files') | ... | ... |
files/templates/files/create_file.html
forum/migrations/0001_initial.py
forum/static/js/forum.js
... | ... | @@ -83,7 +83,7 @@ function setForumCreateFormSubmit() { |
83 | 83 | success: function (data) { |
84 | 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 | 88 | $("#createForum").modal('hide'); |
89 | 89 | ... | ... |
forum/templates/post/post_list.html
... | ... | @@ -27,7 +27,7 @@ |
27 | 27 | <div class="post_content"> |
28 | 28 | <div class="card-data"> |
29 | 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 | 31 | {% if post.is_modified %} |
32 | 32 | <em> - {% trans 'Edited' %}</em> |
33 | 33 | {% endif %} | ... | ... |
forum/templates/post/post_render.html
... | ... | @@ -25,7 +25,7 @@ |
25 | 25 | <div class="post_content"> |
26 | 26 | <div class="card-data"> |
27 | 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 | 29 | {% if post.post_date != post.modifiction_date %} |
30 | 30 | <em> - {% trans 'Edited' %}</em> |
31 | 31 | {% endif %} | ... | ... |
links/forms.py
... | ... | @@ -3,11 +3,12 @@ from .models import Link |
3 | 3 | import validators |
4 | 4 | |
5 | 5 | class CreateLinkForm(forms.ModelForm): |
6 | - def validate_link(self,link): | |
6 | + | |
7 | + def clean_link(self): | |
8 | + link = self.cleaned_data['link'] | |
7 | 9 | if not validators.url(link): |
8 | 10 | raise forms.ValidationError(_('Please enter a valid URL')) |
9 | - else: | |
10 | - return link | |
11 | + return link | |
11 | 12 | |
12 | 13 | class Meta: |
13 | 14 | model = Link | ... | ... |
links/migrations/0001_initial.py
1 | 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 | 3 | from __future__ import unicode_literals |
4 | 4 | |
5 | 5 | from django.db import migrations, models |
... | ... | @@ -22,8 +22,8 @@ class Migration(migrations.Migration): |
22 | 22 | ('description', models.CharField(max_length=200)), |
23 | 23 | ], |
24 | 24 | options={ |
25 | - 'verbose_name': 'Link', | |
26 | 25 | 'verbose_name_plural': 'Links', |
26 | + 'verbose_name': 'Link', | |
27 | 27 | }, |
28 | 28 | ), |
29 | 29 | ] | ... | ... |
... | ... | @@ -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 @@ |
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 | -{% 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 @@ |
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 | 29 | "description" : 'testdescription', |
30 | 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 | 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 | 46 | # def test_update_link(): |
39 | 47 | # pass |
40 | 48 | def test_delete_link(self): | ... | ... |
links/views.py
... | ... | @@ -10,7 +10,7 @@ from .forms import * |
10 | 10 | |
11 | 11 | # Create your views here. |
12 | 12 | class CreateLink(generic.CreateView): |
13 | - template_name = 'links/link_modal.html' | |
13 | + template_name = 'links/create_link.html' | |
14 | 14 | form_class = CreateLinkForm |
15 | 15 | success_url = reverse_lazy('course:manage') |
16 | 16 | context_object_name = 'links' |
... | ... | @@ -18,22 +18,27 @@ class CreateLink(generic.CreateView): |
18 | 18 | def form_valid(self, form): |
19 | 19 | form.save() |
20 | 20 | messages.success(self.request, _('Link created successfully!')) |
21 | + messages.error(self.request, _("An error occurred when trying to create the link")) | |
21 | 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 | 30 | def deleteLink(request,linkname): |
29 | 31 | link = get_object_or_404(Link,name = linkname) |
30 | 32 | link.delete() |
33 | + template_name = 'links/delete_link.html' | |
31 | 34 | messages.success(request,_("Link deleted Successfully!")) |
35 | + messages.error(request, _("An error occurred when trying to delete the link")) | |
32 | 36 | return redirect('course:manage') |
37 | +#Referencia no delete link para adicionar quando resolver o problema do context {% url 'course:delete' link.name %} | |
33 | 38 | class UpdateLink(generic.UpdateView): |
34 | - template_name = 'links/' | |
39 | + template_name = 'links/update_link.html' | |
35 | 40 | form_class = UpdateLinkForm |
36 | - success_url = reverse_lazy() | |
41 | + success_url = reverse_lazy('course:manage') | |
37 | 42 | def form_valid(self, form): |
38 | 43 | form.save() |
39 | 44 | messages.success(self.request, _('Link updated successfully!')) | ... | ... |
poll/migrations/0001_initial.py
1 | 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 | 3 | from __future__ import unicode_literals |
4 | 4 | |
5 | 5 | from django.conf import settings |
... | ... | @@ -25,9 +25,9 @@ class Migration(migrations.Migration): |
25 | 25 | ('order', models.PositiveSmallIntegerField(verbose_name='Order')), |
26 | 26 | ], |
27 | 27 | options={ |
28 | - 'ordering': ('order',), | |
29 | 28 | 'verbose_name_plural': 'Answers', |
30 | 29 | 'verbose_name': 'Answer', |
30 | + 'ordering': ('order',), | |
31 | 31 | }, |
32 | 32 | ), |
33 | 33 | migrations.CreateModel( | ... | ... |
poll/static/js/modal_poll.js
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 | 30 | {% block button_save %} |
31 | 31 | <!-- Put curtom buttons here!!! --> |
32 | 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 | 34 | {% endif %} |
35 | 35 | {% endblock button_save %} | ... | ... |
... | ... | @@ -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 | 80 | self.poll.save() |
81 | 81 | |
82 | 82 | def test_poll_create(self): |
83 | - self.client.login(username='professor', password='testing') | |
84 | - poll = self.topic.activities.all().count() | |
85 | 83 | url = reverse('course:poll:create_poll',kwargs={'slug':self.topic.slug}) |
86 | 84 | data = { |
87 | 85 | "name": 'create poll test', |
88 | 86 | "limit_date":'2016-10-06', |
89 | 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 | 90 | self.client.login(username='student', password='testing') |
94 | 91 | poll = self.topic.activities.all().count() |
95 | 92 | response = self.client.post(url, data) |
96 | 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 | 100 | def test_poll_update(self): |
99 | 101 | self.client.login(username='professor', password='testing') |
100 | 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 | 145 | context['subject'] = poll.topic.subject |
146 | 146 | context['subjects'] = poll.topic.subject.course.subjects.all() |
147 | 147 | |
148 | + print (self.request.user) | |
149 | + | |
148 | 150 | answers = {} |
149 | 151 | for answer in poll.answers.all(): |
150 | 152 | # print (key.answer) | ... | ... |
requirements.txt
... | ... | @@ -12,7 +12,6 @@ django-role-permissions==1.2.1 |
12 | 12 | django-s3direct==0.4.2 |
13 | 13 | django-widget-tweaks==1.4.1 |
14 | 14 | djangorestframework==3.4.6 |
15 | -itsdangerous==0.24 | |
16 | 15 | gunicorn==19.6.0 |
17 | 16 | Jinja2==2.8 |
18 | 17 | MarkupSafe==0.23 |
... | ... | @@ -20,8 +19,6 @@ Pillow==3.3.1 |
20 | 19 | psycopg2==2.6.2 |
21 | 20 | pycpfcnpj==1.0.2 |
22 | 21 | six==1.10.0 |
23 | -slugify==0.0.1 | |
24 | 22 | validators==0.11.0 |
25 | -virtualenv==15.0.3 | |
26 | 23 | Werkzeug==0.11.11 |
27 | 24 | whitenoise==3.2.2 |
28 | 25 | \ No newline at end of file | ... | ... |
users/admin.py
... | ... | @@ -5,6 +5,5 @@ from .forms import AdminUserForm |
5 | 5 | class UserAdmin(admin.ModelAdmin): |
6 | 6 | list_display = ['username', 'name', 'email', 'is_staff', 'is_active'] |
7 | 7 | search_fields = ['username', 'name', 'email'] |
8 | - # form = AdminUserForm | |
9 | 8 | |
10 | -admin.site.register(User, UserAdmin) | |
11 | 9 | \ No newline at end of file |
10 | +admin.site.register(User, UserAdmin) | ... | ... |
users/migrations/0001_initial.py
1 | 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 | 3 | from __future__ import unicode_literals |
4 | 4 | |
5 | 5 | import django.contrib.auth.models |
... | ... | @@ -42,8 +42,8 @@ class Migration(migrations.Migration): |
42 | 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 | 44 | options={ |
45 | - 'verbose_name': 'User', | |
46 | 45 | 'verbose_name_plural': 'Users', |
46 | + 'verbose_name': 'User', | |
47 | 47 | }, |
48 | 48 | managers=[ |
49 | 49 | ('objects', django.contrib.auth.models.UserManager()), | ... | ... |
users/templates/list_users.html
... | ... | @@ -16,6 +16,7 @@ |
16 | 16 | </div> |
17 | 17 | <div class="panel-body"> |
18 | 18 | <ul class="nav nav-pills nav-stacked"> |
19 | + <li><a href="{% url 'core:home' %}">{% trans "Home" %}</a></li> | |
19 | 20 | <li><a href="{% url 'users:create' %}">{% trans 'Add user' %}</a></li> |
20 | 21 | <li><a href="javascript:void(0)">{% trans 'Send email' %}</a></li> |
21 | 22 | </ul> | ... | ... |