[Git][noosfero/noosfero][master-1.x] 2 commits: Uses a custom class on address fields
Rodrigo Souto
gitlab at mg.gitlab.com
Mon Jun 11 10:55:33 BRT 2018
Rodrigo Souto pushed to branch master-1.x at Noosfero / noosfero
Commits:
629e482b by Gabriel Silva at 2018-06-08T15:30:42Z
Uses a custom class on address fields
Signed-off-by: Gabriel Silva <gabriel93.silva at gmail.com>
- - - - -
87097303 by Rodrigo Souto at 2018-06-11T13:55:27Z
Merge branch 'address-fields' into 'master-1.x'
Uses a custom class on address field
See merge request noosfero/noosfero!1521
- - - - -
2 changed files:
- app/views/shared/_address_fields.html.erb
- public/javascripts/address_fields.js
Changes:
=====================================
app/views/shared/_address_fields.html.erb
=====================================
--- a/app/views/shared/_address_fields.html.erb
+++ b/app/views/shared/_address_fields.html.erb
@@ -1,9 +1,9 @@
<%= javascript_include_tag 'address_fields' %>
<div class='address-fields formfield'>
- <%= optional_field(profile, 'country', select_profile_country(f.object_name, profile)) %>
- <%= optional_field(profile, 'state', select_profile_state(f.object_name, profile)) %>
- <%= optional_field(profile, 'city', select_profile_city(f.object_name, profile)) %>
+ <%= optional_field(profile, 'country', select_profile_country(f.object_name, profile, class: 'profile-country')) %>
+ <%= optional_field(profile, 'state', select_profile_state(f.object_name, profile, class: 'profile-state')) %>
+ <%= optional_field(profile, 'city', select_profile_city(f.object_name, profile, class: 'profile-city')) %>
<%= optional_field(profile, 'district', text_field(f.object_name, :district, placeholder: _('District'))) %>
<%= optional_field(profile, 'zip_code', text_field(f.object_name, :zip_code, placeholder: _('Zip code'))) %>
=====================================
public/javascripts/address_fields.js
=====================================
--- a/public/javascripts/address_fields.js
+++ b/public/javascripts/address_fields.js
@@ -2,14 +2,14 @@
function fetchStates(countryCode) {
$.get('/national_regions/states?country_code=' + countryCode, function(data) {
- replaceOptions('#profile_data_city', [])
- replaceOptions('#profile_data_state', data.states)
+ replaceOptions('select.profile-city', [])
+ replaceOptions('select.profile-state', data.states)
})
}
function fetchCities(stateCode) {
$.get('/national_regions/cities?state_code=' + stateCode, function(data) {
- replaceOptions('#profile_data_city', data.cities)
+ replaceOptions('select.profile-city', data.cities)
})
}
@@ -22,11 +22,11 @@ function replaceOptions(element, list) {
}
$(document).ready(function() {
- $('#profile_data_country').on('change', function() {
+ $('select.profile-country').on('change', function() {
fetchStates($(this).val())
})
- $('#profile_data_state').on('change', function() {
+ $('select.profile-state').on('change', function() {
fetchCities($(this).val())
})
})
View it on GitLab: https://gitlab.com/noosfero/noosfero/compare/dd1a50b1c70729235a24615c77c2cb9260f3cff7...870973033fe5375fa2bb438e7d00093c567222be
--
View it on GitLab: https://gitlab.com/noosfero/noosfero/compare/dd1a50b1c70729235a24615c77c2cb9260f3cff7...870973033fe5375fa2bb438e7d00093c567222be
You're receiving this email because of your account on gitlab.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listas.softwarelivre.org/pipermail/noosfero-dev/attachments/20180611/e953aec7/attachment-0001.html>
More information about the Noosfero-dev
mailing list