diff --git a/courses/templates/subject/form_view_teacher.html b/courses/templates/subject/form_view_teacher.html index 288159c..fee901e 100644 --- a/courses/templates/subject/form_view_teacher.html +++ b/courses/templates/subject/form_view_teacher.html @@ -1,4 +1,4 @@ -{% load static i18n list_topic_foruns %} +{% load static i18n list_topic_foruns%} {% block javascript %} @@ -54,6 +54,7 @@ @@ -426,7 +427,7 @@ - \ No newline at end of file + diff --git a/courses/templates/subject/poll_item_actions.html b/courses/templates/subject/poll_item_actions.html new file mode 100644 index 0000000..d73f096 --- /dev/null +++ b/courses/templates/subject/poll_item_actions.html @@ -0,0 +1,12 @@ +{% load static i18n %} + + + + +{% for poll in polls %} +
  • poll {{ poll.name }}
  • +{% endfor %} + + diff --git a/courses/templates/topic/index.html b/courses/templates/topic/index.html index a120833..ef96e5e 100644 --- a/courses/templates/topic/index.html +++ b/courses/templates/topic/index.html @@ -12,7 +12,7 @@ {% else %}
  • {{ topic.name }}
  • {% endif %} - + {% endblock %} @@ -103,7 +103,7 @@
    - +
    {% if user|has_role:'professor, system_admin' %}
    @@ -148,4 +148,23 @@
    + + + + +
    +
    {% endblock %} diff --git a/courses/templatetags/list_topic_foruns.py b/courses/templatetags/list_topic_foruns.py index 574e132..3ebd0e9 100644 --- a/courses/templatetags/list_topic_foruns.py +++ b/courses/templatetags/list_topic_foruns.py @@ -1,7 +1,7 @@ from django import template from forum.models import Forum - +from poll.models import Poll register = template.Library() """ @@ -16,4 +16,15 @@ def list_topic_foruns(request, topic): context['foruns'] = Forum.objects.filter(topic = topic) - return context \ No newline at end of file + return context + +@register.inclusion_tag('subject/poll_item_actions.html') +def list_topic_poll(request, topic): + context = { + 'request': request, + } + + context['polls'] = Poll.objects.filter(topic = topic) + context['topic'] = topic + + return context diff --git a/poll/static/js/modal_poll.js b/poll/static/js/modal_poll.js new file mode 100644 index 0000000..e435f80 --- /dev/null +++ b/poll/static/js/modal_poll.js @@ -0,0 +1,42 @@ +//controles do modal +$(window).ready(function() { // utilizado para abrir o modal quando tiver tido algum erro no preenchimento do formulario + if($('.not_submited').length){ + $('#poll').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){ + $('#poll').modal('hide'); + $.post(url,dados, function(data){ + }).fail(function(data){ + $("div.modal-backdrop.fade.in").remove(); + $("#modal_poll").empty(); + $("#modal_poll").append(data.responseText); + }); + } + , + remove: function(url,dados, id_li_link){ + $('#poll').modal('hide'); + $.post(url,dados, function(data){ + $(id_li_link).remove(); + $("#modal_poll").empty(); + $("div.modal-backdrop.fade.in").remove(); + }).fail(function(){ + $("#modal_poll").empty(); + $("#modal_poll").append(data); + $('#poll').modal('show'); + }); + } +} diff --git a/poll/static/js/modals_requisitions.js b/poll/static/js/modals_requisitions.js new file mode 100644 index 0000000..143f426 --- /dev/null +++ b/poll/static/js/modals_requisitions.js @@ -0,0 +1,20 @@ +function get(url, id_modal, id_div_modal){ + $.get(url, function(data){ + if($(id_modal).length){ + $(id_div_modal).empty(); + $(id_div_modal).append(data); + } else { + $(id_div_modal).append(data); + } + $(id_modal).modal('show'); + }); +} + +// function remove(url, id_li_link){ +// $.post(url, function(data){ +// $(id_li_link).remove(); +// }).fail(function(data){ +// alert("Error ao excluir a enquete"); +// alert(data); +// }); +// } diff --git a/poll/static/js/sortable_poll.js b/poll/static/js/sortable_poll.js new file mode 100644 index 0000000..151cd95 --- /dev/null +++ b/poll/static/js/sortable_poll.js @@ -0,0 +1,11 @@ +//deve ser importado apenas depois do html +$( "#form" ).sortable({ // utilizado para fazer a re-organização das respostas + delay: 100, + distance: 5, + update: function( event, ui ) { + var cont = 1; + $("#form div div div input").each(function(){ + $(this).attr('name',cont++); + }); + }, +}); diff --git a/poll/templates/poll/answer.html b/poll/templates/poll/answer.html new file mode 100644 index 0000000..2c253c1 --- /dev/null +++ b/poll/templates/poll/answer.html @@ -0,0 +1,19 @@ + +{% load i18n %} + +
    +
    +
    + +
    +
    +
    + + {% trans "Possible answer for the question" %} +
    +
    +
    +
    + +
    +
    diff --git a/poll/templates/poll/create.html b/poll/templates/poll/create.html index 30f5a1f..2ba1b5d 100644 --- a/poll/templates/poll/create.html +++ b/poll/templates/poll/create.html @@ -1,12 +1,14 @@ -{% extends "topic/index.html" %} +{# {% extends "topic/index.html" %} #} {% load i18n widget_tweaks dict_access static%} -{% block style %} +{# {% block style %} #} -{% endblock %} + -{% block content %} +{# {% endblock %} #} + +{# {% block content %} #}