Skip to content

Commit

Permalink
use select.select2 as selector instead of only .select2
Browse files Browse the repository at this point in the history
  • Loading branch information
oeN committed Jun 6, 2017
1 parent 80ee498 commit 4271411
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
window.update_state = function (region, done) {
'use strict';

var country = $('span#' + region + 'country .select2').select2('val');
var country = $('span#' + region + 'country select.select2').select2('val');
var state_select = $('span#' + region + 'state select.select2');
var state_input = $('span#' + region + 'state input.state_name');

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ $ ->
url: @href
success: (r) ->
($ '#images').html r
($ '.select2').select2()
($ 'select.select2').select2()
2 changes: 1 addition & 1 deletion backend/app/views/spree/admin/products/new.js.erb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
$("#new_product_wrapper").html('<%= escape_javascript(render template: "spree/admin/products/new", formats: [:html], handlers: [:erb]) %>');
handle_date_picker_fields();
<% unless Rails.env.test? %>
$('.select2').select2();
$('select.select2').select2();
<% end %>
$("#table-filter").hide();
$("#admin_new_product").parent().hide();
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@ $('#actions').append('<%= escape_javascript( render(partial: 'spree/admin/promot
$('#actions .no-objects-found').hide();
$(".variant_autocomplete").variantAutocomplete();
//enable select2 functions for recently added box
$('.type-select.select2').last().select2();
$('select.type-select.select2').last().select2();

initPromotionActions();


$('#<%= dom_id @promotion_action %>').hide();
$('#<%= dom_id @promotion_action %>').fadeIn();
new Spree.CalculatorEditView({el: $('#<%= dom_id @promotion_action %> .js-calculator-fields')});

Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@
<% content_for :head do %>
<%= javascript_tag do -%>
$(document).ready(function(){
$('span#country .select2').on('change', function() { update_state(''); });
$('span#country select.select2').on('change', function() { update_state(''); });
});
<% end -%>
<% end %>
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,6 @@

<script>
$(function(){
$('.select2').select2();
$('select.select2').select2();
});
</script>
2 changes: 1 addition & 1 deletion backend/app/views/spree/admin/variants/new.js.erb
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
$(".js-content-below-tabs").html('<%= escape_javascript(render template: 'spree/admin/variants/new', formats: [:html], handlers: [:erb]) %>');
$(".js-content-below-tabs .select2").select2();
$(".js-content-below-tabs select.select2").select2();

0 comments on commit 4271411

Please sign in to comment.