Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use datalist instead of jquery-ui/autocomplete #2509

Merged
merged 2 commits into from
Jan 23, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion backend/app/assets/javascripts/spree/backend.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
//= require jquery_ujs
//= require jquery-ui/datepicker
//= require jquery-ui/sortable
//= require jquery-ui/autocomplete
//= require jquery.sticky-kit.min
//= require solidus_admin/select2
//= require solidus_admin/underscore
Expand Down
1 change: 0 additions & 1 deletion backend/app/assets/stylesheets/spree/backend.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
* the top of the compiled file, but it's generally better to create a new file per style scope.

*= require jquery-ui/datepicker
*= require jquery-ui/autocomplete
*= require solidus_admin/select2
*= require solidus_admin/flatpickr/flatpickr
*= require prism
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<% end %>
</td>
<td class='property_name'>
<%= f.text_field :property_name, class: 'autocomplete' %>
<%= f.text_field :property_name, list: 'properties' %>
</td>
<td class='value'>
<%= f.text_field :value %>
Expand Down
13 changes: 3 additions & 10 deletions backend/app/views/spree/admin/product_properties/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -91,13 +91,6 @@
<% end %>
<% end %>

<%= javascript_tag do -%>
var properties = <%= raw(@properties.to_json) %>;
$('#product_properties, #variant_property_values').on('keydown', 'input.autocomplete', function() {
already_auto_completed = $(this).is('ac_input');
if (!already_auto_completed) {
$(this).autocomplete({source: properties});
$(this).focus();
}
});
<% end -%>
<datalist id="properties">
<%= safe_join @properties.map { |name| tag(:option, value: name) } %>
</datalist>