Commit adfc46fb92f79f86c3e223adbdb27acd5a2782b1

Authored by filipecmedeiros
2 parents 184377ea 7f219cc5

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

amadeus/settings.py
@@ -55,6 +55,8 @@ INSTALLED_APPS = [ @@ -55,6 +55,8 @@ INSTALLED_APPS = [
55 'courses', 55 'courses',
56 'forum', 56 'forum',
57 'poll', 57 'poll',
  58 + 'avaliacao',
  59 +
58 ] 60 ]
59 61
60 MIDDLEWARE_CLASSES = [ 62 MIDDLEWARE_CLASSES = [
avaliacao/__init__.py 0 → 100644
avaliacao/admin.py 0 → 100644
@@ -0,0 +1,3 @@ @@ -0,0 +1,3 @@
  1 +from django.contrib import admin
  2 +
  3 +# Register your models here.
avaliacao/apps.py 0 → 100644
@@ -0,0 +1,5 @@ @@ -0,0 +1,5 @@
  1 +from django.apps import AppConfig
  2 +
  3 +
  4 +class AvaliacaoConfig(AppConfig):
  5 + name = 'avaliacao'
avaliacao/migrations/__init__.py 0 → 100644
avaliacao/models.py 0 → 100644
@@ -0,0 +1,20 @@ @@ -0,0 +1,20 @@
  1 +from django.utils.translation import ugettext_lazy as _
  2 +from django.db import models
  3 +from autoslug.fields import AutoSlugField
  4 +from users.models import User
  5 +from core.models import Resource
  6 +from courses.models import Activity
  7 +
  8 +class Avaliacao(Activity):
  9 +
  10 + name_avalicao = models.CharField(_('Name'), max_length = 100)
  11 + init_date = models.DateField(_('Begin of Avaliacao Date'))
  12 + end_date = models.DateField(_('End of Avaliacao Date'))
  13 +
  14 + class Meta:
  15 + #ordering = ('create_date','name')
  16 + verbose_name = _('Avaliacao')
  17 + verbose_name_plural = _('Avaliacoes')
  18 +
  19 +def __str__(self):
  20 + return str(self.name) + str("/") + str(self.topic)
avaliacao/tests.py 0 → 100644
@@ -0,0 +1,3 @@ @@ -0,0 +1,3 @@
  1 +from django.test import TestCase
  2 +
  3 +# Create your tests here.
avaliacao/urls.py 0 → 100644
@@ -0,0 +1,7 @@ @@ -0,0 +1,7 @@
  1 +from django.conf.urls import url
  2 +
  3 +from . import views
  4 +
  5 +urlpatterns =[
  6 +
  7 +]
avaliacao/views.py 0 → 100644
@@ -0,0 +1,3 @@ @@ -0,0 +1,3 @@
  1 +from django.shortcuts import render
  2 +
  3 +# Create your views here.
1 from django.conf.urls import url, include 1 from django.conf.urls import url, include
2 from django.contrib.auth import views as auth_views 2 from django.contrib.auth import views as auth_views
3 from django.contrib.auth.views import password_reset, password_reset_done,password_reset_confirm, password_reset_complete 3 from django.contrib.auth.views import password_reset, password_reset_done,password_reset_confirm, password_reset_complete
4 -  
5 from . import views 4 from . import views
6 5
7 6
@@ -12,10 +11,13 @@ urlpatterns = [ @@ -12,10 +11,13 @@ urlpatterns = [
12 url(r'^logout/$', auth_views.logout, {'next_page': 'core:home'}, name='logout'), 11 url(r'^logout/$', auth_views.logout, {'next_page': 'core:home'}, name='logout'),
13 url(r'^notification/([0-9]+)/$', views.processNotification, name='notification_read'), 12 url(r'^notification/([0-9]+)/$', views.processNotification, name='notification_read'),
14 url(r'^getNotifications/$', views.getNotifications, name='getNotifications'), 13 url(r'^getNotifications/$', views.getNotifications, name='getNotifications'),
  14 +]
15 15
16 - url(r'^reset/$', password_reset, {'template_name':'registration/passwor_reset_form.html','email_template_name':'registration/password_reset_email.html','post_reset_redirect':'done/'}, name="password_reset"),  
17 - url(r'^reset/done/$', password_reset_done, {'template_name':'registration/passwor_reset_done.html'}),  
18 - url(r'^reset/(?P<uidb36>[0-9A-Za-z]+)/(?P<token>[0-9A-Za-z]{1,13}-[0-9A-Za-z]{1,20})/$', password_reset_confirm, {'template_name':'registration/password_reset_confirm.html'}),  
19 - url(r'^done/$', password_reset_complete,{'template_name':'registration/passwor_reset_complete.html'}), 16 +#Reset Password
  17 +urlpatterns += [
  18 + url(r'^password/reset/$', password_reset, {'post_reset_redirect' : 'password/reset/done/','template_name': 'registration/passwor_reset_form.html'}, name="password_reset"),
  19 + url(r'^password/reset/done/$', password_reset_done, {'template_name': 'registration/passwor_reset_done.html'}),
  20 + url(r'^password/reset/(?P<uidb36>[0-9A-Za-z]+)/(?P<token>[0-9A-Za-z]{1,13}-[0-9A-Za-z]{1,20})/$', password_reset_confirm, {'post_reset_redirect' : 'password/done/', 'template_name': 'registration/password_reset_confirm.html'}),
  21 + url(r'^password/done/$', password_reset_complete,{'template_name': 'registration/passwor_reset_complete.html'}),
20 22
21 ] 23 ]
courses/templates/course/index.html
@@ -53,10 +53,20 @@ @@ -53,10 +53,20 @@
53 {% endfor %} 53 {% endfor %}
54 {% endif %} 54 {% endif %}
55 55
  56 +<div class="col-md-12">
  57 + <div class="input-group">
  58 + <div class="form-group is-empty"><input type="search" class="form-control" placeholder="Search Courses"></div>
  59 + <span class="input-group-btn input-group-sm">
  60 + <button type="button" class="btn btn-fab btn-fab-mini">
  61 + <i class="material-icons">search</i>
  62 + </button>
  63 + </span>
  64 + </div>
  65 + </div>
56 {% if user|has_role:'professor, system_admin' %} 66 {% if user|has_role:'professor, system_admin' %}
57 67
58 <div class="col-md-12"> 68 <div class="col-md-12">
59 - {% if courses_teacher|length > 0 %} 69 + {% if courses|length > 0 %}
60 {% for course in courses_teacher %} 70 {% for course in courses_teacher %}
61 <!-- Put your content here! --> 71 <!-- Put your content here! -->
62 <div class="panel-group ui-accordion ui-widget ui-helper-reset ui-sortable" id="accordion" role="tablist" aria-multiselectable="false"> 72 <div class="panel-group ui-accordion ui-widget ui-helper-reset ui-sortable" id="accordion" role="tablist" aria-multiselectable="false">
@@ -130,21 +140,11 @@ @@ -130,21 +140,11 @@
130 </div> 140 </div>
131 </div> 141 </div>
132 </div> 142 </div>
  143 +{% endif %}
133 144
134 -{% else %} 145 +{% if user|has_role:'students' %}
135 146
136 - <div class="col-md-12">  
137 - <div class="input-group">  
138 - <div class="form-group is-empty"><input type="search" class="form-control" placeholder="Search Courses"></div>  
139 - <span class="input-group-btn input-group-sm">  
140 - <button type="button" class="btn btn-fab btn-fab-mini">  
141 - <i class="material-icons">search</i>  
142 - </button>  
143 - </span>  
144 - </div>  
145 - </div>  
146 -  
147 - {% if subjects_student|length > 0 %} 147 + {% if courses|length > 0 %}
148 {% for course in courses_student %} 148 {% for course in courses_student %}
149 <div class="col-md-12"> 149 <div class="col-md-12">
150 <div class="panel panel-info"> 150 <div class="panel panel-info">
@@ -154,9 +154,15 @@ @@ -154,9 +154,15 @@
154 <img src="" class="img-responsive" /> 154 <img src="" class="img-responsive" />
155 {% endif %} --> 155 {% endif %} -->
156 <div class="panel-heading"> 156 <div class="panel-heading">
157 - <h3 class="panel-title">Course</h3>  
158 - <span class="label label-info">{{ course.category }}</span>  
159 - <span class="label label-warning">{{ course.max_students }} {% trans 'students tops' %}</span> 157 + <div class="row">
  158 + <div class="col-md-9">
  159 + <h3 class="panel-title">{{course.name}}</h3>
  160 + </div>
  161 + <div class="col-md-3">
  162 + <span class="label label-info">{{ course.category }}</span>
  163 + <span class="label label-warning">{{ course.max_students }} {% trans 'students tops' %}</span>
  164 + </div>
  165 + </div>
160 </div> 166 </div>
161 <div class="panel-body"> 167 <div class="panel-body">
162 <p><b>Course Name: </b>{{ course.name }}</p> 168 <p><b>Course Name: </b>{{ course.name }}</p>
@@ -165,18 +171,22 @@ @@ -165,18 +171,22 @@
165 <p> 171 <p>
166 <b>Description:</b> 172 <b>Description:</b>
167 <i> 173 <i>
168 - "Lorem ipsum dolor sit amet, consecctetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. 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 cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum." 174 + {% if couse.description %}
  175 + {{course.description|linebreaks}}
  176 + {% else %}
  177 + {% trans 'No description' %}
  178 + {% endif %}
169 </i> 179 </i>
170 </p> 180 </p>
171 181
172 - {% if user|has_role:'professor, system_admin' %} 182 + <!--{% if user|has_role:'professor, system_admin' %}
173 <a href="{% url 'course:update' course.slug %}" class="btn btn-sm btn-primary"> 183 <a href="{% url 'course:update' course.slug %}" class="btn btn-sm btn-primary">
174 <span class="glyphicon glyphicon-edit"></span> 184 <span class="glyphicon glyphicon-edit"></span>
175 </a> 185 </a>
176 <a href="{% url 'course:delete' course.slug %}" class="btn btn-sm btn-danger"> 186 <a href="{% url 'course:delete' course.slug %}" class="btn btn-sm btn-danger">
177 <span class="glyphicon glyphicon-trash"></span> 187 <span class="glyphicon glyphicon-trash"></span>
178 </a> 188 </a>
179 - {% endif %} 189 + {% endif %}-->
180 190
181 <a href="{% url 'course:view' course.slug %}" class="btn btn-raised btn-default center-block">View Course</a> 191 <a href="{% url 'course:view' course.slug %}" class="btn btn-raised btn-default center-block">View Course</a>
182 </div> 192 </div>
@@ -185,7 +195,6 @@ @@ -185,7 +195,6 @@
185 195
186 {% endfor %} 196 {% endfor %}
187 197
188 -  
189 <nav aria-label="Page navigation"> 198 <nav aria-label="Page navigation">
190 <ul class="pagination"> 199 <ul class="pagination">
191 {% for page_number in paginator.page_range %} 200 {% for page_number in paginator.page_range %}
@@ -199,4 +208,5 @@ @@ -199,4 +208,5 @@
199 {% trans 'No courses found' %} 208 {% trans 'No courses found' %}
200 {% endif %} 209 {% endif %}
201 {% endif %} 210 {% endif %}
  211 +
202 {% endblock %} 212 {% endblock %}
courses/templates/course/view.html
@@ -52,10 +52,10 @@ @@ -52,10 +52,10 @@
52 <div class="panel panel-info"> 52 <div class="panel panel-info">
53 <div class="panel-heading headingOne"> 53 <div class="panel-heading headingOne">
54 <div class="row"> 54 <div class="row">
55 - <div class="col-xs-8 col-md-10 titleTopic"> 55 + <div class="col-xs-8 col-md-9 titleTopic">
56 <h4>{{course}}</h4> 56 <h4>{{course}}</h4>
57 </div> 57 </div>
58 - <div class="col-xs-4 col-md-2" id="divMoreActions"> 58 + <div class="col-xs-4 col-md-3" id="divMoreActions">
59 <div class="btn-group"> 59 <div class="btn-group">
60 <button type="button" class="btn btn-default btn-sm eye" data-toggle="tooltip" data-placement="bottom" title="Visible"> 60 <button type="button" class="btn btn-default btn-sm eye" data-toggle="tooltip" data-placement="bottom" title="Visible">
61 <i class="fa fa-eye fa-2x" aria-hidden="true"></i> 61 <i class="fa fa-eye fa-2x" aria-hidden="true"></i>
@@ -99,7 +99,7 @@ @@ -99,7 +99,7 @@
99 </div> 99 </div>
100 <div class="modal-body"> 100 <div class="modal-body">
101 <div> 101 <div>
102 - <form class="form-horizontal"> 102 + <!--<form class="form-horizontal">
103 <div class="form-group is-empty"> 103 <div class="form-group is-empty">
104 <label class="control-label col-md-2 col-md-offset-1 col-xs-2 col-xs-offset-1">Name</label> 104 <label class="control-label col-md-2 col-md-offset-1 col-xs-2 col-xs-offset-1">Name</label>
105 <div class="col-md-8 col-xs-8"> 105 <div class="col-md-8 col-xs-8">
@@ -148,7 +148,7 @@ @@ -148,7 +148,7 @@
148 </div> 148 </div>
149 </div> 149 </div>
150 </div> 150 </div>
151 - </form> 151 + </form>-->
152 </div> 152 </div>
153 <div class="modal-footer"> 153 <div class="modal-footer">
154 <button type="button" data-dismiss="modal" class="btn btn-default">Cancel</button> 154 <button type="button" data-dismiss="modal" class="btn btn-default">Cancel</button>
@@ -190,12 +190,12 @@ @@ -190,12 +190,12 @@
190 <div class="panel panel-info"> 190 <div class="panel panel-info">
191 <div class="panel-heading headingTwo ui-sortable-handle" role="tab"> 191 <div class="panel-heading headingTwo ui-sortable-handle" role="tab">
192 <div class="row"> 192 <div class="row">
193 - <div class="col-xs-9 col-md-10 titleTopic"> 193 + <div class="col-xs-9 col-md-9 titleTopic">
194 <a role="button" data-toggle="collapse" data-parent="#accordion" href=".collapseTwo" aria-expanded="true" aria-controls="collapseTwo"> 194 <a role="button" data-toggle="collapse" data-parent="#accordion" href=".collapseTwo" aria-expanded="true" aria-controls="collapseTwo">
195 - <h4>{{subject.name}}</h4> 195 + <h4 style="color:white">{{subject.name}}</h4>
196 </a> 196 </a>
197 </div> 197 </div>
198 - <div class="col-xs-3 col-md-2" id="divMoreActions"> 198 + <div class="col-xs-3 col-md-3" id="divMoreActions">
199 <div class="btn-group"> 199 <div class="btn-group">
200 <button type="button" class="btn btn-default btn-sm eye" data-toggle="tooltip" data-placement="bottom" title="Visible"> 200 <button type="button" class="btn btn-default btn-sm eye" data-toggle="tooltip" data-placement="bottom" title="Visible">
201 <i class="fa fa-eye fa-2x" aria-hidden="true"></i> 201 <i class="fa fa-eye fa-2x" aria-hidden="true"></i>
@@ -233,6 +233,10 @@ @@ -233,6 +233,10 @@
233 <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> 233 <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>
234 </div> 234 </div>
235 </div> 235 </div>
  236 +<div class="form-group">
  237 + <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>
  238 +</div>
  239 +
236 {% endfor %} 240 {% endfor %}
237 241
238 242
courses/templates/subject/index.html
@@ -67,7 +67,9 @@ @@ -67,7 +67,9 @@
67 {% endfor %} 67 {% endfor %}
68 68
69 {% if user|has_role:'system_admin' or topic.owner == user%} 69 {% if user|has_role:'system_admin' or topic.owner == user%}
70 - <a name="create_topic" class="btn btn-primary btn-md btn-block" href="{% url 'course:create_topic' subject.slug %}">{% trans "Create Topic" %}</a> 70 + <div class="form-group">
  71 + <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>
  72 + </div>
71 {% endif %} 73 {% endif %}
72 74
73 {% endblock %} 75 {% endblock %}
courses/urls.py
@@ -25,6 +25,6 @@ urlpatterns = [ @@ -25,6 +25,6 @@ urlpatterns = [
25 25
26 26
27 url(r'^forum/', include('forum.urls', namespace = 'forum')), 27 url(r'^forum/', include('forum.urls', namespace = 'forum')),
28 - url(r'^poll/', include('poll.urls', namespace = 'poll'))  
29 - 28 + url(r'^poll/', include('poll.urls', namespace = 'poll')),
  29 + url(r'^avaliacao/', include('avaliacao.urls', namespace = 'avaliacao'))
30 ] 30 ]
courses/views.py
@@ -24,13 +24,14 @@ class IndexView(LoginRequiredMixin, NotificationMixin, generic.ListView): @@ -24,13 +24,14 @@ class IndexView(LoginRequiredMixin, NotificationMixin, generic.ListView):
24 redirect_field_name = 'next' 24 redirect_field_name = 'next'
25 queryset = Course.objects.all() 25 queryset = Course.objects.all()
26 template_name = 'course/index.html' 26 template_name = 'course/index.html'
27 - context_object_name = 'courses_student' 27 + context_object_name = 'courses'
28 paginate_by = 3 28 paginate_by = 3
29 29
30 def get_context_data(self, **kwargs): 30 def get_context_data(self, **kwargs):
31 context = super(IndexView, self).get_context_data(**kwargs) 31 context = super(IndexView, self).get_context_data(**kwargs)
32 context['categories'] = Category.objects.all() 32 context['categories'] = Category.objects.all()
33 context['courses_teacher'] = Course.objects.filter(professors__name = self.request.user.name) 33 context['courses_teacher'] = Course.objects.filter(professors__name = self.request.user.name)
  34 + context['courses_student'] = Course.objects.filter(students__name = self.request.user.name)
34 35
35 return context 36 return context
36 37
forum/static/js/forum.js
@@ -69,7 +69,7 @@ function createForum(url, topic) { @@ -69,7 +69,7 @@ function createForum(url, topic) {
69 console.log(data); 69 console.log(data);
70 data = data.split('-'); 70 data = data.split('-');
71 71
72 - $('.foruns_list').append("<a id='forum_"+data[1]+"' href='javascript:showForum("+data[0]+","+data[1]+")'>"+data[2]+"<br /></a>"); 72 + $('.foruns_list').append("<a id='forum_"+data[1]+"' href='"+data[0]+"'>"+data[2]+"<br /></a>");
73 73
74 $("#createForum").modal('hide'); 74 $("#createForum").modal('hide');
75 75
forum/templates/forum/forum_form.html
1 {% load static i18n %} 1 {% load static i18n %}
2 {% load widget_tweaks %} 2 {% load widget_tweaks %}
3 3
4 -<form id="forum_create" method="post" action="{% url 'forum:create' %}" enctype="multipart/form-data"> 4 +<form id="forum_create" method="post" action="{% url 'course:forum:create' %}" enctype="multipart/form-data">
5 {% csrf_token %} 5 {% csrf_token %}
6 {% for field in form %} 6 {% for field in form %}
7 <div class="form-group {% if form.has_error %} has-error {% endif %} is-fileinput"> 7 <div class="form-group {% if form.has_error %} has-error {% endif %} is-fileinput">
forum/views.py
@@ -41,7 +41,6 @@ class CreateForumView(LoginRequiredMixin, generic.edit.CreateView): @@ -41,7 +41,6 @@ class CreateForumView(LoginRequiredMixin, generic.edit.CreateView):
41 return self.render_to_response(self.get_context_data(form = form), status = 400) 41 return self.render_to_response(self.get_context_data(form = form), status = 400)
42 42
43 def get_success_url(self): 43 def get_success_url(self):
44 - print("Pass")  
45 self.success_url = reverse('course:forum:render_forum', args = (self.object.id, )) 44 self.success_url = reverse('course:forum:render_forum', args = (self.object.id, ))
46 45
47 return self.success_url 46 return self.success_url
@@ -49,7 +48,7 @@ class CreateForumView(LoginRequiredMixin, generic.edit.CreateView): @@ -49,7 +48,7 @@ class CreateForumView(LoginRequiredMixin, generic.edit.CreateView):
49 def render_forum(request, forum): 48 def render_forum(request, forum):
50 last_forum = get_object_or_404(Forum, id = forum) 49 last_forum = get_object_or_404(Forum, id = forum)
51 50
52 - return HttpResponse(str(reverse_lazy('course:forum:index')) + '-' + str(forum) + '-' + str(last_forum.name)) 51 + return HttpResponse(str(reverse_lazy('course:forum:view', args = (), kwargs = {'slug': last_forum.slug})) + '-' + str(forum) + '-' + str(last_forum.name))
53 52
54 class ForumDeleteView(LoginRequiredMixin, generic.DeleteView): 53 class ForumDeleteView(LoginRequiredMixin, generic.DeleteView):
55 login_url = reverse_lazy("core:home") 54 login_url = reverse_lazy("core:home")
manage.py 100755 → 100644