Improve (AJAX) deletion of StockArticles

This commit is contained in:
Julius 2013-02-25 11:12:28 +01:00
parent 5dc3fc30ad
commit 0e1bd5c75e
4 changed files with 21 additions and 10 deletions

View file

@ -1 +1,14 @@
console.log('#{destroyed_article_id}');
-# please polish the following line if you know how, same in partial _destroy_fail
var successDiv = $('<div class="alert fade in alert-success"><a class="close" data-dismiss="alert" href="#">x</a></div>');
successDiv.append(document.createTextNode('Artikel #{j(@article.name)} gelöscht.'));
$('div.container-fluid').prepend(successDiv);
-# WARNING: If you try to use the escape j(...) here, an error occurs:
-# Ein Fehler ist aufgetreten: undefined method `gsub' for 50:Fixnum
-# However, it should work without without escaping.
-# Note that article names which are purely numeric, e.g. 12345, are escaped correctly (see above).
$('#stockArticle-#{@article.id}').remove();
-# WARNING: Do not use a simple .fadeOut() above, because it conflicts with the show/hide function of unavailable articles.