aboutsummaryrefslogtreecommitdiffstats
path: root/app/models
diff options
context:
space:
mode:
authorZog2018-01-29 16:25:08 +0100
committerZog2018-02-01 14:40:24 +0100
commit82de76f0efce7558a3fe240edf4e2293a8788ee1 (patch)
tree3c9c70b904d989a4b8e0d8b2d0db03314465a410 /app/models
parentd896ba8753f9877dfd29a97cf1310d54d0b25874 (diff)
downloadchouette-core-82de76f0efce7558a3fe240edf4e2293a8788ee1.tar.bz2
Refs #5758 @1h; Add localized names to StopAreas
Diffstat (limited to 'app/models')
-rw-r--r--app/models/chouette/stop_area.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/app/models/chouette/stop_area.rb b/app/models/chouette/stop_area.rb
index c6feaf940..bb8747faa 100644
--- a/app/models/chouette/stop_area.rb
+++ b/app/models/chouette/stop_area.rb
@@ -12,6 +12,8 @@ module Chouette
enumerize :area_type, in: Chouette::AreaType::ALL
enumerize :kind, in: %i(commercial non_commercial)
+ AVAILABLE_LOCALIZATIONS = %i(gb nl de fr it es)
+
with_options dependent: :destroy do |assoc|
assoc.has_many :stop_points
assoc.has_many :access_points
@@ -50,6 +52,11 @@ module Chouette
:nearest_topic_name, :comment, :long_lat_type, :zip_code, :city_name, :url, :time_zone]
end
+ def localized_names
+ val = read_attribute(:localized_names) || {}
+ Hash[*AVAILABLE_LOCALIZATIONS.map{|k| [k, val[k.to_s]]}.flatten]
+ end
+
def parent_area_type_must_be_greater
return unless self.parent