Commit 91b3a37d3e608fb480ae1dec3964b821963aef8d

Authored by Matheus Lins
2 parents 7a958146 e2f9139c

confilt

core/templates/guest.html
... ... @@ -81,6 +81,7 @@
81 81 </li>
82 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 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 85 </ul>
85 86 </div>
86 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 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 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 182 success: function (data) {
183 183 alertify.success(success_message);
184 184  
185   - $("#post_"+post_id).parent().after(data);
  185 + $("#post_"+post_id).parent().after(data.html);
186 186 frm.parent().parent().remove();
187 187 },
188 188 error: function(data) {
... ... @@ -344,7 +344,7 @@ function edit_post_answer(url, answer_id, success_message) {
344 344 success: function (data) {
345 345 alertify.success(success_message);
346 346  
347   - $("#answer_"+answer_id).parent().after(data);
  347 + $("#answer_"+answer_id).parent().after(data.html);
348 348 frm.parent().parent().remove();
349 349 },
350 350 error: function(data) {
... ...
forum/templates/forum/forum_form.html
... ... @@ -8,6 +8,7 @@
8 8 {% if field.field.widget.input_type == 'hidden' %}
9 9 {% render_field field class='form-control' %}
10 10 {% elif field.auto_id == 'id_limit_date' %}
  11 + <label for="{{ field.auto_id }}">{{ field.label }}</label>
11 12 <input type="text" class="form-control date-picker"name="{{field.name}}" value="{{field.value|date:'SHORT_DATE_FORMAT'}}" id="{{ field.auto_id }}">
12 13 <span id="helpBlock" class="help-block">{{ field.help_text }}</span>
13 14 {% else %}
... ...
forum/tests/test_model_answer.py
... ... @@ -36,7 +36,6 @@ class PostAnswerTestCase (TestCase):
36 36  
37 37 self.course = Course.objects.create(
38 38 name = 'Curso Teste',
39   - slug = 'curso_teste',
40 39 max_students = 50,
41 40 init_register_date = '2016-08-26',
42 41 end_register_date = '2016-10-01',
... ...
forum/tests/test_model_forum.py
... ... @@ -37,7 +37,6 @@ class ForumTestCase (TestCase):
37 37  
38 38 self.course = Course.objects.create(
39 39 name = 'Curso Teste',
40   - slug = 'curso_teste',
41 40 max_students = 50,
42 41 init_register_date = '2016-08-26',
43 42 end_register_date = '2016-10-01',
... ...
forum/tests/test_model_post.py
... ... @@ -36,7 +36,6 @@ class PostTestCase (TestCase):
36 36  
37 37 self.course = Course.objects.create(
38 38 name = 'Curso Teste',
39   - slug = 'curso_teste',
40 39 max_students = 50,
41 40 init_register_date = '2016-08-26',
42 41 end_register_date = '2016-10-01',
... ...
forum/tests/test_view_forum.py
... ... @@ -42,13 +42,11 @@ class ForumViewTestCase (TestCase):
42 42  
43 43 self.category = CourseCategory.objects.create(
44 44 name = 'Category test',
45   - slug = 'category_test'
46 45 )
47 46 self.category.save()
48 47  
49 48 self.course = Course.objects.create(
50 49 name = 'Course Test',
51   - slug = 'course_test',
52 50 max_students = 50,
53 51 init_register_date = '2016-08-26',
54 52 end_register_date = '2016-10-01',
... ... @@ -60,7 +58,6 @@ class ForumViewTestCase (TestCase):
60 58  
61 59 self.subject = Subject.objects.create(
62 60 name = 'Subject Test',
63   - slug='subject-test',
64 61 description = "description of the subject test",
65 62 visible = True,
66 63 course = self.course,
... ... @@ -80,7 +77,6 @@ class ForumViewTestCase (TestCase):
80 77 self.forum = Forum.objects.create(
81 78 topic=self.topic,
82 79 name = 'forum test',
83   - slug='forum-test',
84 80 description = 'description of the forum test',
85 81 create_date = '2016-10-02',
86 82 modification_date = '2016-10-03',
... ... @@ -180,7 +176,7 @@ class ForumViewTestCase (TestCase):
180 176 self.assertEquals(list_forum, Forum.objects.all().count())
181 177  
182 178 response = self.client_student.post(url, data)
183   - self.assertEquals (response.status_code, 400)
  179 + self.assertEquals (response.status_code, 403)
184 180 self.assertEquals(list_forum, Forum.objects.all().count())
185 181  
186 182 def test_CreateForum_form_ok (self):
... ... @@ -214,20 +210,7 @@ class ForumViewTestCase (TestCase):
214 210 self.assertEquals(response.status_code, 200)
215 211  
216 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 216 def test_UpdateForum_form_error (self):
... ... @@ -238,10 +221,10 @@ class ForumViewTestCase (TestCase):
238 221 self.assertEquals (response.status_code, 400)
239 222  
240 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 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 229 def test_UpdateForum_form_ok (self):
247 230 url = reverse('course:forum:update', kwargs={'pk':self.forum.pk})
... ... @@ -260,16 +243,16 @@ class ForumViewTestCase (TestCase):
260 243  
261 244 data['name'] = 'Forum Updated as professor'
262 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 247 self.assertEquals (response.status_code, 302)
265 248 self.assertEquals(Forum.objects.all()[0].name, 'Forum Updated as professor')
266 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 256 forum = Forum.objects.get(name='Forum Updated as professor')
274 257  
275 258 ######################### CreatePostView #########################
... ...
users/templates/users/edit_profile.html
... ... @@ -36,7 +36,7 @@
36 36 <label for="{{ field.auto_id }}">{{ field.label }}</label>
37 37 {% endif %}
38 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 40 <span id="helpBlock" class="help-block">{{ field.help_text }}</span>
41 41 {% elif field.auto_id == 'id_image' or field.auto_id == 'id_curriculum'%}
42 42 {% render_field field class='form-control input-sm' %}
... ...