Commit 2b193a5807b715c57b444241cfd2b7cccd3cc65e

Authored by Gustavo
1 parent b7a230c9

Fix'd delete in the search news template

Showing 1 changed file with 17 additions and 1 deletions   Show diff stats
news/templates/news/search.html
... ... @@ -57,7 +57,7 @@
57 57 <div class="col-md-6">
58 58 <div align="right">
59 59 <a href="{% url 'news:update' new.slug %}" class="btn btn-success btn-raised btn-sm"><i class="fa fa-edit"></i> {% trans 'Edit' %}</a>
60   - <a href="" class="btn btn-default btn-raised btn-sm"><i class="fa fa-trash"></i> {% trans 'Delete' %}</a>
  60 + <a href="javascript:delete_news.get('{% url 'news:delete' new.slug %}','#news','#modal_remove')" class="btn btn-default btn-raised btn-sm"><i class="fa fa-trash"></i> {% trans 'Delete' %}</a>
61 61 </div>
62 62 </div>
63 63 </div>
... ... @@ -76,4 +76,20 @@
76 76  
77 77 </div>
78 78  
  79 +<script type="text/javascript">
  80 +var delete_news = {
  81 + get: function (url, id_modal, id_div_modal){
  82 + $.get(url, function(data){
  83 + if($(id_modal).length){
  84 + $(id_div_modal).empty();
  85 + $(id_div_modal).append(data);
  86 + } else {
  87 + $(id_div_modal).append(data);
  88 + }
  89 + $(id_modal).modal('show');
  90 + });
  91 + }
  92 +};
  93 +
  94 +</script>
79 95 {% endblock %}
... ...