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 %} #} + +