Commit 91b3a37d3e608fb480ae1dec3964b821963aef8d

Authored by Matheus Lins
2 parents 7a958146 e2f9139c

confilt

core/templates/guest.html
@@ -81,6 +81,7 @@ @@ -81,6 +81,7 @@
81 </li> 81 </li>
82 <li data-toggle="tooltip" data-placement="bottom" title data-original-title="{% trans 'messages' %}"> <a href="#"><i class="fa fa-comments" aria-hidden="true"></i></a> </li> 82 <li data-toggle="tooltip" data-placement="bottom" title data-original-title="{% trans 'messages' %}"> <a href="#"><i class="fa fa-comments" aria-hidden="true"></i></a> </li>
83 <li > <a class="link" href="{% url 'app:index' %}">{{ user }}</a></li> 83 <li > <a class="link" href="{% url 'app:index' %}">{{ user }}</a></li>
  84 + <li data-toggle="tooltip" data-placement="bottom" title data-original-title="log out"> <a href="{% url 'app:index' %}"><i class="fa fa-sign-out" aria-hidden="true"></i></a></li>
84 </ul> 85 </ul>
85 </div> 86 </div>
86 </div> 87 </div>
courses/templates/topic/list_topic_foruns.html
1 -{% for forum in foruns %}  
2 - <li><i class="fa fa-commenting" aria-hidden="true"></i> <a id="forum_{{ forum.id }}" href="{% url 'course:forum:view' forum.slug %}"> {{ forum }}</a></li>  
3 -{% endfor %}  
4 \ No newline at end of file 1 \ No newline at end of file
  2 +<div class="foruns_list">
  3 + {% for forum in foruns %}
  4 + <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>
  5 + {% endfor %}
  6 +</div>
5 \ No newline at end of file 7 \ No newline at end of file
forum/static/js/forum.js
@@ -182,7 +182,7 @@ function edit_post(url, post_id, success_message) { @@ -182,7 +182,7 @@ function edit_post(url, post_id, success_message) {
182 success: function (data) { 182 success: function (data) {
183 alertify.success(success_message); 183 alertify.success(success_message);
184 184
185 - $("#post_"+post_id).parent().after(data); 185 + $("#post_"+post_id).parent().after(data.html);
186 frm.parent().parent().remove(); 186 frm.parent().parent().remove();
187 }, 187 },
188 error: function(data) { 188 error: function(data) {
@@ -344,7 +344,7 @@ function edit_post_answer(url, answer_id, success_message) { @@ -344,7 +344,7 @@ function edit_post_answer(url, answer_id, success_message) {
344 success: function (data) { 344 success: function (data) {
345 alertify.success(success_message); 345 alertify.success(success_message);
346 346
347 - $("#answer_"+answer_id).parent().after(data); 347 + $("#answer_"+answer_id).parent().after(data.html);
348 frm.parent().parent().remove(); 348 frm.parent().parent().remove();
349 }, 349 },
350 error: function(data) { 350 error: function(data) {
forum/templates/forum/forum_form.html
@@ -8,6 +8,7 @@ @@ -8,6 +8,7 @@
8 {% if field.field.widget.input_type == 'hidden' %} 8 {% if field.field.widget.input_type == 'hidden' %}
9 {% render_field field class='form-control' %} 9 {% render_field field class='form-control' %}
10 {% elif field.auto_id == 'id_limit_date' %} 10 {% elif field.auto_id == 'id_limit_date' %}
  11 + <label for="{{ field.auto_id }}">{{ field.label }}</label>
11 <input type="text" class="form-control date-picker"name="{{field.name}}" value="{{field.value|date:'SHORT_DATE_FORMAT'}}" id="{{ field.auto_id }}"> 12 <input type="text" class="form-control date-picker"name="{{field.name}}" value="{{field.value|date:'SHORT_DATE_FORMAT'}}" id="{{ field.auto_id }}">
12 <span id="helpBlock" class="help-block">{{ field.help_text }}</span> 13 <span id="helpBlock" class="help-block">{{ field.help_text }}</span>
13 {% else %} 14 {% else %}
forum/tests/test_model_answer.py
@@ -36,7 +36,6 @@ class PostAnswerTestCase (TestCase): @@ -36,7 +36,6 @@ class PostAnswerTestCase (TestCase):
36 36
37 self.course = Course.objects.create( 37 self.course = Course.objects.create(
38 name = 'Curso Teste', 38 name = 'Curso Teste',
39 - slug = 'curso_teste',  
40 max_students = 50, 39 max_students = 50,
41 init_register_date = '2016-08-26', 40 init_register_date = '2016-08-26',
42 end_register_date = '2016-10-01', 41 end_register_date = '2016-10-01',
forum/tests/test_model_forum.py
@@ -37,7 +37,6 @@ class ForumTestCase (TestCase): @@ -37,7 +37,6 @@ class ForumTestCase (TestCase):
37 37
38 self.course = Course.objects.create( 38 self.course = Course.objects.create(
39 name = 'Curso Teste', 39 name = 'Curso Teste',
40 - slug = 'curso_teste',  
41 max_students = 50, 40 max_students = 50,
42 init_register_date = '2016-08-26', 41 init_register_date = '2016-08-26',
43 end_register_date = '2016-10-01', 42 end_register_date = '2016-10-01',
forum/tests/test_model_post.py
@@ -36,7 +36,6 @@ class PostTestCase (TestCase): @@ -36,7 +36,6 @@ class PostTestCase (TestCase):
36 36
37 self.course = Course.objects.create( 37 self.course = Course.objects.create(
38 name = 'Curso Teste', 38 name = 'Curso Teste',
39 - slug = 'curso_teste',  
40 max_students = 50, 39 max_students = 50,
41 init_register_date = '2016-08-26', 40 init_register_date = '2016-08-26',
42 end_register_date = '2016-10-01', 41 end_register_date = '2016-10-01',
forum/tests/test_view_forum.py
@@ -42,13 +42,11 @@ class ForumViewTestCase (TestCase): @@ -42,13 +42,11 @@ class ForumViewTestCase (TestCase):
42 42
43 self.category = CourseCategory.objects.create( 43 self.category = CourseCategory.objects.create(
44 name = 'Category test', 44 name = 'Category test',
45 - slug = 'category_test'  
46 ) 45 )
47 self.category.save() 46 self.category.save()
48 47
49 self.course = Course.objects.create( 48 self.course = Course.objects.create(
50 name = 'Course Test', 49 name = 'Course Test',
51 - slug = 'course_test',  
52 max_students = 50, 50 max_students = 50,
53 init_register_date = '2016-08-26', 51 init_register_date = '2016-08-26',
54 end_register_date = '2016-10-01', 52 end_register_date = '2016-10-01',
@@ -60,7 +58,6 @@ class ForumViewTestCase (TestCase): @@ -60,7 +58,6 @@ class ForumViewTestCase (TestCase):
60 58
61 self.subject = Subject.objects.create( 59 self.subject = Subject.objects.create(
62 name = 'Subject Test', 60 name = 'Subject Test',
63 - slug='subject-test',  
64 description = "description of the subject test", 61 description = "description of the subject test",
65 visible = True, 62 visible = True,
66 course = self.course, 63 course = self.course,
@@ -80,7 +77,6 @@ class ForumViewTestCase (TestCase): @@ -80,7 +77,6 @@ class ForumViewTestCase (TestCase):
80 self.forum = Forum.objects.create( 77 self.forum = Forum.objects.create(
81 topic=self.topic, 78 topic=self.topic,
82 name = 'forum test', 79 name = 'forum test',
83 - slug='forum-test',  
84 description = 'description of the forum test', 80 description = 'description of the forum test',
85 create_date = '2016-10-02', 81 create_date = '2016-10-02',
86 modification_date = '2016-10-03', 82 modification_date = '2016-10-03',
@@ -180,7 +176,7 @@ class ForumViewTestCase (TestCase): @@ -180,7 +176,7 @@ class ForumViewTestCase (TestCase):
180 self.assertEquals(list_forum, Forum.objects.all().count()) 176 self.assertEquals(list_forum, Forum.objects.all().count())
181 177
182 response = self.client_student.post(url, data) 178 response = self.client_student.post(url, data)
183 - self.assertEquals (response.status_code, 400) 179 + self.assertEquals (response.status_code, 403)
184 self.assertEquals(list_forum, Forum.objects.all().count()) 180 self.assertEquals(list_forum, Forum.objects.all().count())
185 181
186 def test_CreateForum_form_ok (self): 182 def test_CreateForum_form_ok (self):
@@ -214,20 +210,7 @@ class ForumViewTestCase (TestCase): @@ -214,20 +210,7 @@ class ForumViewTestCase (TestCase):
214 self.assertEquals(response.status_code, 200) 210 self.assertEquals(response.status_code, 200)
215 211
216 response = self.client_professor.get(url) 212 response = self.client_professor.get(url)
217 - self.assertEquals(response.status_code, 200)  
218 -  
219 - #response = self.client_student.get(url)  
220 - #self.assertEquals(response.status_code, 400)  
221 -  
222 -  
223 - def test_UpdateForum_context(self):  
224 - url = reverse('course:forum:update', kwargs={'pk':self.forum.pk})  
225 -  
226 - response = self.client.get(url)  
227 - self.assertTrue('form' in response.context)  
228 -  
229 - response = self.client_professor.get(url)  
230 - self.assertTrue('form' in response.context) 213 + self.assertEquals(response.status_code, 302)
231 214
232 215
233 def test_UpdateForum_form_error (self): 216 def test_UpdateForum_form_error (self):
@@ -238,10 +221,10 @@ class ForumViewTestCase (TestCase): @@ -238,10 +221,10 @@ class ForumViewTestCase (TestCase):
238 self.assertEquals (response.status_code, 400) 221 self.assertEquals (response.status_code, 400)
239 222
240 response = self.client_professor.post(url, data) 223 response = self.client_professor.post(url, data)
241 - self.assertEquals (response.status_code, 400) 224 + self.assertEquals (response.status_code, 302)
242 225
243 response = self.client_student.post(url, data) 226 response = self.client_student.post(url, data)
244 - self.assertEquals (response.status_code, 400) 227 + self.assertEquals (response.status_code, 302)
245 228
246 def test_UpdateForum_form_ok (self): 229 def test_UpdateForum_form_ok (self):
247 url = reverse('course:forum:update', kwargs={'pk':self.forum.pk}) 230 url = reverse('course:forum:update', kwargs={'pk':self.forum.pk})
@@ -260,16 +243,16 @@ class ForumViewTestCase (TestCase): @@ -260,16 +243,16 @@ class ForumViewTestCase (TestCase):
260 243
261 data['name'] = 'Forum Updated as professor' 244 data['name'] = 'Forum Updated as professor'
262 self.assertEquals(Forum.objects.all()[0].name, 'Forum Updated') 245 self.assertEquals(Forum.objects.all()[0].name, 'Forum Updated')
263 - response = self.client_professor.post(url, data) 246 + response = self.client.post(url, data)
264 self.assertEquals (response.status_code, 302) 247 self.assertEquals (response.status_code, 302)
265 self.assertEquals(Forum.objects.all()[0].name, 'Forum Updated as professor') 248 self.assertEquals(Forum.objects.all()[0].name, 'Forum Updated as professor')
266 forum = Forum.objects.get(name='Forum Updated as professor') 249 forum = Forum.objects.get(name='Forum Updated as professor')
267 250
268 - #data['name'] = 'Forum Updated as student'  
269 - #self.assertEquals(Forum.objects.all()[0].name, 'Forum Updated as professor')  
270 - #response = self.client_student.post(url, data)  
271 - #self.assertEquals (response.status_code, 400)  
272 - #self.assertNotEquals(Forum.objects.all()[0].name, 'Forum Updated as student') 251 + data['name'] = 'Forum Updated as student'
  252 + self.assertEquals(Forum.objects.all()[0].name, 'Forum Updated as professor')
  253 + response = self.client_student.post(url, data)
  254 + self.assertEquals (response.status_code, 302)
  255 + self.assertNotEquals(Forum.objects.all()[0].name, 'Forum Updated as student')
273 forum = Forum.objects.get(name='Forum Updated as professor') 256 forum = Forum.objects.get(name='Forum Updated as professor')
274 257
275 ######################### CreatePostView ######################### 258 ######################### CreatePostView #########################
users/templates/users/edit_profile.html
@@ -36,7 +36,7 @@ @@ -36,7 +36,7 @@
36 <label for="{{ field.auto_id }}">{{ field.label }}</label> 36 <label for="{{ field.auto_id }}">{{ field.label }}</label>
37 {% endif %} 37 {% endif %}
38 {% if field.auto_id == 'id_birth_date' %} 38 {% if field.auto_id == 'id_birth_date' %}
39 - <input type="text" class="form-control date-picker"name="{{field.name}}" value="{% if field.value.year %}{{field.value|date:'m/d/Y'}}{% else %}{{field.value}}{% endif %}" min="{{now|date:'m/d/Y'}}" id="{{ field.auto_id }}"> 39 + <input type="text" class="form-control date-picker"name="{{field.name}}" value="{{field.value|date:'SHORT_DATE_FORMAT'}}" min="{{now|date:'SHORT_DATE_FORMAT'}}" id="{{ field.auto_id }}">
40 <span id="helpBlock" class="help-block">{{ field.help_text }}</span> 40 <span id="helpBlock" class="help-block">{{ field.help_text }}</span>
41 {% elif field.auto_id == 'id_image' or field.auto_id == 'id_curriculum'%} 41 {% elif field.auto_id == 'id_image' or field.auto_id == 'id_curriculum'%}
42 {% render_field field class='form-control input-sm' %} 42 {% render_field field class='form-control input-sm' %}