From 537af213ca6a7540c3f4c4058e0b07986295cfae Mon Sep 17 00:00:00 2001 From: ifac0 Date: Thu, 3 Nov 2016 17:24:56 -0300 Subject: [PATCH] template create/remove/update/view de avaliacao #254 --- amadeus/staticfiles/js/modal_exam.js | 43 +++++++++++++++++++++++++++++++++++++++++++ courses/templates/subject/exam_item_actions.html | 20 ++++++++++++++++++++ courses/templates/subject/form_view_teacher.html | 2 ++ courses/templates/subject/poll_item_actions.html | 4 ++++ courses/templates/topic/topic_card_student.html | 9 +++++---- courses/templatetags/list_topic_foruns.py | 12 ++++++++++++ exam/templates/exam/create.html | 147 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++---------------------------------------------------------- exam/templates/exam/discursive_question.html | 6 ------ exam/templates/exam/discursive_question.html.py | 6 ------ exam/templates/exam/gap_filling_answer.html | 0 exam/templates/exam/gap_filling_answer.html.py | 0 exam/templates/exam/gap_filling_question.html | 3 --- exam/templates/exam/gap_filling_question.html.py | 3 --- exam/templates/exam/multiple_choice_answer.html | 0 exam/templates/exam/multiple_choice_answer.html.py | 0 exam/templates/exam/multiple_choice_question.html | 42 ------------------------------------------ exam/templates/exam/multiple_choice_question.html.py | 42 ------------------------------------------ exam/templates/exam/questions/discursive_question.html | 6 ++++++ exam/templates/exam/questions/discursive_question.html.py | 6 ++++++ exam/templates/exam/questions/gap_filling_answer.html | 0 exam/templates/exam/questions/gap_filling_answer.html.py | 0 exam/templates/exam/questions/gap_filling_question.html | 3 +++ exam/templates/exam/questions/gap_filling_question.html.py | 3 +++ exam/templates/exam/questions/multiple_choice_answer.html | 0 exam/templates/exam/questions/multiple_choice_answer.html.py | 0 exam/templates/exam/questions/multiple_choice_question.html | 42 ++++++++++++++++++++++++++++++++++++++++++ exam/templates/exam/questions/multiple_choice_question.html.py | 42 ++++++++++++++++++++++++++++++++++++++++++ exam/templates/exam/questions/true_or_false_answer.html | 15 +++++++++++++++ exam/templates/exam/questions/true_or_false_answer.html.py | 15 +++++++++++++++ exam/templates/exam/questions/true_or_false_question.html | 67 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ exam/templates/exam/questions/true_or_false_question.html.py | 67 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ exam/templates/exam/remove.html | 27 +++++++++++++++++++++++++++ exam/templates/exam/true_or_false_answer.html | 15 --------------- exam/templates/exam/true_or_false_answer.html.py | 15 --------------- exam/templates/exam/true_or_false_question.html | 67 ------------------------------------------------------------------- exam/templates/exam/true_or_false_question.html.py | 67 ------------------------------------------------------------------- exam/templates/exam/update.html | 32 ++++++++++++++++++++++++++++++++ exam/templates/exam/view.html | 28 ++++++++++++++++++++++++++++ exam/views.py | 2 +- poll/templates/poll/create.html | 2 +- 40 files changed, 530 insertions(+), 330 deletions(-) create mode 100644 amadeus/staticfiles/js/modal_exam.js create mode 100644 courses/templates/subject/exam_item_actions.html delete mode 100644 exam/templates/exam/discursive_question.html delete mode 100644 exam/templates/exam/discursive_question.html.py delete mode 100644 exam/templates/exam/gap_filling_answer.html delete mode 100644 exam/templates/exam/gap_filling_answer.html.py delete mode 100644 exam/templates/exam/gap_filling_question.html delete mode 100644 exam/templates/exam/gap_filling_question.html.py delete mode 100644 exam/templates/exam/multiple_choice_answer.html delete mode 100644 exam/templates/exam/multiple_choice_answer.html.py delete mode 100644 exam/templates/exam/multiple_choice_question.html delete mode 100644 exam/templates/exam/multiple_choice_question.html.py create mode 100644 exam/templates/exam/questions/discursive_question.html create mode 100644 exam/templates/exam/questions/discursive_question.html.py create mode 100644 exam/templates/exam/questions/gap_filling_answer.html create mode 100644 exam/templates/exam/questions/gap_filling_answer.html.py create mode 100644 exam/templates/exam/questions/gap_filling_question.html create mode 100644 exam/templates/exam/questions/gap_filling_question.html.py create mode 100644 exam/templates/exam/questions/multiple_choice_answer.html create mode 100644 exam/templates/exam/questions/multiple_choice_answer.html.py create mode 100644 exam/templates/exam/questions/multiple_choice_question.html create mode 100644 exam/templates/exam/questions/multiple_choice_question.html.py create mode 100644 exam/templates/exam/questions/true_or_false_answer.html create mode 100644 exam/templates/exam/questions/true_or_false_answer.html.py create mode 100644 exam/templates/exam/questions/true_or_false_question.html create mode 100644 exam/templates/exam/questions/true_or_false_question.html.py delete mode 100644 exam/templates/exam/true_or_false_answer.html delete mode 100644 exam/templates/exam/true_or_false_answer.html.py delete mode 100644 exam/templates/exam/true_or_false_question.html delete mode 100644 exam/templates/exam/true_or_false_question.html.py diff --git a/amadeus/staticfiles/js/modal_exam.js b/amadeus/staticfiles/js/modal_exam.js new file mode 100644 index 0000000..794f98d --- /dev/null +++ b/amadeus/staticfiles/js/modal_exam.js @@ -0,0 +1,43 @@ +//controles do modal +$(window).ready(function() { // utilizado para abrir o modal quando tiver tido algum erro no preenchimento do formulario + if($('.not_submited').length){ + $('#exam').modal('show'); + } +}); +var Answer = { + init: function(url) { // utilizado para adicionar um novo campo de resposta + $.get(url, function(data){ + $("#form").append(data); + var cont = 1; + $("#form div div div input").each(function(){ + $(this).attr('name',cont++); + }); + }); + } +}; + +var Submite = { + post: function(url,dados){ + $('#exam').modal('hide'); + $.post(url,dados, function(data){ + }).fail(function(data){ + $("div.modal-backdrop.fade.in").remove(); + $("#modal_exam").empty(); + $("#modal_exam").append(data.responseText); + }); + }, + remove: function(url,dados, id_li_link){ + $('#exam').modal('hide'); + $.post(url,dados, function(data){ + $(id_li_link).remove(); + $("#modal_exam").empty(); + $("div.modal-backdrop.fade.in").remove(); + }).fail(function(){ + $("#modal_exam").empty(); + $("#modal_exam").append(data); + $('#exam').modal('show'); + }); + } +} + +alert("essfd"); diff --git a/courses/templates/subject/exam_item_actions.html b/courses/templates/subject/exam_item_actions.html new file mode 100644 index 0000000..626934e --- /dev/null +++ b/courses/templates/subject/exam_item_actions.html @@ -0,0 +1,20 @@ +{% load static i18n permission_tags professor_access %} + + + + +{% for exam in exams %} + {% professor_subject exam.topic.subject request.user as permission%} + {% if permission %} +
  • {% trans 'exam' %} {{ exam.name }}
  • + {% else %} +
  • {% trans 'exam' %} {{ exam.name }}
  • + {% endif %} + {% endfor %} +{# #} + diff --git a/courses/templates/subject/form_view_teacher.html b/courses/templates/subject/form_view_teacher.html index f6c831e..970cb3b 100644 --- a/courses/templates/subject/form_view_teacher.html +++ b/courses/templates/subject/form_view_teacher.html @@ -93,10 +93,12 @@ diff --git a/courses/templates/subject/poll_item_actions.html b/courses/templates/subject/poll_item_actions.html index a5942f2..bc92782 100644 --- a/courses/templates/subject/poll_item_actions.html +++ b/courses/templates/subject/poll_item_actions.html @@ -3,6 +3,7 @@ + {% for poll in polls %} {% professor_subject poll.topic.subject request.user as permission%} {% if permission %} @@ -14,4 +15,7 @@ {# #} diff --git a/courses/templates/topic/topic_card_student.html b/courses/templates/topic/topic_card_student.html index 76b7ba0..432a717 100644 --- a/courses/templates/topic/topic_card_student.html +++ b/courses/templates/topic/topic_card_student.html @@ -6,11 +6,11 @@

    {% trans "Materials" %}

    - +
    @@ -19,10 +19,11 @@
    - - \ No newline at end of file + + diff --git a/courses/templatetags/list_topic_foruns.py b/courses/templatetags/list_topic_foruns.py index d095904..e775a68 100644 --- a/courses/templatetags/list_topic_foruns.py +++ b/courses/templatetags/list_topic_foruns.py @@ -3,6 +3,7 @@ from django import template from links.models import Link from forum.models import Forum from poll.models import Poll +from exam.models import Exam from files.models import TopicFile register = template.Library() @@ -31,6 +32,17 @@ def list_topic_poll(request, topic): return context +@register.inclusion_tag('subject/exam_item_actions.html') +def list_topic_exam(request, topic): + context = { + 'request': request, + } + + context['exams'] = Exam.objects.filter(topic = topic) + context['topic'] = topic + + return context + @register.inclusion_tag('topic/list_file.html') def list_topic_file(request, topic): context = { diff --git a/exam/templates/exam/create.html b/exam/templates/exam/create.html index aabeeaf..a04bcf8 100644 --- a/exam/templates/exam/create.html +++ b/exam/templates/exam/create.html @@ -1,68 +1,95 @@ -{% extends "base.html" %} +{# {% extends "topic/index.html" %} #} -{% load i18n %} +{% load i18n widget_tweaks dict_access static%} -{% block content %} -
    -
    - {% block title_poll %} -

    {% trans "New Exam" %}

    - {% endblock title_poll %} -
    -
    -
    - -
    - -
    -
    -
    - -
    - -
    -
    -
    - -
    - -
    -
    -
    -
    -
    - -
    -
    -
    -
    +{# {% block style %} #} + + -
    -
    - -
    - +{# {% endblock %} #} + +{# {% block content %} #} + +