Commit 0d96ef92006b89d62868f4097c46c8ef38651389
Exists in
master
and in
5 other branches
Merge branch 'dev' of https://github.com/amadeusproject/amadeuslms into dev
Showing
8 changed files
with
34 additions
and
86 deletions
Show diff stats
amadeus/urls.py
... | ... | @@ -21,7 +21,7 @@ from django.contrib import admin |
21 | 21 | |
22 | 22 | urlpatterns = [ |
23 | 23 | url(r'^home/', include('app.urls', namespace = 'app')), |
24 | - url(r'^course/', include('courses.urls', namespace = 'course')), | |
24 | + url(r'^courses/', include('courses.urls', namespace = 'course')), | |
25 | 25 | url(r'^users/', include('users.urls', namespace = 'users')), |
26 | 26 | url(r'^admin/', admin.site.urls), |
27 | 27 | url(r'^', include('core.urls', namespace = 'core')), | ... | ... |
app/templates/home_teacher_student_content.html
... | ... | @@ -11,7 +11,7 @@ |
11 | 11 | </div> |
12 | 12 | <div class="col-xs-10 col-md-11"> |
13 | 13 | <i class="fa fa-pencil-square-o" aria-hidden="true"></i> |
14 | - <h4 class="resource_inline"><b>{{ notification.actor }}</b></h4> | |
14 | + <h4 class="resource_inline"><b>{{ notification.actor.username }}</b></h4> | |
15 | 15 | <p class="resource_inline">{{notification.message}} em : <a href="{% url 'core:notification_read' notification.id %}">{{ notification.action_resource.resource.name }}</a></p> |
16 | 16 | <p class="timePost"><i> {{ notification.datetime|timesince }} {% trans "ago" %} </i></p> |
17 | 17 | </div> | ... | ... |
core/mixins.py
... | ... | @@ -44,7 +44,8 @@ class NotificationMixin(object): |
44 | 44 | action_slug = '' |
45 | 45 | resource_name = '' |
46 | 46 | |
47 | - def createNotification(self, message='', actor=None, users = User.objects.all(), resource_slug='' ,action_slug = '', resource_name='', resource_link=''): #the default will be a broadcast | |
47 | + def createNotification(self, message='', actor=None, users = User.objects.all(), resource_slug='' ,action_slug = '', | |
48 | + resource_name='', resource_link=''): #the default will be a broadcast | |
48 | 49 | action = Action.objects.filter(slug = action_slug) |
49 | 50 | resource = Resource.objects.filter(slug = resource_slug) |
50 | 51 | if action.exists(): | ... | ... |
courses/templates/course/view.html
... | ... | @@ -37,14 +37,14 @@ |
37 | 37 | |
38 | 38 | <div class="panel panel-primary navigation"> |
39 | 39 | <div class="panel-heading"> |
40 | - <h3 class="panel-title">Actions</h3> | |
40 | + <h3 class="panel-title">{% trans "Actions" %}</h3> | |
41 | 41 | </div> |
42 | 42 | <div class="panel-body"> |
43 | 43 | <ul class="nav nav-pills nav-stacked"> |
44 | - <li><a href="teacher/course_participants_teacher.html" target="_self">Participants</a></li> | |
45 | - <li><a href="javascript:void(0)">Replicate Subject</a></li> | |
46 | - <li><a href="javascript:void(0)">Create Subject</a></li> | |
47 | - <li><a href="javascript:void(0)" data-toggle="modal" data-target="#myModal">Create Topic</a></li> | |
44 | + <li><a href="teacher/course_participants_teacher.html" target="_self"> {% trans "Participants" %}</a></li> | |
45 | + <li><a href="javascript:void(0)">{% trans "Replicate Subject" %}</a></li> | |
46 | + <li><a href="javascript:void(0)">{% trans "Create Subject" %}t</a></li> | |
47 | + <li><a href="javascript:void(0)" data-toggle="modal" data-target="#myModal">{% trans "Create Topic" %}</a></li> | |
48 | 48 | </ul> |
49 | 49 | </div> |
50 | 50 | </div> |
... | ... | @@ -68,10 +68,10 @@ |
68 | 68 | <i class="fa fa-ellipsis-v fa-2x" aria-hidden="true"></i> |
69 | 69 | <div class="ripple-container"></div></button> |
70 | 70 | <ul class="dropdown-menu" aria-labelledby="moreActions"> |
71 | - <li><a href="javascript:void(0)" data-toggle="modal" data-target="#createSubject"><i class="fa fa-plus-square-o" aria-hidden="true"></i> Create Subject</a></li> | |
72 | - <li><a href="javascript:void(0)" data-toggle="modal" data-target="#myModal4"><i class="fa fa-files-o fa-fw" aria-hidden="true"></i> Replicate</a></li> | |
73 | - <li><a href="{% url 'course:update' course.slug %}"><i class="fa fa-pencil fa-fw" aria-hidden="true"></i> Edit</a></li> | |
74 | - <li><a href="javascript:void(0)" data-toggle="modal" data-target="#myModal2"><i class="fa fa-trash fa-fw" aria-hidden="true"></i> Remove</a></li> | |
71 | + <li><a href="javascript:void(0)" data-toggle="modal" data-target="#createSubject"><i class="fa fa-plus-square-o" aria-hidden="true"></i> {% trans "Create Subject" %}</a></li> | |
72 | + <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> | |
73 | + <li><a href="{% url 'course:update' course.slug %}"><i class="fa fa-pencil fa-fw" aria-hidden="true"></i> {% trans "Edit" %}</a></li> | |
74 | + <li><a href="javascript:void(0)" data-toggle="modal" data-target="#myModal2"><i class="fa fa-trash fa-fw" aria-hidden="true"></i> {% trans "Remove" %}</a></li> | |
75 | 75 | </ul> |
76 | 76 | </div> |
77 | 77 | </div> |
... | ... | @@ -80,7 +80,6 @@ |
80 | 80 | </div> |
81 | 81 | <div class="panel-body"> |
82 | 82 | <p><b>Course Name: </b>{{course.name}}</p> |
83 | - <p><b>Duration (in semesters): </b>09</p> | |
84 | 83 | <p><b>Coordinator: </b>{{course.professors}}</p> |
85 | 84 | <p> |
86 | 85 | <b>Description:</b> |
... | ... | @@ -91,75 +90,20 @@ |
91 | 90 | |
92 | 91 | </div> |
93 | 92 | </div> |
94 | - <div class="btn-group btn-group-justified btn-group-raised"> | |
95 | - <a href="{% url 'course:manage' %}" class="btn btn-raised btn-info">Todos</a> | |
96 | - {% for category_subject in categorys_subjects %} | |
97 | - <a href="?category={{category_subject.name}}" class="btn btn-raised btn-primary">{{category_subject.name}}</a> | |
98 | - {% endfor %} | |
99 | - </div> | |
93 | + | |
100 | 94 | <!-- MODAL CREATE SUBJECT --> |
101 | 95 | <div class="modal" tabindex="-1" role="dialog " id="createSubject"> |
102 | 96 | <div class="modal-dialog"> |
103 | 97 | <div class="modal-content"> |
104 | 98 | <div class="modal-header"> |
105 | - <h4 class="modal-title">Create a New Subject</h4> | |
99 | + <h4 class="modal-title">{% trans "Create a New Subject" %}</h4> | |
106 | 100 | </div> |
107 | 101 | <div class="modal-body"> |
108 | 102 | <div> |
109 | - <!--<form class="form-horizontal"> | |
110 | - <div class="form-group is-empty"> | |
111 | - <label class="control-label col-md-2 col-md-offset-1 col-xs-2 col-xs-offset-1">Name</label> | |
112 | - <div class="col-md-8 col-xs-8"> | |
113 | - <input type="text" class="form-control" name="nameSubject"> | |
114 | - </div> | |
115 | - </div> | |
116 | - <div class="form-group is-empty"> | |
117 | - <label class="control-label col-md-2 col-md-offset-1 col-xs-2 col-xs-offset-1">Description</label> | |
118 | - <div class="col-md-8 col-xs-8"> | |
119 | - <textarea class="form-control" rows="3" id="textAreaSubject"></textarea> | |
120 | - <span class="help-block">Sign the description of the course.</span> | |
121 | - </div> | |
122 | - </div> | |
123 | - <div class="form-group is-empty"> | |
124 | - <label class="control-label col-md-2 col-md-offset-1 col-xs-2 col-xs-offset-1">Goals</label> | |
125 | - <div class="col-md-8 col-xs-8"> | |
126 | - <textarea class="form-control" rows="3" id="textAreaSubject"></textarea> | |
127 | - <span class="help-block">Sign the objectives of the course until the end of the course.</span> | |
128 | - </div> | |
129 | - </div> | |
130 | - <div class="form-group is-empty"> | |
131 | - <label class="control-label col-md-2 col-md-offset-1 col-xs-2 col-xs-offset-1">Students Limit</label> | |
132 | - <div class="col-md-8 col-xs-8"> | |
133 | - <input type="number" class="form-control" name="StudentLimit"> | |
134 | - </div> | |
135 | - </div> | |
136 | - <div class="row"> | |
137 | - <div class="col-md-6 col-xs-12"> | |
138 | - <div class="row"> | |
139 | - <div class="form-group is-empty"> | |
140 | - <label class="control-label col-md-4 col-xs-4 col-xs-offset-1">Begining</label> | |
141 | - <div class="col-md-8 col-xs-6"> | |
142 | - <input type="date" class="form-control" name="BeginDate"> | |
143 | - </div> | |
144 | - </div> | |
145 | - </div> | |
146 | - </div> | |
147 | - <div class="col-md-6 col-xs-12"> | |
148 | - <div class="row"> | |
149 | - <div class="form-group is-empty"> | |
150 | - <label class="control-label col-md-4 col-xs-4 col-xs-offset-1">End</label> | |
151 | - <div class="col-md-8 col-xs-6"> | |
152 | - <input type="date" class="form-control" name="EndDate"> | |
153 | - </div> | |
154 | - </div> | |
155 | - </div> | |
156 | - </div> | |
157 | - </div> | |
158 | - </form>--> | |
159 | 103 | </div> |
160 | 104 | <div class="modal-footer"> |
161 | - <button type="button" data-dismiss="modal" class="btn btn-default">Cancel</button> | |
162 | - <a href="#" target="_self"><button type="button" class="btn btn-primary">Confirm</button></a> | |
105 | + <button type="button" data-dismiss="modal" class="btn btn-default">{% trans "Cancel" %}</button> | |
106 | + <a href="#" target="_self"><button type="button" class="btn btn-primary"> {% trans "Confirm" %}</button></a> | |
163 | 107 | </div> |
164 | 108 | </div> |
165 | 109 | </div> |
... | ... | @@ -182,11 +126,11 @@ |
182 | 126 | <h4 class="modal-title"></h4> |
183 | 127 | </div> |
184 | 128 | <div class="modal-body"> |
185 | - <p>Are you sure you want to remove this subject?</p> | |
129 | + <p>{% trans "Are you sure you want to remove this subject?" %}</p> | |
186 | 130 | </div> |
187 | 131 | <div class="modal-footer"> |
188 | 132 | |
189 | - <a href="http://127.0.0.1:8080/html/screens/users/teacher/home_course_teacher.html" target="_self"><button type="button" class="btn btn-primary">Confirm</button></a> | |
133 | + <a href="http://127.0.0.1:8080/html/screens/users/teacher/home_course_teacher.html" target="_self"><button type="button" class="btn btn-primary">{% trans "Confirm" %}</button></a> | |
190 | 134 | |
191 | 135 | </div> |
192 | 136 | </div> |
... | ... | @@ -317,11 +261,11 @@ |
317 | 261 | <h4 class="modal-title"></h4> |
318 | 262 | </div> |
319 | 263 | <div class="modal-body"> |
320 | - <p>Are you sure you want to remove this subject?</p> | |
264 | + <p> {% trans "Are you sure you want to remove this subject?" %}</p> | |
321 | 265 | </div> |
322 | 266 | <div class="modal-footer"> |
323 | 267 | |
324 | - <a href="http://127.0.0.1:8080/html/screens/users/teacher/home_course_teacher.html" target="_self"><button type="button" class="btn btn-primary">Confirm</button></a> | |
268 | + <a href="http://127.0.0.1:8080/html/screens/users/teacher/home_course_teacher.html" target="_self"><button type="button" class="btn btn-primary">{% trans "Confirm" %}</button></a> | |
325 | 269 | |
326 | 270 | </div> |
327 | 271 | </div> | ... | ... |
courses/templates/subject/form_view_teacher.html
... | ... | @@ -4,7 +4,7 @@ |
4 | 4 | <script type="text/javascript" src="{% static 'js/forum.js' %}"></script> |
5 | 5 | <script src="{% static 'js/file.js' %}"></script> |
6 | 6 | <script type="text/javascript" src="{% static 'js/material.js' %}"></script> |
7 | - <script type = "text/javascript" src="{% static 'link.js' %}"></script> | |
7 | + <script type = "text/javascript" src="{% static 'links.js' %}"></script> | |
8 | 8 | {% endblock %} |
9 | 9 | |
10 | 10 | <div class="panel-group accordion ui-accordion ui-widget ui-helper-reset ui-sortable" role="tablist" aria-multiselectable="false"> |
... | ... | @@ -55,7 +55,7 @@ |
55 | 55 | <div class="dropdown"> |
56 | 56 | <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> |
57 | 57 | <ul class="dropdown-menu" aria-labelledby="dLabel"> |
58 | - <li><a href=" javascript:get_modal_link('{% url 'course:links:create_link' %}', '#createLinksModal','#divModalLink') ">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> | |
58 | + <li><a href=" javascript:get_modal_link('{% url 'course:links:create_link' topic.slug %}', '#createLinksModal','#divModalLink') ">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> | |
59 | 59 | <li> |
60 | 60 | <a href="javascript:get_modal_file('{% url 'course:file:create_file' topic.slug %}', '#fileModal', '#divModalFile')"> |
61 | 61 | {% trans "Create a file" %} |
... | ... | @@ -116,7 +116,7 @@ |
116 | 116 | <div class="dropdown"> |
117 | 117 | <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> |
118 | 118 | <ul class="dropdown-menu" aria-labelledby="dLabel"> |
119 | - <li><a href="javascript:get_modal_link('{% url 'course:links:create_link' %}', '#createLinksModal','#divModalLink')">Create a Link</a></li> | |
119 | + <li><a href="javascript:get_modal_link('{% url 'course:links:create_link' topic.slug %}', '#createLinksModal','#divModalLink')">Create a Link</a></li> | |
120 | 120 | <li> |
121 | 121 | <a href="#"> |
122 | 122 | {% trans "Create a file" %} | ... | ... |
forum/views.py
... | ... | @@ -58,7 +58,7 @@ class CreateForumView(LoginRequiredMixin, generic.edit.CreateView, NotificationM |
58 | 58 | action = super(CreateForumView, self).createorRetrieveAction("create Topic") |
59 | 59 | super(CreateForumView, self).createNotification("Forum "+ self.object.name + " was created", |
60 | 60 | resource_name=self.object.name, resource_link= 'topics/'+self.object.slug, |
61 | - actor=self.request.user, users = self.object.topic.subject.course.students.all() ) | |
61 | + actor=self.request.user, users = self.object.topic.subject.students.all() ) | |
62 | 62 | return self.success_url |
63 | 63 | |
64 | 64 | def render_forum(request, forum): |
... | ... | @@ -162,8 +162,8 @@ class CreatePostView(LoginRequiredMixin, generic.edit.CreateView, NotificationMi |
162 | 162 | self.object.user = self.request.user |
163 | 163 | |
164 | 164 | self.object.save() |
165 | - #super(CreatePostView, self).createNotification(self.object.user.username + " posted on " + self.object.forum,name, | |
166 | - #resource_slug = self.object.forum.slug, actor=self.request.user, users= self.object.forum.topic.) | |
165 | + super(CreatePostView, self).createNotification(self.object.user.username + " posted on " + self.object.forum,name, | |
166 | + resource_slug = self.object.forum.slug, actor=self.request.user, users= self.object.forum.topic.subject.students.all()) | |
167 | 167 | |
168 | 168 | return super(CreatePostView, self).form_valid(form) |
169 | 169 | ... | ... |
poll/models.py
poll/views.py
... | ... | @@ -9,7 +9,7 @@ from django.utils.translation import ugettext_lazy as _ |
9 | 9 | from rolepermissions.verifications import has_role |
10 | 10 | from rolepermissions.verifications import has_object_permission |
11 | 11 | from django.db.models import Q |
12 | -# from django.views.generic.edit import FormMixin | |
12 | +from django.urls import reverse | |
13 | 13 | |
14 | 14 | from .forms import PollForm |
15 | 15 | from .models import Poll, Answer, AnswersStudent |
... | ... | @@ -41,7 +41,7 @@ class ViewPoll(LoginRequiredMixin,generic.DetailView): |
41 | 41 | return context |
42 | 42 | |
43 | 43 | |
44 | -class CreatePoll(LoginRequiredMixin,HasRoleMixin,generic.CreateView): | |
44 | +class CreatePoll(LoginRequiredMixin,HasRoleMixin, NotificationMixin,generic.CreateView): | |
45 | 45 | |
46 | 46 | allowed_roles = ['professor', 'system_admin'] |
47 | 47 | login_url = reverse_lazy("core:home") |
... | ... | @@ -63,15 +63,19 @@ class CreatePoll(LoginRequiredMixin,HasRoleMixin,generic.CreateView): |
63 | 63 | context.context_data['keys'] = keys |
64 | 64 | context.context_data['form'] = form |
65 | 65 | context.status_code = 400 |
66 | - # return self.render_to_response(context, status = 400) | |
66 | + s | |
67 | 67 | return context |
68 | 68 | |
69 | 69 | def form_valid(self, form): |
70 | 70 | self.object = form.save(commit = False) |
71 | 71 | topic = get_object_or_404(Topic, slug = self.kwargs.get('slug')) |
72 | 72 | self.object.topic = topic |
73 | + self.object.name = str(self.object) | |
73 | 74 | self.object.save() |
74 | 75 | |
76 | + super(CreatePoll, self).createNotification(message="create a Poll "+ self.object.name, actor=self.request.user, | |
77 | + resource_name=self.object.name, resource_link= reverse('course:poll:view_poll', args=[self.object.slug]), | |
78 | + users=self.object.topic.subject.students.all()) | |
75 | 79 | for key in self.request.POST: |
76 | 80 | if(key != 'csrfmiddlewaretoken' and key != 'name' and key != 'limit_date' and key != 'all_students' and key != 'students'): |
77 | 81 | answer = Answer(answer=self.request.POST[key],order=key,poll=self.object) | ... | ... |