mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
Add delete note feature
This commit is contained in:
@@ -79,6 +79,23 @@ $(document).ready(function() {
|
||||
});
|
||||
}
|
||||
|
||||
handle_note_delete = function(){
|
||||
var link = $(this);
|
||||
var note = ''
|
||||
var url = Spree.url( Spree.routes.orders_api + "/" + order_number);
|
||||
|
||||
$.ajax({
|
||||
type: "PUT",
|
||||
url: url,
|
||||
data: { note: note }
|
||||
}).done(function( msg ) {
|
||||
window.location.reload();
|
||||
}).error(function( msg ) {
|
||||
console.log(msg);
|
||||
});
|
||||
}
|
||||
|
||||
$('[data-hook=admin_order_edit_form] a.save-tracking').click(handle_tracking_save);
|
||||
$('[data-hook=admin_order_edit_form] a.save-note').click(handle_note_save);
|
||||
$('[data-hook=admin_order_edit_form] a.delete-note').click(handle_note_delete);
|
||||
});
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
%td{ colspan: "5", data: { controller: "input-char-count" }, style: "position: relative;" }
|
||||
%label
|
||||
= t(".note_label")
|
||||
= text_field_tag :note, @order.note, { maxLength: 280, data: { "input-char-count-target": "input" } }
|
||||
= text_field_tag :note, @order.note, { maxLength: 280, data: { "input-char-count-target": "input" } }
|
||||
%span.edit-note-count{ data: { "input-char-count-target": "count" }, style: "position: absolute; right: 7px; top: 7px; font-size: 11px;" }
|
||||
|
||||
%td.actions
|
||||
@@ -21,3 +21,4 @@
|
||||
|
||||
%td.actions
|
||||
= link_to '', '', class: 'edit-note icon_link icon-edit no-text with-tip', data: { action: 'edit' }, title: Spree.t('edit')
|
||||
= link_to '', '', class: 'delete-note icon_link icon-trash no-text with-tip', data: { action: 'delete' }, title: Spree.t('delete')
|
||||
|
||||
Reference in New Issue
Block a user