Commit 1285c4d97fe2470e8c519680309d6d8b83f05c3d

Authored by ailsoncgt
1 parent 5edbdc91

Template remove file #134

Showing 1 changed file with 76 additions and 0 deletions   Show diff stats
files/templates/files/delete_file.html 0 → 100644
... ... @@ -0,0 +1,76 @@
  1 +{% load static widget_tweaks i18n %}
  2 +
  3 +<!-- MODAL CREATE FILE -->
  4 +<link rel="stylesheet" type="text/css" href="{% static 'css/file.css' %}">
  5 +
  6 +<div class="erro-update">
  7 + <div class="modal fade" id="fileDeleteModal" tabindex="-1" role="dialog" aria-labelledby="deleteFileLabel" 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="deleteFileLabel">{% trans 'Delete File' %}</h4>
  13 + </div>
  14 + <div class="modal-body">
  15 + <!-- Card -->
  16 + <form class="form-horizontal" method="post" id="form-delete-file" enctype="multipart/form-data">
  17 + {% csrf_token %}
  18 + {% if messages %}
  19 + {% for message in messages %}
  20 + <div class="alert alert-{{ message.tags }} alert-dismissible" role="alert">
  21 + <button type="button" class="close" data-dismiss="alert" aria-label="Close">
  22 + <span aria-hidden="true">&times;</span>
  23 + </button>
  24 + <p>{{ message }}</p>
  25 + </div>
  26 + {% endfor %}
  27 + {% endif %}
  28 + <fieldset>
  29 + <div class="col-md-12">
  30 + {% trans "Are you sure to delete " %}<a href="{{ file.file_url.url }}" target="_blank" > {{ file.name }} </a> of {{ file.topic.name }}?
  31 + </div>
  32 + <div class="form-group">
  33 + <div class="col-md-12">
  34 + <button type="button" class="btn btn-danger btn-raised" data-dismiss="modal">{% trans "Close" %}</button>
  35 + <button class="btn btn-raised btn-primary" type="submit">Delete</button>
  36 + </div>
  37 + </div>
  38 + </fieldset>
  39 + </form>
  40 + <!-- .end Card -->
  41 + </div>
  42 + </div>
  43 + </div>
  44 + </div>
  45 +</div>
  46 +
  47 +{% block script_file %}
  48 +
  49 + {# // <script src="{% static 'js/file.js' %}"></script> #}
  50 + <script type="text/javascript">
  51 + $("#form-delete-file").submit(function(event) {
  52 + var data = new FormData($('#form-delete-file').get(0));
  53 + $.ajax({
  54 + url: "{% url 'course:file:delete_file' file.slug %}",
  55 + type: $("#form-delete-file").attr('method'),
  56 + data: data,
  57 + cache: false,
  58 + processData: false,
  59 + contentType: false,
  60 + success: function(data) {
  61 + $('#fileDeleteModal').modal('hide');
  62 + $('#file_eidt_{{ file.slug }}').remove();
  63 + $('#file_eidt_icon_{{ file.slug }}').remove();
  64 + },
  65 + error: function(data){
  66 + // $('.erro-update').html(data.responseText);
  67 + $('.modal-backdrop').remove();
  68 + $('#fileDeteleModal').modal();
  69 + alert('Erro');
  70 + }
  71 + });
  72 + event.preventDefault();
  73 + });
  74 + </script>
  75 +{% endblock script_file %}
  76 +<!-- EndModal -->
0 77 \ No newline at end of file
... ...