Apply AJAX for deleting a StockArticle
This commit is contained in:
parent
a511da9ae3
commit
ccf0d010b4
4 changed files with 13 additions and 5 deletions
7
app/views/stockit/_destroy_fail.js.haml
Normal file
7
app/views/stockit/_destroy_fail.js.haml
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
-# please polish the following line if you know how
|
||||
var errorDiv = $('<div class="alert fade in alert-error"><a class="close" data-dismiss="alert" href="#">×</a></div>');
|
||||
|
||||
-# next line, createTextNode called by .text(textString) helps escaping for html, but what about ' signs?
|
||||
errorDiv.text('#{fail_msg}');
|
||||
|
||||
$('div.container-fluid').prepend(errorDiv);
|
||||
1
app/views/stockit/destroy.js.haml
Normal file
1
app/views/stockit/destroy.js.haml
Normal file
|
|
@ -0,0 +1 @@
|
|||
console.log('#{destroyed_article_id}');
|
||||
|
|
@ -64,8 +64,7 @@
|
|||
%td= article.article_category.name
|
||||
%td
|
||||
= link_to "Bearbeiten", edit_stock_article_path(article), class: 'btn btn-mini'
|
||||
= link_to "Löschen", article, :method => :delete, :confirm => "Bist Du sicher?",
|
||||
class: 'btn btn-mini btn-danger'
|
||||
= link_to "Löschen", article, :method => :delete, :confirm => "Bist Du sicher?", class: 'btn btn-mini btn-danger', :remote => true
|
||||
.form-actions.unavailable
|
||||
= submit_tag "Artikel zum Löschen vormerken", { :class => 'unavailable btn' }
|
||||
%p
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue