diff options
| author | Michel Etienne | 2014-11-12 16:55:40 +0100 |
|---|---|---|
| committer | Michel Etienne | 2014-11-12 16:55:40 +0100 |
| commit | 28350f95744a03290a28dd8d941d1e6248f2eeb2 (patch) | |
| tree | 6ce8b6b89525b0428d29fc93d27949e60e2c2efb | |
| parent | 0906ff71269c2bcec1a6445a6fb53900be66be9b (diff) | |
| download | chouette-core-28350f95744a03290a28dd8d941d1e6248f2eeb2.tar.bz2 | |
new fields for GTFS exchange
| -rw-r--r-- | app/assets/stylesheets/main/lines.css.scss | 16 | ||||
| -rw-r--r-- | app/helpers/lines_helper.rb | 17 | ||||
| -rw-r--r-- | app/views/companies/_form.erb | 2 | ||||
| -rw-r--r-- | app/views/companies/show.html.erb | 8 | ||||
| -rw-r--r-- | app/views/lines/_form.erb | 3 | ||||
| -rw-r--r-- | app/views/lines/_line.erb | 9 | ||||
| -rw-r--r-- | app/views/lines/show.html.erb | 23 | ||||
| -rw-r--r-- | app/views/stop_areas/_form.html.erb | 2 | ||||
| -rw-r--r-- | app/views/stop_areas/show.html.erb | 8 | ||||
| -rw-r--r-- | config/environment.rb | 2 | ||||
| -rw-r--r-- | config/locales/companies.yml | 4 | ||||
| -rw-r--r-- | config/locales/lines.yml | 8 | ||||
| -rw-r--r-- | config/locales/stop_areas.yml | 4 | ||||
| -rw-r--r-- | db/migrate/20141105123536_add_gtfs_fields_to_companies.ninoxe_engine.rb | 9 | ||||
| -rw-r--r-- | db/migrate/20141105123537_add_gtfs_fields_to_stop_areas.ninoxe_engine.rb | 9 | ||||
| -rw-r--r-- | db/migrate/20141105123538_add_gtfs_fields_to_lines.ninoxe_engine.rb | 10 | ||||
| -rw-r--r-- | db/schema.rb | 9 |
17 files changed, 130 insertions, 13 deletions
diff --git a/app/assets/stylesheets/main/lines.css.scss b/app/assets/stylesheets/main/lines.css.scss index 3ce3c50e0..6e2f14dc5 100644 --- a/app/assets/stylesheets/main/lines.css.scss +++ b/app/assets/stylesheets/main/lines.css.scss @@ -23,20 +23,24 @@ #workspace.lines.edit, #workspace.lines.new, #workspace.lines.create, #workspace.lines.update { - #line_color{ width: 100px; + #line_color_old{ width: 100px; color: white; font-weight: bold;} } #workspace.lines.show { - .line_color{ color: white; - font-weight: bold; - padding: 0 5px 0 5px;} - - .summary p label { + .summary p + { + label { font-weight: bold; + } + .color + { + padding: 3px 15px 3px 15px; + } } + .group_of_line { .position { diff --git a/app/helpers/lines_helper.rb b/app/helpers/lines_helper.rb index a03868a0a..623d091ca 100644 --- a/app/helpers/lines_helper.rb +++ b/app/helpers/lines_helper.rb @@ -1,2 +1,19 @@ module LinesHelper + + def line_sticker( line) + return line.name if line.number.blank? + line.number + end + + def colors?(line) + line.text_color.present? || line.color.present? + end + + def text_color(line) + line.text_color.blank? ? "black" : "##{line.text_color}" + end + + def background_color(line) + line.color.blank? ? "white" : "#"+line.color + end end diff --git a/app/views/companies/_form.erb b/app/views/companies/_form.erb index 6f89edbbc..f23edbef9 100644 --- a/app/views/companies/_form.erb +++ b/app/views/companies/_form.erb @@ -8,6 +8,8 @@ <%= form.input :phone, :as => :phone %> <%= form.input :fax, :as => :phone %> <%= form.input :email, :as => :email %> + <%= form.input :time_zone, :include_blank => true %> + <%= form.input :url %> <%= form.input :registration_number, :input_html => { :title => t("formtastic.titles.company.registration_number")} %> <%= form.input :objectid, :required => !@company.new_record?, :input_html => { :title => t("formtastic.titles.company.objectid")} %> <% end %> diff --git a/app/views/companies/show.html.erb b/app/views/companies/show.html.erb index 0c8585a6c..513b0364e 100644 --- a/app/views/companies/show.html.erb +++ b/app/views/companies/show.html.erb @@ -32,6 +32,14 @@ <%= @company.email %> </p> <p> + <label><%= Chouette::Company.human_attribute_name("time_zone") %>: </label> + <%= @company.time_zone %> + </p> + <p> + <label><%= Chouette::Company.human_attribute_name("url") %>: </label> + <%= @company.url %> + </p> + <p> <label><%= Chouette::Company.human_attribute_name("registration_number") %>: </label> <%= @company.registration_number %> </p> diff --git a/app/views/lines/_form.erb b/app/views/lines/_form.erb index c1f59ed01..0e393ac53 100644 --- a/app/views/lines/_form.erb +++ b/app/views/lines/_form.erb @@ -8,6 +8,9 @@ <%= form.input :registration_number, :input_html => { :title => t("formtastic.titles.line.registration_number")} %> <%= form.input :number %> <%= form.input :transport_mode, :as => :select, :collection => Chouette::Line.transport_modes, :include_blank => false, :member_label => Proc.new { |mode| t("transport_modes.label.#{mode}") } %> + <%= form.input :color, :as => :string %> + <%= form.input :text_color %> + <%= form.input :url %> <%= form.input :mobility_restricted_suitability, :as => :select, :collection => [[@line.human_attribute_name("accessible"), true], [@line.human_attribute_name("not_accessible"), false]], :include_blank => true %> <%= form.input :flexible_service, :as => :select, :collection => [[@line.human_attribute_name("on_demaond_fs"), true], [@line.human_attribute_name("regular_fs"), false]], :include_blank => true %> <%= form.input :comment %> diff --git a/app/views/lines/_line.erb b/app/views/lines/_line.erb index f5606d907..24450fa20 100644 --- a/app/views/lines/_line.erb +++ b/app/views/lines/_line.erb @@ -12,7 +12,14 @@ <h5> <%= check_box_tag "ids[]", line.id, false, :class => "multiple_selection", :style => "display: none;" %> <% if line.number and line.number.length <= 3 %> - <span class="label label-default line_number"><%= line.number %></span> + <% if !line.text_color.blank? || !line.color.blank? %> + <% text_color = line.text_color.blank? ? "black" : "##{line.text_color}" %> + <% bg_color = line.color.blank? ? "white" : "##{line.color}" %> + <% number_style = "color: #{text_color}; background-color: #{bg_color};" %> + <% else %> + <% number_style = "" %> + <% end %> + <span class="label label-default line_number" style="<%= number_style %>"><%= line.number %></span> <% end %> <%= link_to([@referential, line], :class => "preview", :title => "#{Chouette::Line.model_name.human.capitalize} #{line.name}") do %> <span class="name"> diff --git a/app/views/lines/show.html.erb b/app/views/lines/show.html.erb index 24eebd794..12af00ff7 100644 --- a/app/views/lines/show.html.erb +++ b/app/views/lines/show.html.erb @@ -1,9 +1,20 @@ +<% text_color = @line.text_color.blank? ? "black" : "##{@line.text_color}" %> +<% bg_color = @line.color.blank? ? "white" : "#"+@line.color %> + <%= title_tag t('lines.show.title', :line => @line.name ) %> <div class="line_show"> <%= @map.to_html %> <div class="summary"> +<% text_color = @line.text_color.blank? ? "black" : "##{@line.text_color}" %> +<% bg_color = @line.color.blank? ? "white" : "#"+@line.color %> + <% if colors?(@line) %> + <p> + <label><%= t('lines.index.color') %>: </label> + <label class="color" style='<%="color: #{text_color(@line)}; background-color: #{background_color(@line)};"%>'><%= line_sticker(@line) %></label> + </p> + <% end %> <p> <label><%= @line.human_attribute_name(:network) %>: </label> <% if @line.network.nil? %> @@ -21,6 +32,10 @@ <% end %> </p> <p> + <label><%= @line.human_attribute_name("number") %>: </label> + <%= @line.number %> + </p> + <p> <label><%= @line.human_attribute_name("published_name") %>: </label> <%= @line.published_name %> </p> @@ -29,13 +44,13 @@ <%= @line.registration_number %> </p> <p> - <label><%= @line.human_attribute_name("number") %>: </label> - <%= @line.number %> - </p> - <p> <label><%= @line.human_attribute_name("transport_mode") %>: </label> <%= t("transport_modes.label.#{@line.transport_mode}") %> </p> + <p> + <label><%= @line.human_attribute_name("url") %>: </label> + <%= @line.url %> + </p> <p> <label><%= @line.human_attribute_name("mobility_restricted_suitability") %> : </label> diff --git a/app/views/stop_areas/_form.html.erb b/app/views/stop_areas/_form.html.erb index d108ef193..9fd549e18 100644 --- a/app/views/stop_areas/_form.html.erb +++ b/app/views/stop_areas/_form.html.erb @@ -35,6 +35,8 @@ <%= form.input :fare_code, :as => :number %> <%= form.input :nearest_topic_name %> <%= form.input :comment, :as => :text, :input_html => { :rows => 5 } %> + <%= form.input :time_zone, :include_blank => true %> + <%= form.input :url %> <% end %> </div> <div class="pmr_info"> diff --git a/app/views/stop_areas/show.html.erb b/app/views/stop_areas/show.html.erb index 3a6d88207..7ca59cf70 100644 --- a/app/views/stop_areas/show.html.erb +++ b/app/views/stop_areas/show.html.erb @@ -34,6 +34,14 @@ <%= @stop_area.fare_code %> </p> <p> + <label><%= @stop_area.human_attribute_name("time_zone") %>: </label> + <%= @stop_area.time_zone %> + </p> + <p> + <label><%= @stop_area.human_attribute_name("url") %>: </label> + <%= @stop_area.url %> + </p> + <p> <label><%= @stop_area.human_attribute_name("registration_number") %>: </label> <%= @stop_area.registration_number %> </p> diff --git a/config/environment.rb b/config/environment.rb index cc2b4fa95..cc5593ce1 100644 --- a/config/environment.rb +++ b/config/environment.rb @@ -6,4 +6,4 @@ require File.expand_path('../application', __FILE__) ChouetteIhm::Application.initialize! # Fix version -APP_VERSION = '2.5.0' +APP_VERSION = '2.5.1' diff --git a/config/locales/companies.yml b/config/locales/companies.yml index aad451fc8..a9b2512a2 100644 --- a/config/locales/companies.yml +++ b/config/locales/companies.yml @@ -32,6 +32,8 @@ en: phone: "Phone number" fax: "Fax number" email: "Email" + time_zone: "Time zone" + url: "Web page" objectid: "Neptune identifier" object_version: "Version" creation_time: "Created on" @@ -76,6 +78,8 @@ fr: phone: "Numéro de téléphone" fax: "Numéro de fax" email: "Email" + time_zone: "Fuseau horaire" + url: "Page web associée" objectid: "Identifiant Neptune" object_version: "Version" creation_time: "Créé le" diff --git a/config/locales/lines.yml b/config/locales/lines.yml index 93f50b6bb..98d93bcd2 100644 --- a/config/locales/lines.yml +++ b/config/locales/lines.yml @@ -37,6 +37,7 @@ en: deselect_all: "Deselect all" unset: "undefined" advanced_search: "Advanced Search" + color: "Colors" form: group_of_lines: "Associated groups of lines" no_group_of_line: "No group of line" @@ -56,6 +57,9 @@ en: published_name: "Published name" number: "Number" transport_mode: "Transport mode" + url: "Web page" + color: "Line color" + text_color: "Text color" mobility_restricted_suitability: "PRM accessibility" flexible_service: "On demond transportation" unspecified_mrs: "Not specified" @@ -123,6 +127,7 @@ fr: deselect_all: "Tout désélectionner" unset: "non défini" advanced_search: "Recherche avancée" + color: "Couleurs" form: group_of_lines: "Groupes de lignes associés" no_group_of_line: "Aucun groupe de lignes" @@ -142,6 +147,9 @@ fr: published_name: "Nom public" number: "Indice" transport_mode: "Mode de transport" + url: "Page web associée" + color: "Couleur du tracé" + text_color: "Couleur du texte" mobility_restricted_suitability: "Accessibilité PMR" flexible_service: "Transport à la demande" unspecified_mrs: "Non spécifié" diff --git a/config/locales/stop_areas.yml b/config/locales/stop_areas.yml index 80f05d57c..379838f6e 100644 --- a/config/locales/stop_areas.yml +++ b/config/locales/stop_areas.yml @@ -93,6 +93,8 @@ en: long_lat_type: "Projection type" longitude: "Longitude" latitude: "Latitude" + time_zone: "Time zone" + url: "Web page" objectid: "Neptune identifier" object_version: "Version" creation_time: "Created on" @@ -209,6 +211,8 @@ fr: long_lat_type: "Projection" longitude: "Longitude" latitude: "Latitude" + time_zone: "Fuseau horaire" + url: "Page web associée" objectid: "Identifiant Neptune" object_version: "Version" creation_time: "Créé le" diff --git a/db/migrate/20141105123536_add_gtfs_fields_to_companies.ninoxe_engine.rb b/db/migrate/20141105123536_add_gtfs_fields_to_companies.ninoxe_engine.rb new file mode 100644 index 000000000..67ad43660 --- /dev/null +++ b/db/migrate/20141105123536_add_gtfs_fields_to_companies.ninoxe_engine.rb @@ -0,0 +1,9 @@ +# This migration comes from ninoxe_engine (originally 20141017075349) +class AddGtfsFieldsToCompanies < ActiveRecord::Migration + def change + change_table :companies do |t| + t.string :url + t.string :time_zone + end + end +end diff --git a/db/migrate/20141105123537_add_gtfs_fields_to_stop_areas.ninoxe_engine.rb b/db/migrate/20141105123537_add_gtfs_fields_to_stop_areas.ninoxe_engine.rb new file mode 100644 index 000000000..e7ea5f4d6 --- /dev/null +++ b/db/migrate/20141105123537_add_gtfs_fields_to_stop_areas.ninoxe_engine.rb @@ -0,0 +1,9 @@ +# This migration comes from ninoxe_engine (originally 20141017075515) +class AddGtfsFieldsToStopAreas < ActiveRecord::Migration + def change + change_table :stop_areas do |t| + t.string :url + t.string :time_zone + end + end +end diff --git a/db/migrate/20141105123538_add_gtfs_fields_to_lines.ninoxe_engine.rb b/db/migrate/20141105123538_add_gtfs_fields_to_lines.ninoxe_engine.rb new file mode 100644 index 000000000..ca960df76 --- /dev/null +++ b/db/migrate/20141105123538_add_gtfs_fields_to_lines.ninoxe_engine.rb @@ -0,0 +1,10 @@ +# This migration comes from ninoxe_engine (originally 20141017075627) +class AddGtfsFieldsToLines < ActiveRecord::Migration + def change + change_table :lines do |t| + t.string :url + t.string :color, :limit => 6 + t.string :text_color, :limit => 6 + end + end +end diff --git a/db/schema.rb b/db/schema.rb index 6c45bd44a..89cbf7d87 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 20140820074844) do +ActiveRecord::Schema.define(:version => 20141105123538) do create_table "access_links", :force => true do |t| t.integer "access_point_id", :limit => 8 @@ -85,6 +85,8 @@ ActiveRecord::Schema.define(:version => 20140820074844) do t.string "fax" t.string "email" t.string "registration_number" + t.string "url" + t.string "time_zone" end add_index "companies", ["objectid"], :name => "companies_objectid_key", :unique => true @@ -282,6 +284,9 @@ ActiveRecord::Schema.define(:version => 20140820074844) do t.boolean "mobility_restricted_suitability" t.integer "int_user_needs" t.boolean "flexible_service" + t.string "url" + t.string "color", :limit => 6 + t.string "text_color", :limit => 6 end add_index "lines", ["objectid"], :name => "lines_objectid_key", :unique => true @@ -394,6 +399,8 @@ ActiveRecord::Schema.define(:version => 20140820074844) do t.integer "int_user_needs" t.string "zip_code" t.string "city_name" + t.string "url" + t.string "time_zone" end add_index "stop_areas", ["objectid"], :name => "stop_areas_objectid_key", :unique => true |
