Commit 6ee24e2b500ca69c9c34f3a9726d0ed05bb2d972
1 parent
eb7ac9eb
Exists in
master
and in
5 other branches
consertando erros no modal de links
Showing
9 changed files
with
27 additions
and
106 deletions
Show diff stats
.gitignore
core/static/js/topic_editation_presentation.js
| @@ -1,79 +0,0 @@ | @@ -1,79 +0,0 @@ | ||
| 1 | - | ||
| 2 | -var x = 0; | ||
| 3 | -$(".edit_card").on('click', function() { | ||
| 4 | - $(".presentation").css('display','none'); | ||
| 5 | - $(".editation").css('display','block'); | ||
| 6 | -}) | ||
| 7 | -$(".edit_card_end").on('click', function() { | ||
| 8 | - $(".editation").css('display','none'); | ||
| 9 | - $(".presentation").css('display','block'); | ||
| 10 | -}) | ||
| 11 | - | ||
| 12 | -$("#bot").on('click', function(){ | ||
| 13 | - x = x+1; | ||
| 14 | - console.log(2) | ||
| 15 | - if(x%2 == 0){ | ||
| 16 | - console.log(0) | ||
| 17 | - $("#down").attr('class', 'fa fa-caret-square-o-down'); | ||
| 18 | -} | ||
| 19 | -else{ | ||
| 20 | - console.log(1) | ||
| 21 | - $("#down").attr('class', 'fa fa-caret-square-o-up'); | ||
| 22 | -} | ||
| 23 | - | ||
| 24 | -}) | ||
| 25 | -$("#bot1").on('click', function(){ | ||
| 26 | - x = x+1; | ||
| 27 | - console.log(2) | ||
| 28 | - if(x%2 == 0){ | ||
| 29 | - console.log(0) | ||
| 30 | - $("#down1").attr('class', 'fa fa-caret-square-o-down'); | ||
| 31 | -} | ||
| 32 | -else{ | ||
| 33 | - console.log(1) | ||
| 34 | - $("#down1").attr('class', 'fa fa-caret-square-o-up'); | ||
| 35 | -} | ||
| 36 | - | ||
| 37 | -}) | ||
| 38 | - | ||
| 39 | -$("#bot2").on('click', function(){ | ||
| 40 | - x = x+1; | ||
| 41 | - console.log(2) | ||
| 42 | - if(x%2 == 0){ | ||
| 43 | - console.log(0) | ||
| 44 | - $("#down2").attr('class', 'fa fa-caret-square-o-down'); | ||
| 45 | -} | ||
| 46 | -else{ | ||
| 47 | - console.log(1) | ||
| 48 | - $("#down2").attr('class', 'fa fa-caret-square-o-up'); | ||
| 49 | -} | ||
| 50 | - | ||
| 51 | -}) | ||
| 52 | - | ||
| 53 | -$("#bot3").on('click', function(){ | ||
| 54 | - x = x+1; | ||
| 55 | - console.log(2) | ||
| 56 | - if(x%2 == 0){ | ||
| 57 | - console.log(0) | ||
| 58 | - $("#down3").attr('class', 'fa fa-caret-square-o-down'); | ||
| 59 | -} | ||
| 60 | -else{ | ||
| 61 | - console.log(1) | ||
| 62 | - $("#down3").attr('class', 'fa fa-caret-square-o-up'); | ||
| 63 | -} | ||
| 64 | - | ||
| 65 | -}) | ||
| 66 | -$("#bot4").on('click', function(){ | ||
| 67 | - x = x+1; | ||
| 68 | - console.log(2) | ||
| 69 | - if(x%2 == 0){ | ||
| 70 | - console.log(0) | ||
| 71 | - $("#down4").attr('class', 'fa fa-caret-square-o-down'); | ||
| 72 | -} | ||
| 73 | -else{ | ||
| 74 | - console.log(1) | ||
| 75 | - $("#down4").attr('class', 'fa fa-caret-square-o-up'); | ||
| 76 | -} | ||
| 77 | - | ||
| 78 | -}) | ||
| 79 | - |
courses/static/js/topic_editation_presentation.js
| 1 | + | ||
| 1 | $(document).ready(function(){ | 2 | $(document).ready(function(){ |
| 2 | $(".editation").hide(); | 3 | $(".editation").hide(); |
| 3 | }); | 4 | }); |
| @@ -10,5 +11,3 @@ function show_presentation(id_topic){ | @@ -10,5 +11,3 @@ function show_presentation(id_topic){ | ||
| 10 | $(".editation_"+ id_topic).hide(); | 11 | $(".editation_"+ id_topic).hide(); |
| 11 | $(".presentation_"+ id_topic).show(); | 12 | $(".presentation_"+ id_topic).show(); |
| 12 | }; | 13 | }; |
| 13 | - | ||
| 14 | - |
courses/templates/subject/form_view_teacher.html
| @@ -125,7 +125,7 @@ | @@ -125,7 +125,7 @@ | ||
| 125 | {# opções de cancelar e editar no modo de edição #} | 125 | {# opções de cancelar e editar no modo de edição #} |
| 126 | <div class="form-group editation editation_{{topic.slug}}"> | 126 | <div class="form-group editation editation_{{topic.slug}}"> |
| 127 | <div class="col-md-10"> | 127 | <div class="col-md-10"> |
| 128 | - <a href="javascript:show_presentation('{{topic.slug}}')" class="btn btn-raise btn-default">{% trans 'Back' %}</a> | 128 | + <a href="javascript:show_presentation('{{topic.slug}}')" class="btn btn-raised btn-default">{% trans 'Back' %}</a> |
| 129 | {# <a href="javascript:show_presentation('{{topic.slug}}')" class="btn btn-raised btn-primary">{% trans 'Submit' %}</a>#} | 129 | {# <a href="javascript:show_presentation('{{topic.slug}}')" class="btn btn-raised btn-primary">{% trans 'Submit' %}</a>#} |
| 130 | </div> | 130 | </div> |
| 131 | </div> | 131 | </div> |
links/templates/links/create_link.html
| @@ -45,6 +45,7 @@ | @@ -45,6 +45,7 @@ | ||
| 45 | {# // <script src="{% static 'js/links.js' %}"></script> #} | 45 | {# // <script src="{% static 'js/links.js' %}"></script> #} |
| 46 | <script type="text/javascript"> | 46 | <script type="text/javascript"> |
| 47 | $("#form-link").submit(function(event) { | 47 | $("#form-link").submit(function(event) { |
| 48 | + $("#createLinksModal").modal("hide"); | ||
| 48 | var data = new FormData($('#form-link').get(0)); | 49 | var data = new FormData($('#form-link').get(0)); |
| 49 | $.ajax({ | 50 | $.ajax({ |
| 50 | url: "{% url 'course:links:create_link' topic.slug %}", | 51 | url: "{% url 'course:links:create_link' topic.slug %}", |
| @@ -54,15 +55,16 @@ | @@ -54,15 +55,16 @@ | ||
| 54 | processData: false, | 55 | processData: false, |
| 55 | contentType: false, | 56 | contentType: false, |
| 56 | success: function(data) { | 57 | success: function(data) { |
| 57 | - $('#createLinksModal').modal('hide'); | 58 | + $('#requisicoes_ajax').empty(); |
| 58 | $('#list-topic{{ topic.id }}-links').append(data); | 59 | $('#list-topic{{ topic.id }}-links').append(data); |
| 59 | $('#list-topic{{ topic.id }}-links-edit').append(data); | 60 | $('#list-topic{{ topic.id }}-links-edit').append(data); |
| 60 | alertify.alert('Link successfully created!') | 61 | alertify.alert('Link successfully created!') |
| 61 | }, | 62 | }, |
| 62 | error: function(data){ | 63 | error: function(data){ |
| 63 | - $('.erro').html(data.responseText); | ||
| 64 | - $('.modal-backdrop').remove(); | ||
| 65 | - $('#createLinksModal').modal(); | 64 | + $("div.modal-backdrop.fade.in").remove(); |
| 65 | + $('#requisicoes_ajax').empty(); | ||
| 66 | + $('#requisicoes_ajax').append(data.responseText); | ||
| 67 | + $('#createLinksModal').modal('show'); | ||
| 66 | alertify.alert('Invalid link, insert a valid one!'); | 68 | alertify.alert('Invalid link, insert a valid one!'); |
| 67 | } | 69 | } |
| 68 | }); | 70 | }); |
links/templates/links/delete_link.html
| @@ -40,6 +40,7 @@ | @@ -40,6 +40,7 @@ | ||
| 40 | <script type="text/javascript"> | 40 | <script type="text/javascript"> |
| 41 | $("#form-delete-link").submit(function(event) { | 41 | $("#form-delete-link").submit(function(event) { |
| 42 | var data = new FormData($('#form-delete-link').get(0)); | 42 | var data = new FormData($('#form-delete-link').get(0)); |
| 43 | + $('#linkDeleteModal').modal('hide'); | ||
| 43 | $.ajax({ | 44 | $.ajax({ |
| 44 | url: "{% url 'course:links:delete_link' link.slug %}", | 45 | url: "{% url 'course:links:delete_link' link.slug %}", |
| 45 | type: $("#form-delete-link").attr('method'), | 46 | type: $("#form-delete-link").attr('method'), |
| @@ -48,16 +49,17 @@ | @@ -48,16 +49,17 @@ | ||
| 48 | processData: false, | 49 | processData: false, |
| 49 | contentType: false, | 50 | contentType: false, |
| 50 | success: function(data) { | 51 | success: function(data) { |
| 51 | - $('#linkDeleteModal').modal('hide'); | 52 | + $('#requisicoes_ajax').empty(); |
| 52 | $('#link_{{ link.slug }}').remove(); | 53 | $('#link_{{ link.slug }}').remove(); |
| 53 | $('#link_edit_icon_{{ link.slug }}').remove(); | 54 | $('#link_edit_icon_{{ link.slug }}').remove(); |
| 54 | $('#link_edit_{{ link.slug }}').remove(); | 55 | $('#link_edit_{{ link.slug }}').remove(); |
| 55 | alertify.alert('Link successfully deleted!') | 56 | alertify.alert('Link successfully deleted!') |
| 56 | }, | 57 | }, |
| 57 | error: function(data){ | 58 | error: function(data){ |
| 58 | - // $('.erro-update').html(data.responseText); | ||
| 59 | - $('.modal-backdrop').remove(); | ||
| 60 | - $('#linkDeteleModal').modal(); | 59 | + $("div.modal-backdrop.fade.in").remove(); |
| 60 | + $('#requisicoes_ajax').empty(); | ||
| 61 | + $('#requisicoes_ajax').append(data.responseText); | ||
| 62 | + $('#linkDeleteModal').modal('show'); | ||
| 61 | alertify.alert('Error when trying to delete.'); | 63 | alertify.alert('Error when trying to delete.'); |
| 62 | } | 64 | } |
| 63 | }); | 65 | }); |
links/templates/links/update_link.html
| @@ -50,6 +50,7 @@ | @@ -50,6 +50,7 @@ | ||
| 50 | {# // <script src="{% static 'js/links.js' %}"></script> #} | 50 | {# // <script src="{% static 'js/links.js' %}"></script> #} |
| 51 | <script type="text/javascript"> | 51 | <script type="text/javascript"> |
| 52 | $("#form-update-link").submit(function(event) { | 52 | $("#form-update-link").submit(function(event) { |
| 53 | + $('#linksModalEdit').modal('hide'); | ||
| 53 | var data = new FormData($('#form-update-link').get(0)); | 54 | var data = new FormData($('#form-update-link').get(0)); |
| 54 | $.ajax({ | 55 | $.ajax({ |
| 55 | url: "{% url 'course:links:update_link' link.slug %}", | 56 | url: "{% url 'course:links:update_link' link.slug %}", |
| @@ -59,14 +60,15 @@ | @@ -59,14 +60,15 @@ | ||
| 59 | processData: false, | 60 | processData: false, |
| 60 | contentType: false, | 61 | contentType: false, |
| 61 | success: function(data) { | 62 | success: function(data) { |
| 62 | - $('#linksModalEdit').modal('hide'); | 63 | + $('#requisicoes_ajax').empty(); |
| 63 | $('#link_edit_{{ link.slug }}').replaceWith(data); | 64 | $('#link_edit_{{ link.slug }}').replaceWith(data); |
| 64 | $('#link_{{ link.slug }}').replaceWith(data); | 65 | $('#link_{{ link.slug }}').replaceWith(data); |
| 65 | alertify.alert("Sucessfully Updated!") | 66 | alertify.alert("Sucessfully Updated!") |
| 66 | }, | 67 | }, |
| 67 | error: function(data){ | 68 | error: function(data){ |
| 68 | - $('.erro-update').html(data.responseText); | ||
| 69 | - $('.modal-backdrop').remove(); | 69 | + $("div.modal-backdrop.fade.in").remove(); |
| 70 | + $('#requisicoes_ajax').empty(); | ||
| 71 | + $('#requisicoes_ajax').append(data.responseText); | ||
| 70 | $('#linksModalEdit').modal(); | 72 | $('#linksModalEdit').modal(); |
| 71 | alertify.alert('Invalid link, insert a valid one!'); | 73 | alertify.alert('Invalid link, insert a valid one!'); |
| 72 | } | 74 | } |
links/templates/links/view_link.html
| @@ -22,10 +22,6 @@ | @@ -22,10 +22,6 @@ | ||
| 22 | </div> | 22 | </div> |
| 23 | </div> | 23 | </div> |
| 24 | </div> | 24 | </div> |
| 25 | - | ||
| 26 | -<div class = 'row' id ="divModalLink"> | ||
| 27 | - | ||
| 28 | -</div> | ||
| 29 | <!-- EndModal --> | 25 | <!-- EndModal --> |
| 30 | <script type="text/javascript"> | 26 | <script type="text/javascript"> |
| 31 | $('.modal-backdrop').remove(); | 27 | $('.modal-backdrop').remove(); |
poll/static/js/modal_poll.js
| 1 | -// | 1 | +// |
| 2 | // //controles do modal | 2 | // //controles do modal |
| 3 | // $(window).ready(function() { // utilizado para abrir o modal quando tiver tido algum erro no preenchimento do formulario | 3 | // $(window).ready(function() { // utilizado para abrir o modal quando tiver tido algum erro no preenchimento do formulario |
| 4 | // if($('.not_submited').length){ | 4 | // if($('.not_submited').length){ |
| @@ -38,7 +38,8 @@ var Submite = { | @@ -38,7 +38,8 @@ var Submite = { | ||
| 38 | } | 38 | } |
| 39 | }); | 39 | }); |
| 40 | $("#requisicoes_ajax").empty(); | 40 | $("#requisicoes_ajax").empty(); |
| 41 | - alertify.alert('Link successfully created!'); | 41 | + alertify.alert('Poll successfully created!'); |
| 42 | + $("div.modal-backdrop.fade.in").remove(); | ||
| 42 | }).fail(function(data){ | 43 | }).fail(function(data){ |
| 43 | $("div.modal-backdrop.fade.in").remove(); | 44 | $("div.modal-backdrop.fade.in").remove(); |
| 44 | $("#requisicoes_ajax").empty(); | 45 | $("#requisicoes_ajax").empty(); |
| @@ -49,12 +50,9 @@ var Submite = { | @@ -49,12 +50,9 @@ var Submite = { | ||
| 49 | update: function(url,dados, slug_poll, slug_topic){ | 50 | update: function(url,dados, slug_poll, slug_topic){ |
| 50 | $('#poll').modal('hide'); | 51 | $('#poll').modal('hide'); |
| 51 | $.post(url,dados, function(data){ | 52 | $.post(url,dados, function(data){ |
| 52 | - $('#list-topic-'+ slug_topic +'-poll #'+slug_poll).remove(); | ||
| 53 | - $('#list-topic-'+ slug_topic +'-poll #'+slug_poll).remove(); | ||
| 54 | - $('#list-topic-'+ slug_topic +'-poll').append(data); | ||
| 55 | - $('#list-topic-'+ slug_topic +'-poll-edit').append(data); | ||
| 56 | - $("#requisicoes_ajax").empty(); | ||
| 57 | - alertify.alert('Link successfully updated!') | 53 | + $('#list-topic-'+ slug_topic +'-poll #'+slug_poll).replaceWith(data); |
| 54 | + $('#list-topic-'+ slug_topic +'-poll #'+slug_poll).replaceWith(data); | ||
| 55 | + alertify.alert('Poll successfully updated!') | ||
| 58 | }).fail(function(data){ | 56 | }).fail(function(data){ |
| 59 | $("div.modal-backdrop.fade.in").remove(); | 57 | $("div.modal-backdrop.fade.in").remove(); |
| 60 | $("#requisicoes_ajax").empty(); | 58 | $("#requisicoes_ajax").empty(); |