Skip to content

Commit

Permalink
Uncomment events in order edit page and remove unused spree autocompl…
Browse files Browse the repository at this point in the history
…ete js code
  • Loading branch information
luisramos0 committed Feb 5, 2020
1 parent 42f94c2 commit d5373ee
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 44 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ $(document).ready(function() {
});

//handle edit click
// $('a.edit-item').click(toggleItemEdit);
$('a.edit-item').click(toggleItemEdit);

//handle cancel click
// $('a.cancel-item').click(toggleItemEdit);
$('a.cancel-item').click(toggleItemEdit);

handle_save_click = function(){
var save = $(this);
Expand All @@ -46,7 +46,7 @@ $(document).ready(function() {
adjustItems(shipment_number, variant_id, quantity);
return false;
}
// $('a.save-item').click(handle_save_click);
$('a.save-item').click(handle_save_click);

handle_delete_click = function(){
var del = $(this);
Expand All @@ -57,7 +57,7 @@ $(document).ready(function() {

adjustItems(shipment_number, variant_id, 0);
}
// $('a.delete-item').click(handle_delete_click);
$('a.delete-item').click(handle_delete_click);
}
});

Expand Down Expand Up @@ -139,39 +139,3 @@ addVariantFromStockLocation = function() {
}
return 1
}

formatVariantResult = function(variant) {
if (variant["images"][0] != undefined && variant["images"][0].urls != undefined) {
variant.image = variant.images[0].urls.mini
}
return variantTemplate({ variant: variant })
}

$.fn.variantAutocomplete = function() {
this.parent().children(".options_placeholder").attr('id', this.parent().data('index'))
this.select2({
placeholder: Spree.translations.variant_placeholder,
minimumInputLength: 3,
ajax: {
url: Spree.url(Spree.routes.variants_search),
datatype: 'json',
data: function(term, page) {
return {
q: {
"product_name_or_sku_cont": term
}
}
},
results: function (data, page) {
window.variants = data['variants'];

return { results: data['variants'] }
}
},
formatResult: formatVariantResult,
formatSelection: function (variant) {
$(this.element).parent().children('.options_placeholder').html(variant.options_text)
return variant.name;
}
})
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
angular.module("admin.utils").directive "variantAutocomplete", ($timeout) ->
restrict: 'C'
link: (scope, element, attrs) ->
# Make variantAutocomplete do nothing because it is called
# from core/app/assets/javascripts/admin/orders/edit.js
$.fn.variantAutocomplete = angular.noop

$timeout ->
if $("#variant_autocomplete_template").length > 0
variantTemplate = Handlebars.compile($("#variant_autocomplete_template").text())
Expand Down

0 comments on commit d5373ee

Please sign in to comment.