VRFS-1458 fixed location selection
This commit is contained in:
parent
6c05fb5ad1
commit
c95bebef48
|
|
@ -45,7 +45,9 @@
|
|||
$.ajax('/api/regions', {
|
||||
data : { country: selected_country },
|
||||
dataType : 'json'
|
||||
}).done(regions_done).fail(regions_fail).always(function() { region_select.attr('disabled', false).easyDropDown('enable') })
|
||||
}).done(regions_done)
|
||||
.fail(function(err) { regions_done([]) })
|
||||
.always(function() { region_select.attr('disabled', false).easyDropDown('enable') })
|
||||
}
|
||||
})
|
||||
|
||||
|
|
@ -56,16 +58,13 @@
|
|||
|
||||
$(data.regions).each(function(index, item) {
|
||||
var option = $('<option></option>');
|
||||
option.text(item);
|
||||
option.val(item);
|
||||
option.text(item['name']);
|
||||
option.val(item['region']);
|
||||
region_select.append(option)
|
||||
})
|
||||
|
||||
context.JK.dropdown(region_select);
|
||||
}
|
||||
|
||||
function regions_fail() {
|
||||
alert("something went wrong in looking up regions")
|
||||
cities_done([]);
|
||||
}
|
||||
|
||||
region_select.change(function() {
|
||||
|
|
@ -80,7 +79,12 @@
|
|||
$.ajax('/api/cities', {
|
||||
data : { country: selected_country, region: selected_region },
|
||||
dataType : 'json'
|
||||
}).done(cities_done).fail(cities_fail).always(function() { city_select.attr('disabled', false).easyDropDown('enable') })
|
||||
})
|
||||
.done(cities_done)
|
||||
.error(function(err) {
|
||||
cities_done([]);
|
||||
})
|
||||
.always(function() { city_select.attr('disabled', false).easyDropDown('enable') })
|
||||
}
|
||||
})
|
||||
|
||||
|
|
@ -97,10 +101,6 @@
|
|||
|
||||
context.JK.dropdown(city_select);
|
||||
}
|
||||
|
||||
function cities_fail() {
|
||||
alert("something went wrong in looking up cities")
|
||||
}
|
||||
}
|
||||
|
||||
signup.handle_completion_submit = function handle_completion_submit() {
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@
|
|||
<option value="" <%= @location[:state].blank? ? "selected" : "" %>>State/Province</option>
|
||||
<% @regions.each do |region| %>
|
||||
<% unless region.blank? %>
|
||||
<option value="<%= region %>" <%= @location[:state] == region ? "selected" : "" %>><%= region %></option>
|
||||
<option value="<%= region[:region] %>" <%= @location[:state] == region ? "selected" : "" %>><%= region[:name] %></option>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue