-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2542 from jhawthorn/stock_locations_states
Use backbone StateSelect view for stock locations form
- Loading branch information
Showing
5 changed files
with
34 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 0 additions & 35 deletions
35
backend/app/assets/javascripts/spree/backend/address_states.js
This file was deleted.
Oops, something went wrong.
23 changes: 23 additions & 0 deletions
23
backend/app/assets/javascripts/spree/backend/stock_location.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
//= require 'spree/backend/views/state_select' | ||
|
||
Spree.ready(function() { | ||
"use strict"; | ||
|
||
_.each(document.querySelectorAll('.js-stock-locations-form'), function(el) { | ||
var countrySelect = el.querySelector('.js-country_id'); | ||
var model = new Backbone.Model({ | ||
country_id: countrySelect.value | ||
}); | ||
|
||
countrySelect.addEventListener('change', function() { | ||
model.set({ | ||
country_id: countrySelect.value | ||
}); | ||
}); | ||
|
||
new Spree.Views.StateSelect({ | ||
el: el, | ||
model: model | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters