diff --git a/app/models/ruling_bus_info.rb b/app/models/ruling_bus_info.rb index ae9a440..c4021a9 100644 --- a/app/models/ruling_bus_info.rb +++ b/app/models/ruling_bus_info.rb @@ -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 "") diff --git a/app/views/admin/ruling_buses/_bus_form.html.erb b/app/views/admin/ruling_buses/_bus_form.html.erb index 132b7a8..a3b80b9 100644 --- a/app/views/admin/ruling_buses/_bus_form.html.erb +++ b/app/views/admin/ruling_buses/_bus_form.html.erb @@ -81,10 +81,18 @@ $.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) { - options.push({ - text: value, - id: 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: v, + id: id + }); }) $("#ruling_bus_info_monitor_point,#ruling_bus_info_destination").empty().select2({ data: options