Skip to content

Commit

Permalink
Merge pull request #1774 from jhawthorn/select2_vendor
Browse files Browse the repository at this point in the history
Replace select2-rails with vendored select2
  • Loading branch information
jhawthorn authored Mar 23, 2017
2 parents af3d8d9 + 9ac5279 commit 32e18af
Show file tree
Hide file tree
Showing 61 changed files with 5,466 additions and 61 deletions.
46 changes: 1 addition & 45 deletions backend/app/assets/config/solidus_backend_manifest.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,48 +3,4 @@
//= link spree/backend/all.js
//= link spree/backend/all.css

//= link select2_locale_ar.js
//= link select2_locale_az.js
//= link select2_locale_bg.js
//= link select2_locale_ca.js
//= link select2_locale_cs.js
//= link select2_locale_da.js
//= link select2_locale_de.js
//= link select2_locale_el.js
//= link select2_locale_es.js
//= link select2_locale_et.js
//= link select2_locale_eu.js
//= link select2_locale_fa.js
//= link select2_locale_fi.js
//= link select2_locale_fr.js
//= link select2_locale_gl.js
//= link select2_locale_he.js
//= link select2_locale_hr.js
//= link select2_locale_hu.js
//= link select2_locale_id.js
//= link select2_locale_is.js
//= link select2_locale_it.js
//= link select2_locale_ja.js
//= link select2_locale_ka.js
//= link select2_locale_ko.js
//= link select2_locale_lt.js
//= link select2_locale_lv.js
//= link select2_locale_mk.js
//= link select2_locale_ms.js
//= link select2_locale_nl.js
//= link select2_locale_no.js
//= link select2_locale_pl.js
//= link select2_locale_pt-BR.js
//= link select2_locale_pt-PT.js
//= link select2_locale_ro.js
//= link select2_locale_rs.js
//= link select2_locale_ru.js
//= link select2_locale_sk.js
//= link select2_locale_sv.js
//= link select2_locale_th.js
//= link select2_locale_tr.js
//= link select2_locale_ug-CN.js
//= link select2_locale_uk.js
//= link select2_locale_vi.js
//= link select2_locale_zh-CN.js
//= link select2_locale_zh-TW.js
//= link solidus_admin/select2_locales
2 changes: 1 addition & 1 deletion backend/app/assets/javascripts/spree/backend.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
//= require jquery-ui/sortable
//= require jquery-ui/autocomplete
//= require jquery.sticky-kit.min
//= require solidus_admin/select2
//= require solidus_admin/underscore
//= require solidus_admin/backbone
//= require solidus_admin/backbone-nested-models
Expand All @@ -16,7 +17,6 @@
//= require spree/backend/namespaces
//= require spree/backend/translation
//= require spree/backend/backbone-overrides
//= require spree/backend/spree-select2
//= require spree/backend/format_money
//
//= require spree/backend/templates
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//= require select2
//= require solidus_admin/select2
jQuery(function($) {
// Make select beautiful
$('select.select2').select2({
Expand Down
2 changes: 1 addition & 1 deletion backend/app/assets/stylesheets/spree/backend.css
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*= require jquery-ui/datepicker
*= require jquery-ui/autocomplete
*= require select2
*= require solidus_admin/select2
*= require prism
*= require spree/backend/spree_admin
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,5 @@
</script>

<% if I18n.locale != :en %>
<%= javascript_include_tag "select2_locale_#{I18n.locale}" %>
<%= javascript_include_tag "solidus_admin/select2_locales/select2_locale_#{I18n.locale}" %>
<% end %>
1 change: 0 additions & 1 deletion backend/lib/spree/backend.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
require 'coffee-rails'
require 'sass-rails'
require 'bourbon'
require 'select2-rails'
require 'handlebars_assets'
require 'font-awesome-rails'

Expand Down
1 change: 0 additions & 1 deletion backend/solidus_backend.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ Gem::Specification.new do |s|
s.add_dependency 'bourbon', '>= 4', '< 6'
s.add_dependency 'jquery-rails'
s.add_dependency 'jquery-ui-rails', '~> 5.0.0'
s.add_dependency 'select2-rails', '3.5.9.1' # 3.5.9.2 breaks forms
s.add_dependency 'font-awesome-rails', '~> 4.0'

s.add_dependency 'handlebars_assets', '~> 0.23'
Expand Down
6 changes: 3 additions & 3 deletions backend/spec/features/admin/configuration/store_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@
end

it "should be able to update the default cart tax country" do
expect(page).to have_select("Tax Country for Empty Carts", selected: "No taxes on carts without address")
expect(page).to have_select('Tax Country for Empty Carts', selected: 'No taxes on carts without address', visible: false)

select "Germany", from: "Tax Country for Empty Carts"
select "Germany", from: "Tax Country for Empty Carts", visible: false
click_button "Update"

expect(page).to have_content("has been successfully updated")
expect(page).to have_select("Tax Country for Empty Carts", selected: "Germany")
expect(page).to have_select("Tax Country for Empty Carts", selected: "Germany", visible: false)
end
end

Expand Down
14 changes: 9 additions & 5 deletions backend/spec/features/admin/orders/customer_details_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@
expect(page).to have_field("Street Address (cont'd)", with: user.bill_address.address2)
expect(page).to have_field('City', with: user.bill_address.city)
expect(page).to have_field('Zip Code', with: user.bill_address.zipcode)
expect(page).to have_field('Country', with: user.bill_address.country_id)
expect(page).to have_field('State', with: user.bill_address.state_id)
expect(page).to have_select('Country', selected: "United States of America", visible: false)
expect(page).to have_select('State', selected: user.bill_address.state.name, visible: false)
expect(page).to have_field('Phone', with: user.bill_address.phone)
click_button "Update"
expect(Spree::Order.last.user).not_to be_nil
Expand Down Expand Up @@ -137,7 +137,7 @@

it "sets default country when displaying form" do
click_link "Customer"
expect(page).to have_field("order_bill_address_attributes_country_id", with: brazil.id)
expect(page).to have_field("order_bill_address_attributes_country_id", with: brazil.id, visible: false)
end
end

Expand All @@ -158,13 +158,17 @@
fill_in "order_ship_address_attributes_city", with: "Bethesda"
fill_in "order_ship_address_attributes_zipcode", with: "20170"

page.select('Alabama', from: 'order_ship_address_attributes_state_id')
select_state('Alabama', 'ship')
fill_in "order_ship_address_attributes_phone", with: "123-456-7890"
click_button "Update"
end
end
end

def select_state(state_name, kind = "bill")
targetted_select2 state_name, from: "#s2id_order_#{kind}_address_attributes_state_id"
end

def fill_in_address(kind = "bill")
fill_in "First Name", with: "John 99"
fill_in "Last Name", with: "Doe"
Expand All @@ -173,7 +177,7 @@ def fill_in_address(kind = "bill")
fill_in "Street Address (cont'd)", with: "#101"
fill_in "City", with: "Bethesda"
fill_in "Zip Code", with: "20170"
targetted_select2 "Alabama", from: "#s2id_order_#{kind}_address_attributes_state_id"
select_state("Alabama", kind)
fill_in "Phone", with: "123-456-7890"
end
end
4 changes: 2 additions & 2 deletions backend/spec/features/admin/stock_transfer_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@
create(:stock_location, name: 'SF')

visit spree.new_admin_stock_transfer_path
select "SF", from: 'stock_transfer[source_location_id]'
select "SF", from: 'stock_transfer[source_location_id]', visible: false
fill_in 'stock_transfer_description', with: description
click_button 'Continue'

expect(page).to have_field('stock_transfer_description', with: description)

select "NY", from: 'stock_transfer[destination_location_id]'
select "NY", from: 'stock_transfer[destination_location_id]', visible: false
within "form.edit_stock_transfer" do
page.find('button').trigger('click')
end
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 32e18af

Please sign in to comment.