From 2d872c25bf16b8252ff43bc2710ca26e60d5bb8a Mon Sep 17 00:00:00 2001 From: Hugo Daniel Date: Thu, 25 Jul 2019 11:20:51 +0200 Subject: [PATCH] Use Haml javascript tag to make autocomplete work --- .../spree/admin/product_properties/index.html.haml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/app/views/spree/admin/product_properties/index.html.haml b/app/views/spree/admin/product_properties/index.html.haml index cf1faa590d..895beef33a 100644 --- a/app/views/spree/admin/product_properties/index.html.haml +++ b/app/views/spree/admin/product_properties/index.html.haml @@ -60,13 +60,13 @@ $("input#product_inherits_properties").change -> $("#inherited_properties").toggle $(this).is(':checked') -= javascript_tag do +:javascript var properties = #{raw(@properties.to_json)}; - + console.log(properties) $("#product_properties input.autocomplete").live("keydown", function(){ - already_auto_completed = $(this).is('ac_input'); - if (!already_auto_completed) { - $(this).autocomplete({source: properties}); - $(this).focus(); - } + already_auto_completed = $(this).is('ac_input'); + if (!already_auto_completed) { + $(this).autocomplete({source: properties}); + $(this).focus(); + } });