Skip to content

Commit

Permalink
deprecate unused link_to_remove_fields helper function and ".spree_re…
Browse files Browse the repository at this point in the history
…move_fields" click event
  • Loading branch information
hefan committed Apr 21, 2020
1 parent 5284611 commit ec84339
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 25 deletions.
25 changes: 0 additions & 25 deletions backend/app/assets/javascripts/spree/backend/admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,31 +99,6 @@ Spree.ready(function(){
return false;
});

$('body').on('click', 'a.spree_remove_fields', function() {
var el = $(this);
el.prev("input[type=hidden]").val("1");
el.closest(".fields").hide();
if (el.prop("href").substr(-1) == '#') {
el.parents("tr").fadeOut('hide');
}else if (el.prop("href")) {
Spree.ajax({
type: 'POST',
url: el.prop("href"),
data: {
_method: 'delete',
},
success: function(response) {
el.parents("tr").fadeOut('hide');
},
error: function(response, textStatus, errorThrown) {
show_flash('error', response.responseText);
}

})
}
return false;
});

window.Spree.advanceOrder = function() {
Spree.ajax({
type: "PUT",
Expand Down
2 changes: 2 additions & 0 deletions backend/app/helpers/spree/admin/base_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,8 @@ def link_to_remove_fields(name, form, options = {})
link_to_with_icon('trash', name, url, class: "spree_remove_fields #{options[:class]}", data: { action: 'remove' }, title: t('spree.actions.remove')) +
form.hidden_field(:_destroy)
end
deprecate link_to_remove_fields: "Please use link_to_delete instead, Example: \n" \
"link_to_delete \"form.object\", deprecator: Spree::Deprecation

def spree_dom_id(record)
dom_id(record, 'spree')
Expand Down

0 comments on commit ec84339

Please sign in to comment.