fix error

This commit is contained in:
BOYA,CHIU 2021-08-04 12:43:04 +08:00
parent 2bc02db8bf
commit 9a1e7346ae
2 changed files with 16 additions and 5 deletions

View File

@ -10,9 +10,12 @@ class RulingBusInfo
field :route_names, type: Array, default: []
field :cache_data, type: Hash, default: {}
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
def locale
self.locale || I18n.locale.to_s.capitalize
end
def monitor_point_show(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 "")

View File

@ -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 ) {
var options = [];
$.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({
text: value,
id: value
text: v,
id: id
});
})
$("#ruling_bus_info_monitor_point,#ruling_bus_info_destination").empty().select2({