Commit 9b2d9e49726d2c7e9177e18b58b5548239144639

Authored by Gustavo
1 parent b88b6259

Modified manage news template to include delete news properly

Showing 1 changed file with 17 additions and 1 deletions   Show diff stats
news/templates/news/list.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" 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>
... ... @@ -75,5 +75,21 @@
75 75 <div id="modal_remove">
76 76  
77 77 </div>
  78 +<script type="text/javascript">
  79 +var delete_news = {
  80 + get: function (url, id_modal, id_div_modal){
  81 + $.get(url, function(data){
  82 + if($(id_modal).length){
  83 + $(id_div_modal).empty();
  84 + $(id_div_modal).append(data);
  85 + } else {
  86 + $(id_div_modal).append(data);
  87 + }
  88 + $(id_modal).modal('show');
  89 + });
  90 + }
  91 +};
  92 +
  93 +</script>
78 94  
79 95 {% endblock %}
... ...