Commit 9b2d9e49726d2c7e9177e18b58b5548239144639
1 parent
b88b6259
Exists in
master
and in
2 other branches
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,7 +57,7 @@ | ||
57 | <div class="col-md-6"> | 57 | <div class="col-md-6"> |
58 | <div align="right"> | 58 | <div align="right"> |
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> | 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 | </div> | 61 | </div> |
62 | </div> | 62 | </div> |
63 | </div> | 63 | </div> |
@@ -75,5 +75,21 @@ | @@ -75,5 +75,21 @@ | ||
75 | <div id="modal_remove"> | 75 | <div id="modal_remove"> |
76 | 76 | ||
77 | </div> | 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 | {% endblock %} | 95 | {% endblock %} |