From 30fc0d3f1a9a158a0d45bbaf2f78e176f74ac943 Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Tue, 19 Sep 2017 16:46:22 +0200 Subject: ModelAttribute: Add `ModelAttribute`s for a bunch of models&attributes We want to define `ModelAttribute`s for an initial set of `Chouette` models: * Chouette::Route * Chouette::JourneyPattern * Chouette::VehicleJourney * Chouette::Footnote * Chouette::TimeTable * Chouette::RoutingConstraintZone I added these by looking at the `schema.rb` as well as some form views for these models. Given that information, I made some guesses about what attributes it might make sense to add here. We want to end up with a collection of only editable attributes for these models, so this excludes things like `created_at`, foreign keys, and programmatically set fields. This is my guess at what those fields are. We can refine the list later. We'll be using this list for Compliance Control to get a set of fields of a given type in order to create custom validations using those fields. Refs #4401 --- lib/model_attribute.rb | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) (limited to 'lib/model_attribute.rb') diff --git a/lib/model_attribute.rb b/lib/model_attribute.rb index b1297d43d..081d0cd0f 100644 --- a/lib/model_attribute.rb +++ b/lib/model_attribute.rb @@ -15,5 +15,44 @@ class ModelAttribute @data_type = data_type end + # Chouette::Route + define :route, :name, :string + define :route, :published_name, :string + define :route, :comment, :string + define :route, :number, :string + define :route, :direction, :string + define :route, :wayback, :string + + # Chouette::JourneyPattern define :journey_pattern, :name, :string + define :journey_pattern, :published_name, :string + define :journey_pattern, :comment, :string + define :journey_pattern, :registration_number, :string + define :journey_pattern, :section_status, :integer + + # Chouette::VehicleJourney + define :vehicle_journey, :comment, :string + define :vehicle_journey, :status_value, :string + define :vehicle_journey, :transport_mode, :string + define :vehicle_journey, :facility, :string + define :vehicle_journey, :published_journey_name, :string + define :vehicle_journey, :published_journey_identifier, :string + define :vehicle_journey, :vehicle_type_identifier, :string + define :vehicle_journey, :number, :integer + define :vehicle_journey, :mobility_restricted_suitability, :boolean + define :vehicle_journey, :flexible_service, :boolean + + # Chouette::Footnote + define :footnote, :code, :string + define :footnote, :label, :string + + # Chouette::TimeTable + define :time_table, :version, :string + define :time_table, :comment, :string + define :time_table, :start_date, :date + define :time_table, :end_date, :date + define :time_table, :color, :string + + # Chouette::RoutingConstraintZone + define :routing_constraint_zone, :name, :string end -- cgit v1.2.3