fix error
This commit is contained in:
parent
2bc02db8bf
commit
9a1e7346ae
|
@ -10,9 +10,12 @@ class RulingBusInfo
|
||||||
field :route_names, type: Array, default: []
|
field :route_names, type: Array, default: []
|
||||||
field :cache_data, type: Hash, default: {}
|
field :cache_data, type: Hash, default: {}
|
||||||
field :direction, type: Integer, default: 0
|
field :direction, type: Integer, default: 0
|
||||||
field :locale, type: String, default: I18n.locale.to_s.capitalize
|
field :locale, type: String
|
||||||
field :hint, type: String, default: "", localize: true
|
field :hint, type: String, default: "", localize: true
|
||||||
|
|
||||||
|
def locale
|
||||||
|
self.locale || I18n.locale.to_s.capitalize
|
||||||
|
end
|
||||||
def monitor_point_show(locale=nil)
|
def monitor_point_show(locale=nil)
|
||||||
locale = self.class.get_locale if locale.nil?
|
locale = self.class.get_locale if locale.nil?
|
||||||
(self.cache_data[:bus].blank? ? self.cache_data[:pbus][0][0][0][locale] : self.cache_data[:bus][0][0][0][locale] rescue "")
|
(self.cache_data[:bus].blank? ? self.cache_data[:pbus][0][0][0][locale] : self.cache_data[:bus][0][0][0][locale] rescue "")
|
||||||
|
|
|
@ -81,9 +81,17 @@
|
||||||
$.post( "/admin/ruling_buses/get_stops_and_code_for_city?locale=<%= I18n.locale %>", {city: $(self).val(), default_locale: default_locale}, function( data ) {
|
$.post( "/admin/ruling_buses/get_stops_and_code_for_city?locale=<%= I18n.locale %>", {city: $(self).val(), default_locale: default_locale}, function( data ) {
|
||||||
var options = [];
|
var options = [];
|
||||||
$.each(data['stops'], function (key,value) {
|
$.each(data['stops'], function (key,value) {
|
||||||
|
if (typeof(value).toLowerCase()!='string'){
|
||||||
|
var id = value[0];
|
||||||
|
var v = value[1];
|
||||||
|
}else{
|
||||||
|
var id = value;
|
||||||
|
var v = value;
|
||||||
|
}
|
||||||
|
var id =
|
||||||
options.push({
|
options.push({
|
||||||
text: value,
|
text: v,
|
||||||
id: value
|
id: id
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
$("#ruling_bus_info_monitor_point,#ruling_bus_info_destination").empty().select2({
|
$("#ruling_bus_info_monitor_point,#ruling_bus_info_destination").empty().select2({
|
||||||
|
|
Loading…
Reference in New Issue