Commit 4b0457abe311857bfe174a21add810b3da3251ec
1 parent
2ac68f8b
Exists in
master
and in
5 other branches
Finished delete link [Issue:#121]
Showing
1 changed file
with
65 additions
and
19 deletions
Show diff stats
links/templates/links/delete_link.html
1 | -{% load widget_tweaks i18n %} | ||
2 | -<!-- MODAL REMOVE LINK --> | ||
3 | -<div class="modal" id="removeLink"> | ||
4 | - <div class="modal-dialog"> | ||
5 | - <div class="modal-content"> | ||
6 | - <div class="modal-header"> | ||
7 | - <button type="button" class="close" data-dismiss="modal" aria-hidden="true">X</button> | ||
8 | - <h4 class="modal-title"></h4> | ||
9 | - </div> | ||
10 | - <div class="modal-body"> | ||
11 | - <p>{% trans 'Do you really want to delete this link?' %}</p> | ||
12 | - </div> | ||
13 | - <div class="modal-footer"> | ||
14 | - <!-- --> | ||
15 | - <button type="button" class="btn btn-primary btn-default" data-dismiss="modal">{% trans 'Cancel' %}</button> | ||
16 | - <a href="http://www.google.com" target="_self"><button type="button" class="btn btn-primary" data-dismiss="modal" aria-hidden="true">{% trans 'Confirm' %}</button></a> | 1 | +{% load static widget_tweaks i18n %} |
17 | 2 | ||
18 | - </div> | 3 | +<!-- MODAL DELETE LINK --> |
4 | +<link rel="stylesheet" type="text/css" href="{% static 'css/link.css' %}"> | ||
5 | + | ||
6 | +<div class="erro-update"> | ||
7 | + <div class="modal fade" id="linkDeleteModal" tabindex="-1" role="dialog" aria-labelledby="deleteLinkLabel" style="z-index: 10"> | ||
8 | + <div class="modal-dialog" role="document"> | ||
9 | + <div class="modal-content"> | ||
10 | + <div class="modal-header"> | ||
11 | + <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> | ||
12 | + <h4 class="modal-title" id="deleteLinkLabel">{% trans 'Delete Link' %}</h4> | ||
13 | + </div> | ||
14 | + <div class="modal-body"> | ||
15 | + <!-- Card --> | ||
16 | + <form class="form-horizontal" method="post" id="form-delete-link" enctype="multipart/form-data"> | ||
17 | + {% csrf_token %} | ||
18 | + <fieldset> | ||
19 | + <div class="col-md-12"> | ||
20 | + {% trans "Are you sure to delete the link " %} <strong>"{{ link.name }}"</strong> </a> of {{ link.topic.name }}? | ||
21 | + </div> | ||
22 | + <div class="form-group"> | ||
23 | + <div class="col-md-12"> | ||
24 | + <button type="button" class="btn btn-danger btn-raised" data-dismiss="modal">{% trans "Close" %}</button> | ||
25 | + <button class="btn btn-raised btn-primary" type="submit">{% trans 'Delete' %}</button> | ||
26 | + </div> | ||
27 | + </div> | ||
28 | + </fieldset> | ||
29 | + </form> | ||
30 | + <!-- .end Card --> | ||
31 | + </div> | ||
32 | + </div> | ||
33 | + </div> | ||
19 | </div> | 34 | </div> |
20 | - </div> | ||
21 | </div> | 35 | </div> |
22 | -<!-- END --> | 36 | + |
37 | +{% block script_link %} | ||
38 | + | ||
39 | + {# // <script src="{% static 'js/link.js' %}"></script> #} | ||
40 | + <script type="text/javascript"> | ||
41 | + $("#form-delete-link").submit(function(event) { | ||
42 | + var data = new FormData($('#form-delete-link').get(0)); | ||
43 | + $.ajax({ | ||
44 | + url: "{% url 'course:links:delete_link' link.slug %}", | ||
45 | + type: $("#form-delete-link").attr('method'), | ||
46 | + data: data, | ||
47 | + cache: false, | ||
48 | + processData: false, | ||
49 | + contentType: false, | ||
50 | + success: function(data) { | ||
51 | + $('#linkDeleteModal').modal('hide'); | ||
52 | + $('#link_{{ link.slug }}').remove(); | ||
53 | + $('#link_edit_icon_{{ link.slug }}').remove(); | ||
54 | + $('#link_edit_{{ link.slug }}').remove(); | ||
55 | + alertify.alert('Link successfully deleted!') | ||
56 | + }, | ||
57 | + error: function(data){ | ||
58 | + // $('.erro-update').html(data.responseText); | ||
59 | + $('.modal-backdrop').remove(); | ||
60 | + $('#linkDeteleModal').modal(); | ||
61 | + alertify.alert('Error when trying to delete.'); | ||
62 | + } | ||
63 | + }); | ||
64 | + event.preventDefault(); | ||
65 | + }); | ||
66 | + </script> | ||
67 | +{% endblock script_link %} | ||
68 | +<!-- EndModal --> |