aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBruno Perles2015-12-16 10:02:04 +0100
committerBruno Perles2015-12-16 10:02:04 +0100
commit2590606c5912a85b8cb1aaa40c57dab67d75e7f7 (patch)
treea63f7d70a32c6683c31511772d8367c3fa7a2a05
parentd902ef10e8c6830ca0be00bd03b5e117cf6d7285 (diff)
downloadchouette-core-2590606c5912a85b8cb1aaa40c57dab67d75e7f7.tar.bz2
Improvements
-rw-r--r--.gitignore1
-rw-r--r--.travis.yml2
-rw-r--r--app/maps/design/journey_pattern_style_map.rb53
-rw-r--r--app/maps/journey_pattern_map.rb12
-rw-r--r--app/maps/route_map.rb2
-rw-r--r--config/locales/journey_patterns.yml137
6 files changed, 173 insertions, 34 deletions
diff --git a/.gitignore b/.gitignore
index 8b21c30a3..31b5d928c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -23,6 +23,7 @@ public/assets/
chouette2.war
vendor/bundle
.ruby-version
+start.sh
coverage
# IDE
diff --git a/.travis.yml b/.travis.yml
index f208b9fd6..9addd953f 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -45,7 +45,7 @@ notifications:
- alban.peignier@af83.com
- anicet.rohee@af83.com
before_install:
- - gem update bundler
+ - "gem update bundler"
before_script:
- "bundle exec rake ci:db_travis_config"
- "bundle exec rake db:create"
diff --git a/app/maps/design/journey_pattern_style_map.rb b/app/maps/design/journey_pattern_style_map.rb
index b5d9ec7bc..b5323d6ae 100644
--- a/app/maps/design/journey_pattern_style_map.rb
+++ b/app/maps/design/journey_pattern_style_map.rb
@@ -2,46 +2,49 @@ class Design::JourneyPatternStyleMap < Design::GenericStyleMap
attr_accessor :style
def initialize(helpers, options = {})
- @helpers= helpers
+ @helpers = helpers
@style = options[:style].present? ? default_style.merge(options[:style]) : default_style
end
def select_style
- default_style.merge :externalGraphic => @helpers.assets_path_patch( "map/stop_area_hover.png")
+ default_style.merge externalGraphic: @helpers.assets_path_patch( "map/stop_area_hover.png")
end
+
def default_style
{
- :label => "${label}",
- :fontColor => "black",
- :fontSize => "11px",
- :fontWeight => "bold",
- :labelAlign => "ct",
- :labelXOffset => 0,
- :labelYOffset => -15,
- :strokeColor => "#000000",
- :strokeOpacity => 1,
- :strokeWidth => 3,
- :strokeLineCap => "round",
- :strokeDashstyle => "solid",
- :externalGraphic => @helpers.assets_path_patch( "map/${positionType}.png"),
- :graphicWidth => 12,
- :graphicHeight => 12,
- :graphicOpacity => 1,
- :graphicXOffset => -6,
- :graphicYOffset => -6,
- :display => true
+ label: "${label}",
+ fontColor: "black",
+ fontSize: "14px",
+ fontWeight: "bold",
+ labelAlign: "ct",
+ labelXOffset: 0,
+ labelYOffset: -15,
+ strokeColor: "#000000",
+ strokeOpacity: 1,
+ strokeWidth: 3,
+ strokeLineCap: "round",
+ strokeDashstyle: "solid",
+ externalGraphic: @helpers.assets_path_patch( "map/${positionType}.png"),
+ graphicWidth: 12,
+ graphicHeight: 12,
+ graphicOpacity: 1,
+ graphicXOffset: -6,
+ graphicYOffset: -6,
+ display: true
}
end
def context
- context = {
- :label => :" function(feature) {if(feature.layer.map.getZoom() > 13) { return feature.attributes.name;} else {return '';}} ",
- :positionType => :" function(feature) { if (feature.attributes.iconCode != undefined) {return feature.attributes.iconCode;} else { return '';} } "
+ {
+ label: :" function(feature) {if(feature.layer.map.getZoom() > 13) { return feature.attributes.name;} else {return '';}} ",
+ positionType: :" function(feature) { if (feature.attributes.iconCode != undefined) {return feature.attributes.iconCode;} else { return '';} } "
}
end
def style_map
- OpenLayers::StyleMap.new(:default => OpenLayers::Style.new(style, { :context => context}), :select => OpenLayers::Style.new(style.merge( select_style), { :context => context}))
+ OpenLayers::StyleMap.new(
+ default: OpenLayers::Style.new(style, { context: context}),
+ select: OpenLayers::Style.new(style.merge( select_style), { context: context}))
end
end
diff --git a/app/maps/journey_pattern_map.rb b/app/maps/journey_pattern_map.rb
index e5eaa7f6b..9a0da5743 100644
--- a/app/maps/journey_pattern_map.rb
+++ b/app/maps/journey_pattern_map.rb
@@ -8,14 +8,12 @@ class JourneyPatternMap < ApplicationMap
end
def customize_map(map, page)
- layer = kml_layer([journey_pattern.referential, journey_pattern.route.line, journey_pattern.route, journey_pattern], :styleMap => Design::JourneyPatternStyleMap.new(helpers).style_map)
- page.assign "journeyPatternLayer", layer
+ layer = kml_layer([journey_pattern.referential, journey_pattern.route.line, journey_pattern.route, journey_pattern], { setLayerIndex: 999, styleMap: Design::JourneyPatternStyleMap.new(helpers).style_map, rendererOptions: { zIndexing: true } })
+ page.assign 'journeyPatternLayer', layer
+ page.assign 'selectFeature', OpenLayers::Control::SelectFeature.new(:journeyPatternLayer)
- selectFeature = OpenLayers::Control::SelectFeature.new( :journeyPatternLayer)
- page.assign "selectFeature", selectFeature
-
- page << map.add_layer( :journeyPatternLayer)
- page << map.add_control( hover_control_display_name(:journeyPatternLayer) )
+ page << map.add_layer(:journeyPatternLayer)
+ page << map.add_control(hover_control_display_name(:journeyPatternLayer))
page << map.zoom_to_extent(bounds.to_google.to_openlayers) if bounds
end
diff --git a/app/maps/route_map.rb b/app/maps/route_map.rb
index 5acb1ad76..bdd6c4a56 100644
--- a/app/maps/route_map.rb
+++ b/app/maps/route_map.rb
@@ -8,7 +8,7 @@ class RouteMap < ApplicationMap
end
def customize_map(map, page)
- layer = kml_layer([route.referential, route.line, route], :styleMap => Design::RouteStyleMap.new(helpers).style_map)
+ layer = kml_layer([route.referential, route.line, route], :styleMap => Design::RouteStyleMap.new(helpers, {context: context = {label: ""}}).style_map)
page.assign "routeLayer", layer
selectFeature = OpenLayers::Control::SelectFeature.new( :routeLayer)
diff --git a/config/locales/journey_patterns.yml b/config/locales/journey_patterns.yml
new file mode 100644
index 000000000..3e2ddec99
--- /dev/null
+++ b/config/locales/journey_patterns.yml
@@ -0,0 +1,137 @@
+en:
+ journey_patterns:
+ journey_pattern:
+ from_to: "From '%{departure}' to '%{arrival}'"
+ stop_count: "%{count}/%{route_count} stops"
+ vehicle_journeys_count: "Vehicle journeys: %{count}"
+ vehicle_journey_at_stops: "Vehicle journey at stops"
+ actions:
+ new: "Add a new journey_pattern"
+ edit: "Edit this journey pattern"
+ destroy: "Remove this journey pattern"
+ destroy_confirm: "Are you sure you want destroy this journey pattern ?"
+ edit_route_sections: "Edit Shape"
+ new:
+ title: "Add a new journey pattern"
+ edit:
+ title: "Update journey pattern %{journey_pattern}"
+ show:
+ title: "Journey Pattern %{journey_pattern}"
+ stop_points: "Stop point on journey pattern list"
+ index:
+ title: "Journey Patterns"
+ form:
+ warning: "Be careful, selection is also applied to the %{count} vehicle journeys associated to this journey pattern"
+ activerecord:
+ models:
+ journey_pattern:
+ zero: "journey pattern"
+ one: "journey pattern"
+ other: "journey patterns"
+ attributes:
+ journey_pattern:
+ route: "Route"
+ name: "Name"
+ published_name: "Published name"
+ comment: "Comments"
+ registration_number: "Registration number"
+ stop_point_ids: "Route's stop selection"
+ objectid: "Neptune identifier"
+ object_version: "Version"
+ creation_time: "Created on"
+ creator_id: "Created by"
+ formtastic:
+ titles:
+ journey_pattern:
+ name: "Only alphanumerical or underscore characters."
+ registration_number: "Positif integer."
+ objectid: "[prefix]:JourneyPattern:[unique_key] : prefix contains only alphanumerical or underscore characters, unique_key accepts also minus character"
+ neptune:
+ journey_pattern:
+ name: "Only alphanumerical or underscore characters."
+ registration_number: "Positif integer."
+ objectid: "[prefix]:JourneyPattern:[unique_key] : prefix contains only alphanumerical or underscore characters, unique_key accepts also minus character"
+ netex:
+ journey_pattern:
+ name: "Only alphanumerical or underscore characters."
+ registration_number: "Positif integer."
+ objectid: "[prefix]:JourneyPattern:[unique_key] : prefix contains only alphanumerical or underscore characters, unique_key accepts also minus character"
+ gtfs:
+ journey_pattern:
+ name: "Only alphanumerical or underscore characters."
+ registration_number: "Positif integer."
+ objectid: "[prefix]:JourneyPattern:[unique_key] : prefix contains only alphanumerical or underscore characters, unique_key accepts also minus character"
+ hub:
+ journey_pattern:
+ name: "Only alphanumerical or underscore characters. Maximum length = 75."
+ registration_number: "Positif integer, unique key, of no more than 8 digits."
+ objectid: "[prefix]:JourneyPattern:[unique_key] : prefix contains only alphanumerical or underscore characters, unique_key accepts also minus character. Maximum length of the unique key = 30."
+
+fr:
+ journey_patterns:
+ journey_pattern:
+ from_to: "De '%{departure}' à '%{arrival}'"
+ stop_count: "%{count}/%{route_count} arrêts"
+ vehicle_journeys_count: "Courses: %{count}"
+ vehicle_journey_at_stops: "Horaires des courses"
+ actions:
+ new: "Ajouter une mission"
+ edit: "Modifier cette mission"
+ destroy: "Supprimer cette mission"
+ destroy_confirm: "Etes vous sûr de vouloir détruire cette mission ?"
+ edit_route_sections: "Modifier le tracé"
+ new:
+ title: "Ajouter une mission"
+ edit:
+ title: "Modifier la mission %{journey_pattern}"
+ show:
+ title: "Mission %{journey_pattern}"
+ stop_points: "Liste des arrêts de la mission"
+ index:
+ title: "Missions"
+ form:
+ warning: "Attention, la sélection s'applique aussi aux %{count} courses de la mission"
+ activerecord:
+ models:
+ journey_pattern:
+ zero: "mission"
+ one: "mission"
+ other: "missions"
+ attributes:
+ journey_pattern:
+ route: "Séquence d'arrêts"
+ name: "Nom"
+ published_name: "Nom public"
+ comment: "Commentaire"
+ registration_number: "Numéro d'enregistrement"
+ stop_point_ids: "Sélection des arrêts desservis"
+ objectid: "Identifiant Neptune"
+ object_version: "Version"
+ creation_time: "Créé le"
+ creator_id: "Créé par"
+ formtastic:
+ titles:
+ journey_pattern:
+ name: "Caractères autorisés : alphanumériques et 'souligné'."
+ registration_number: "Entier positif."
+ objectid: "[prefixe]:JourneyPattern:[clé_unique] caractères autorisés : alphanumériques et 'souligné' pour le préfixe, la clé unique accepte en plus le 'moins'"
+ neptune:
+ journey_pattern:
+ name: "Caractères autorisés : alphanumériques et 'souligné'."
+ registration_number: "Entier positif."
+ objectid: "[prefixe]:JourneyPattern:[clé_unique] caractères autorisés : alphanumériques et 'souligné' pour le préfixe, la clé unique accepte en plus le 'moins'"
+ netex:
+ journey_pattern:
+ name: "Caractères autorisés : alphanumériques et 'souligné'."
+ registration_number: "Entier positif."
+ objectid: "[prefixe]:JourneyPattern:[clé_unique] caractères autorisés : alphanumériques et 'souligné' pour le préfixe, la clé unique accepte en plus le 'moins'"
+ gtfs:
+ journey_pattern:
+ name: "Caractères autorisés : alphanumériques et 'souligné'."
+ registration_number: "Entier positif."
+ objectid: "[prefixe]:JourneyPattern:[clé_unique] caractères autorisés : alphanumériques et 'souligné' pour le préfixe, la clé unique accepte en plus le 'moins'"
+ hub:
+ journey_pattern:
+ name: "Caractères autorisés : alphanumériques et 'souligné'. Longueur maximale = 75."
+ registration_number: "Entier positif, clé unique, d'un maximum de 8 chiffres."
+ objectid: "[prefixe]:JourneyPattern:[clé_unique] caractères autorisés : alphanumériques et 'souligné' pour le préfixe, la clé unique accepte en plus le 'moins'. Longueur maximale de la clé unique = 30."