Apply publish/subscribe for OrderArticle#update
This commit is contained in:
parent
27a73be68f
commit
81dfe8110c
6 changed files with 46 additions and 4 deletions
|
|
@ -1,3 +1,18 @@
|
|||
- content_for :javascript do
|
||||
:javascript
|
||||
$(function() {
|
||||
// Subscribe to database changes.
|
||||
// See publish/subscribe design pattern in /doc.
|
||||
$(document).on('OrderArticle#update', function(e) {
|
||||
$.ajax({
|
||||
url: '#{new_on_order_article_update_finance_order_path(@order)}',
|
||||
type: 'get',
|
||||
data: {order_article_id: e.order_article_id},
|
||||
contentType: 'application/json; charset=UTF-8'
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
- title t('.title', name: @order.name)
|
||||
|
||||
- content_for :sidebar do
|
||||
|
|
|
|||
|
|
@ -0,0 +1,14 @@
|
|||
// Handle more advanced DOM update after AJAX database manipulation.
|
||||
// See publish/subscribe design pattern in /doc.
|
||||
(function(w) {
|
||||
$('#order_article_<%= @order_article.id %>').html(
|
||||
'<%= j render('finance/balancing/order_article', order_article: @order_article) %>'
|
||||
);
|
||||
|
||||
$('#group_order_articles_<%= @order_article.id %>').html(
|
||||
'<%= j render('finance/balancing/group_order_articles', order_article: @order_article) %>'
|
||||
);
|
||||
|
||||
$('#summaryChangedWarning').show();
|
||||
})(window);
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue