aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichel Etienne2012-08-21 14:10:53 +0200
committerMichel Etienne2012-08-21 14:10:53 +0200
commitf5505e924fd512f7d89fc35f6e6a515862de0854 (patch)
tree250c428c6542e176c421b75ff06d8b69bbb11987
parent10c30e65777641945af317bd6cd6806bb9b3a933 (diff)
parent13cdfc734313ea6288fa88a0f27960bfbc966e78 (diff)
downloadchouette-core-f5505e924fd512f7d89fc35f6e6a515862de0854.tar.bz2
Merge branch 'master' of chouette.dryade.priv:/srv/git/chouette2
-rw-r--r--app/assets/images/icons/stop_area.svg12
-rw-r--r--app/assets/images/icons/stop_area_black_unselected.pngbin379 -> 421 bytes
-rw-r--r--app/assets/images/icons/stop_area_green_unselected.pngbin485 -> 589 bytes
-rw-r--r--app/assets/images/icons/stop_area_hover.pngbin0 -> 522 bytes
-rw-r--r--app/assets/images/icons/stop_area_hover.svg90
-rw-r--r--app/assets/images/icons/stop_area_hover_unselected.pngbin0 -> 473 bytes
-rw-r--r--app/assets/images/icons/stop_area_red_unselected.pngbin425 -> 462 bytes
-rw-r--r--app/assets/images/icons/stop_area_unselected.svg8
-rw-r--r--app/assets/javascripts/public/journey_pattern.js.coffee19
-rw-r--r--app/assets/javascripts/route.js.coffee19
-rw-r--r--app/assets/stylesheets/journey_patterns.css.scss6
-rw-r--r--app/assets/stylesheets/routes.css.scss4
-rw-r--r--app/controllers/journey_patterns_controller.rb9
-rw-r--r--app/controllers/routes_controller.rb1
-rw-r--r--app/helpers/journey_patterns_helper.rb14
-rw-r--r--app/maps/application_map.rb10
-rw-r--r--app/maps/journey_pattern_map.rb40
-rw-r--r--app/maps/route_map.rb9
-rw-r--r--app/maps/style_map/journey_pattern_style_map.rb47
-rw-r--r--app/maps/style_map/route_style_map.rb9
-rw-r--r--app/views/journey_patterns/_stop_points_detail.html.erb10
-rw-r--r--app/views/journey_patterns/show.html.erb17
-rw-r--r--app/views/journey_patterns/show.js.erb4
-rw-r--r--app/views/journey_patterns/show.kml.erb19
-rw-r--r--app/views/routes/_stop_points_detail.html.erb10
-rw-r--r--app/views/routes/show.html.erb4
-rw-r--r--app/views/routes/show.js.erb4
-rw-r--r--app/views/routes/show.kml.erb1
-rw-r--r--config/locales/will_paginate.yml2
29 files changed, 325 insertions, 43 deletions
diff --git a/app/assets/images/icons/stop_area.svg b/app/assets/images/icons/stop_area.svg
index c46362096..560b22e17 100644
--- a/app/assets/images/icons/stop_area.svg
+++ b/app/assets/images/icons/stop_area.svg
@@ -13,8 +13,8 @@
height="16px"
id="svg3632"
version="1.1"
- inkscape:version="0.47 r22583"
- sodipodi:docname="point.svg">
+ inkscape:version="0.48.3.1 r9886"
+ sodipodi:docname="stop_area.svg">
<defs
id="defs3634">
<inkscape:perspective
@@ -33,16 +33,16 @@
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="22.197802"
- inkscape:cx="-8.071535"
+ inkscape:cx="3.8303433"
inkscape:cy="7.9961044"
inkscape:current-layer="layer1"
showgrid="true"
inkscape:grid-bbox="true"
inkscape:document-units="px"
inkscape:window-width="1600"
- inkscape:window-height="851"
+ inkscape:window-height="857"
inkscape:window-x="0"
- inkscape:window-y="25"
+ inkscape:window-y="27"
inkscape:window-maximized="1" />
<metadata
id="metadata3637">
@@ -62,7 +62,7 @@
inkscape:groupmode="layer">
<path
sodipodi:type="arc"
- style="fill:none;stroke:#000000;stroke-width:1.9543159;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
+ style="fill:#ffffff;stroke:#000000;stroke-width:1.95431590000000011;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;fill-opacity:1"
id="path3642"
sodipodi:cx="9.4153461"
sodipodi:cy="8.9047031"
diff --git a/app/assets/images/icons/stop_area_black_unselected.png b/app/assets/images/icons/stop_area_black_unselected.png
index 1c9643b8c..97e7227da 100644
--- a/app/assets/images/icons/stop_area_black_unselected.png
+++ b/app/assets/images/icons/stop_area_black_unselected.png
Binary files differ
diff --git a/app/assets/images/icons/stop_area_green_unselected.png b/app/assets/images/icons/stop_area_green_unselected.png
index 5f2f9172c..c7b8fa882 100644
--- a/app/assets/images/icons/stop_area_green_unselected.png
+++ b/app/assets/images/icons/stop_area_green_unselected.png
Binary files differ
diff --git a/app/assets/images/icons/stop_area_hover.png b/app/assets/images/icons/stop_area_hover.png
new file mode 100644
index 000000000..5a4b40153
--- /dev/null
+++ b/app/assets/images/icons/stop_area_hover.png
Binary files differ
diff --git a/app/assets/images/icons/stop_area_hover.svg b/app/assets/images/icons/stop_area_hover.svg
new file mode 100644
index 000000000..5c27685a0
--- /dev/null
+++ b/app/assets/images/icons/stop_area_hover.svg
@@ -0,0 +1,90 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="16px"
+ height="16px"
+ id="svg3632"
+ version="1.1"
+ inkscape:version="0.48.3.1 r9886"
+ sodipodi:docname="stop_area.svg">
+ <defs
+ id="defs3634">
+ <inkscape:perspective
+ sodipodi:type="inkscape:persp3d"
+ inkscape:vp_x="0 : 8 : 1"
+ inkscape:vp_y="0 : 1000 : 0"
+ inkscape:vp_z="16 : 8 : 1"
+ inkscape:persp3d-origin="8 : 5.3333333 : 1"
+ id="perspective3640" />
+ </defs>
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="22.197802"
+ inkscape:cx="3.8303433"
+ inkscape:cy="7.9961044"
+ inkscape:current-layer="layer1"
+ showgrid="true"
+ inkscape:grid-bbox="true"
+ inkscape:document-units="px"
+ inkscape:window-width="1600"
+ inkscape:window-height="857"
+ inkscape:window-x="0"
+ inkscape:window-y="27"
+ inkscape:window-maximized="1" />
+ <metadata
+ id="metadata3637">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title></dc:title>
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ id="layer1"
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer">
+ <path
+ sodipodi:type="arc"
+ style="fill:#ffffff;stroke:#70f7ff;stroke-width:1.95431590000000011;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;fill-opacity:1"
+ id="path3642"
+ sodipodi:cx="9.4153461"
+ sodipodi:cy="8.9047031"
+ sodipodi:rx="7.5232673"
+ sodipodi:ry="7.8160892"
+ d="m 16.938613,8.9047031 a 7.5232673,7.8160892 0 1 1 -15.0465341,0 7.5232673,7.8160892 0 1 1 15.0465341,0 z"
+ transform="matrix(0.94317974,0,0,0.90784447,-0.88036375,-0.08408547)"
+ inkscape:export-xdpi="90"
+ inkscape:export-ydpi="90"
+ inkscape:export-filename="/home/luc/projects/chouette2/app/assets/images/icons/stop_area_hover.png" />
+ <path
+ sodipodi:type="arc"
+ style="fill:#70f7ff;fill-opacity:1;stroke:none"
+ id="path4154"
+ sodipodi:cx="7.9287128"
+ sodipodi:cy="8.4542074"
+ sodipodi:rx="1.6668317"
+ sodipodi:ry="1.6443069"
+ d="m 9.5955446,8.4542074 a 1.6668317,1.6443069 0 1 1 -3.3336635,0 1.6668317,1.6443069 0 1 1 3.3336635,0 z"
+ transform="matrix(2.099792,0,0,2.1285564,-8.6486479,-9.9952573)"
+ inkscape:export-filename="/home/luc/projects/chouette2/app/assets/images/icons/stop_area_hover.png"
+ inkscape:export-xdpi="90"
+ inkscape:export-ydpi="90" />
+ </g>
+</svg>
diff --git a/app/assets/images/icons/stop_area_hover_unselected.png b/app/assets/images/icons/stop_area_hover_unselected.png
new file mode 100644
index 000000000..865372683
--- /dev/null
+++ b/app/assets/images/icons/stop_area_hover_unselected.png
Binary files differ
diff --git a/app/assets/images/icons/stop_area_red_unselected.png b/app/assets/images/icons/stop_area_red_unselected.png
index 3b7b97aa6..ad4725878 100644
--- a/app/assets/images/icons/stop_area_red_unselected.png
+++ b/app/assets/images/icons/stop_area_red_unselected.png
Binary files differ
diff --git a/app/assets/images/icons/stop_area_unselected.svg b/app/assets/images/icons/stop_area_unselected.svg
index f7c89ed6d..c18189a9f 100644
--- a/app/assets/images/icons/stop_area_unselected.svg
+++ b/app/assets/images/icons/stop_area_unselected.svg
@@ -14,7 +14,7 @@
id="svg3632"
version="1.1"
inkscape:version="0.48.3.1 r9886"
- sodipodi:docname="stop_area.svg">
+ sodipodi:docname="stop_area_unselected.svg">
<defs
id="defs3634">
<inkscape:perspective
@@ -33,7 +33,7 @@
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="22.197802"
- inkscape:cx="-7.981436"
+ inkscape:cx="-16.788614"
inkscape:cy="7.9961044"
inkscape:current-layer="layer1"
showgrid="true"
@@ -52,7 +52,7 @@
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
- <dc:title></dc:title>
+ <dc:title />
</cc:Work>
</rdf:RDF>
</metadata>
@@ -62,7 +62,7 @@
inkscape:groupmode="layer">
<path
sodipodi:type="arc"
- style="fill:none;stroke:#000000;stroke-width:1.9543159;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
+ style="fill:#ffffff;stroke:#000000;stroke-width:1.95431590000000011;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;fill-opacity:1"
id="path3642"
sodipodi:cx="9.4153461"
sodipodi:cy="8.9047031"
diff --git a/app/assets/javascripts/public/journey_pattern.js.coffee b/app/assets/javascripts/public/journey_pattern.js.coffee
new file mode 100644
index 000000000..6ea0c01de
--- /dev/null
+++ b/app/assets/javascripts/public/journey_pattern.js.coffee
@@ -0,0 +1,19 @@
+jQuery ->
+ select_stop_on_map = (event) ->
+ if (event.type == 'mouseenter')
+ if event.target.id.match(/^stop_point_(\w+)$/)
+ stopAreaId = $("#"+event.target.id+" a").attr('href').match(/\d+$/)[0]
+ placeMark = selectFeature.layer.getFeatureByFid( stopAreaId)
+ selectFeature.unselectAll()
+ selectFeature.select( placeMark)
+ else
+ selectFeature.unselectAll()
+
+ $('.journey_patterns.show div.stop_points .stop_point').live("hover", select_stop_on_map)
+
+ make_ajax_pagination = () ->
+ $.get(this.href, null, null, 'script')
+ false
+
+ $('.stop_points_detail .pagination a').live("click", make_ajax_pagination)
+
diff --git a/app/assets/javascripts/route.js.coffee b/app/assets/javascripts/route.js.coffee
index a3dd304d3..274e87f77 100644
--- a/app/assets/javascripts/route.js.coffee
+++ b/app/assets/javascripts/route.js.coffee
@@ -8,8 +8,25 @@ jQuery ->
switch_stop_points = (event) ->
event.preventDefault()
- $('.routes.show .stop_points.content').toggle('slow')
+ $('.routes.show .stop_points_detail').toggle('slow')
$('a.stop_points .switcher').toggle()
$('.routes.show a.stop_points').click(switch_stop_points)
+ select_stop_on_map = (event) ->
+ if (event.type == 'mouseenter')
+ if event.target.id.match(/^stop_point_(\w+)$/)
+ stopAreaId = $("#"+event.target.id+" a").attr('href').match(/\d+$/)[0]
+ placeMark = selectFeature.layer.getFeatureByFid( stopAreaId)
+ selectFeature.unselectAll()
+ selectFeature.select( placeMark)
+ else
+ selectFeature.unselectAll()
+
+ $('.routes.show div.stop_points .stop_point').live("hover", select_stop_on_map)
+
+ make_ajax_pagination = () ->
+ $.get(this.href, null, null, 'script')
+ false
+
+ $('.routes.show .stop_points_detail .pagination a').live("click", make_ajax_pagination)
diff --git a/app/assets/stylesheets/journey_patterns.css.scss b/app/assets/stylesheets/journey_patterns.css.scss
index 186bfd8f4..0e9113f41 100644
--- a/app/assets/stylesheets/journey_patterns.css.scss
+++ b/app/assets/stylesheets/journey_patterns.css.scss
@@ -22,6 +22,10 @@
.summary p label {
font-weight: bold;
}
+
+ .stop_points_detail div.page_info {
+ margin-top: 0px;
+ }
.stop_point:after {
@include after_div_for_object;
@@ -44,7 +48,7 @@
.stop_point {
@include div_for_object;
/* to create multi-column index */
- width: 350px;
+ width: 250px;
float: left;
padding-right: 10px;
diff --git a/app/assets/stylesheets/routes.css.scss b/app/assets/stylesheets/routes.css.scss
index f2e3dab4a..72670197b 100644
--- a/app/assets/stylesheets/routes.css.scss
+++ b/app/assets/stylesheets/routes.css.scss
@@ -57,6 +57,10 @@
.summary p label {
font-weight: bold;
}
+
+ .stop_points_detail div.page_info {
+ margin-top: 0px;
+ }
.stop_point:after {
@include after_div_for_object;
diff --git a/app/controllers/journey_patterns_controller.rb b/app/controllers/journey_patterns_controller.rb
index 6b8855dc1..377ddf7c8 100644
--- a/app/controllers/journey_patterns_controller.rb
+++ b/app/controllers/journey_patterns_controller.rb
@@ -2,7 +2,8 @@ class JourneyPatternsController < ChouetteController
defaults :resource_class => Chouette::JourneyPattern
respond_to :html
- respond_to :js, :only => [:new_vehicle_journey]
+ respond_to :js, :only => [:new_vehicle_journey, :show]
+ respond_to :kml, :only => :show
belongs_to :referential do
belongs_to :line, :parent_class => Chouette::Line do
@@ -11,6 +12,7 @@ class JourneyPatternsController < ChouetteController
end
alias_method :route, :parent
+ alias_method :journey_pattern, :resource
def index
index! do |format|
@@ -23,8 +25,8 @@ class JourneyPatternsController < ChouetteController
end
def show
- #@map = RouteMap.new(route).with_helpers(self)
- @stop_points = resource.stop_points.paginate(:page => params[:page])
+ @map = JourneyPatternMap.new(journey_pattern).with_helpers(self)
+ @stop_points = journey_pattern.stop_points.paginate(:page => params[:page])
show!
end
@@ -33,4 +35,5 @@ class JourneyPatternsController < ChouetteController
@vehicle_journey.update_journey_pattern(resource)
render "vehicle_journeys/select_journey_pattern"
end
+
end
diff --git a/app/controllers/routes_controller.rb b/app/controllers/routes_controller.rb
index 91da5519c..fdad19dd9 100644
--- a/app/controllers/routes_controller.rb
+++ b/app/controllers/routes_controller.rb
@@ -3,6 +3,7 @@ class RoutesController < ChouetteController
respond_to :html, :xml, :json
respond_to :kml, :only => :show
+ respond_to :js, :only => :show
belongs_to :referential do
belongs_to :line, :parent_class => Chouette::Line, :optional => true, :polymorphic => true
diff --git a/app/helpers/journey_patterns_helper.rb b/app/helpers/journey_patterns_helper.rb
index bcfb71cd1..6897b88c9 100644
--- a/app/helpers/journey_patterns_helper.rb
+++ b/app/helpers/journey_patterns_helper.rb
@@ -13,5 +13,19 @@ module JourneyPatternsHelper
"#{journey_pattern.human_attribute_name(:stop_point_ids)}. #{t('journey_patterns.form.warning', :count => journey_pattern.vehicle_journeys.count)}"
end
+ def icon_code(stop_point, journey)
+ code = "stop_area"
+ if stop_point.stop_area.id == journey.route.stop_areas.first.id
+ code << "_green"
+ elsif stop_point.stop_area.id == journey.route.stop_areas.last.id
+ code << "_red"
+ else
+ code << "_black"
+ end
+ unless journey.stop_points.include?( stop_point)
+ code << "_unselected"
+ end
+ code
+ end
end
diff --git a/app/maps/application_map.rb b/app/maps/application_map.rb
index f1b1d103d..d87915bc5 100644
--- a/app/maps/application_map.rb
+++ b/app/maps/application_map.rb
@@ -86,8 +86,10 @@ class ApplicationMap
:renderIntent => "temporary",
:eventListeners => {
:featurehighlighted => JsExpr.new("function(e) {
- feature = e.feature ;
- popup = new OpenLayers.Popup.AnchoredBubble('chicken',
+ var feature = e.feature ;
+ if (feature.attributes.inactive != undefined)
+ return;
+ var popup = new OpenLayers.Popup.AnchoredBubble('chicken',
new OpenLayers.LonLat(feature.geometry.x, feature.geometry.y),
null,
\"<div class='popup_hover'><b>\" + feature.attributes.name +\"</b></div> \", null, false, null);
@@ -98,7 +100,9 @@ class ApplicationMap
map.addPopup(popup);
}"),
:featureunhighlighted => JsExpr.new("function(e) {
- feature = e.feature;
+ var feature = e.feature;
+ if (feature.attributes.inactive != undefined)
+ return;
map.removePopup(feature.popup);
feature.popup.destroy();
feature.popup = null;
diff --git a/app/maps/journey_pattern_map.rb b/app/maps/journey_pattern_map.rb
new file mode 100644
index 000000000..d690b3212
--- /dev/null
+++ b/app/maps/journey_pattern_map.rb
@@ -0,0 +1,40 @@
+class JourneyPatternMap < ApplicationMap
+
+ attr_reader :journey_pattern, :style
+
+ def initialize(journey_pattern, style = nil)
+ @journey_pattern = journey_pattern
+ @style = style
+ end
+
+ def map
+ @map ||= MapLayers::Map.new(id, :projection => projection("EPSG:900913"), :controls => controls) do |map, page|
+ page << map.add_layer(MapLayers::OSM_MAPNIK)
+ page << map.add_layer(google_physical)
+ page << map.add_layer(google_streets)
+ page << map.add_layer(google_hybrid)
+ page << map.add_layer(google_satellite)
+
+ #page << map.add_layer(kml_layer(line, :styleMap => StyleMap::LineStyleMap.new( :style => line_style).style_map))
+ layer = kml_layer([journey_pattern.referential, journey_pattern.route.line, journey_pattern.route, journey_pattern], :styleMap => StyleMap::JourneyPatternStyleMap.new.style_map)
+ page.assign "journeyPatternLayer", layer
+
+ 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.zoom_to_extent(bounds.to_google.to_openlayers) if bounds
+ end
+ end
+
+ def ready?
+ bounds.present?
+ end
+
+ def bounds
+ @bounds ||= journey_pattern.route.geometry.bounds
+ end
+
+end
+
diff --git a/app/maps/route_map.rb b/app/maps/route_map.rb
index daa3de23f..70e31e2e2 100644
--- a/app/maps/route_map.rb
+++ b/app/maps/route_map.rb
@@ -16,8 +16,15 @@ class RouteMap < ApplicationMap
page << map.add_layer(google_satellite)
#page << map.add_layer(kml_layer(line, :styleMap => StyleMap::LineStyleMap.new( :style => line_style).style_map))
- page << map.add_layer(kml_layer([route.referential, route.line, route], :styleMap => StyleMap::RouteStyleMap.new.style_map))
+ layer = kml_layer([route.referential, route.line, route], :styleMap => StyleMap::RouteStyleMap.new.style_map)
+ page.assign "routeLayer", layer
+ selectFeature = OpenLayers::Control::SelectFeature.new( :routeLayer)
+
+ page << map.add_layer( :routeLayer)
+ page << map.add_control( hover_control_display_name(:routeLayer) )
page << map.zoom_to_extent(bounds.to_google.to_openlayers) if bounds
+
+ page.assign "selectFeature", selectFeature
end
end
diff --git a/app/maps/style_map/journey_pattern_style_map.rb b/app/maps/style_map/journey_pattern_style_map.rb
new file mode 100644
index 000000000..c0d08ba77
--- /dev/null
+++ b/app/maps/style_map/journey_pattern_style_map.rb
@@ -0,0 +1,47 @@
+class StyleMap::JourneyPatternStyleMap < StyleMap::GenericStyleMap
+ attr_accessor :style
+
+ def initialize(options = {})
+ @style = options[:style].present? ? default_style.merge(options[:style]) : default_style
+ end
+
+ def select_style
+ default_style.merge :externalGraphic => "/assets/icons/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 => "/assets/icons/${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 '';} } "
+ }
+ end
+
+ def style_map
+ 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/style_map/route_style_map.rb b/app/maps/style_map/route_style_map.rb
index 136cecba5..81ed483fb 100644
--- a/app/maps/style_map/route_style_map.rb
+++ b/app/maps/style_map/route_style_map.rb
@@ -5,6 +5,9 @@ class StyleMap::RouteStyleMap < StyleMap::GenericStyleMap
@style = options[:style].present? ? default_style.merge(options[:style]) : default_style
end
+ def select_style
+ default_style.merge :externalGraphic => "/assets/icons/stop_area_hover.png"
+ end
def default_style
{
:label => "${label}",
@@ -19,7 +22,7 @@ class StyleMap::RouteStyleMap < StyleMap::GenericStyleMap
:strokeWidth => 3,
:strokeLineCap => "round",
:strokeDashstyle => "solid",
- :externalGraphic => "/assets/map/${positionType}.png",
+ :externalGraphic => "/assets/icons/${positionType}.png",
:graphicWidth => 12,
:graphicHeight => 12,
:graphicOpacity => 1,
@@ -32,12 +35,12 @@ class StyleMap::RouteStyleMap < StyleMap::GenericStyleMap
def context
context = {
:label => :" function(feature) {if(feature.layer.map.getZoom() > 13) { return feature.attributes.name;} else {return '';}} ",
- :positionType => :" function(feature) { if (feature.attributes.departure != undefined) { return 'departure'; } else if (feature.attributes.arrival != undefined) { return 'arrival'; } else { return 'interstop'; }} "
+ :positionType => :" function(feature) { if (feature.attributes.departure != undefined) { return 'stop_area_green'; } else if (feature.attributes.arrival != undefined) { return 'stop_area_red'; } else { return 'stop_area_black'; }} "
}
end
def style_map
- OpenLayers::StyleMap.new(:default => OpenLayers::Style.new(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/views/journey_patterns/_stop_points_detail.html.erb b/app/views/journey_patterns/_stop_points_detail.html.erb
new file mode 100644
index 000000000..6c9e4afae
--- /dev/null
+++ b/app/views/journey_patterns/_stop_points_detail.html.erb
@@ -0,0 +1,10 @@
+ <div class="page_info">
+ <span class="search"> <%= t("will_paginate.page_entries_info.list") %></span> <%= page_entries_info @stop_points %>
+ </div>
+ <div class="stop_points paginated_content">
+ <%= render :partial => "stop_points/stop_point", :collection => @stop_points %>
+ </div>
+ <div class="pagination">
+ <%= will_paginate @stop_points, :container => false %>
+ </div>
+
diff --git a/app/views/journey_patterns/show.html.erb b/app/views/journey_patterns/show.html.erb
index 9962e4d8b..507a71cca 100644
--- a/app/views/journey_patterns/show.html.erb
+++ b/app/views/journey_patterns/show.html.erb
@@ -1,6 +1,7 @@
<%= title_tag t('journey_patterns.show.title', :journey_pattern => journey_name( @journey_pattern), :route => @route.name ) %>
-<div class="route_show">
+<div class="journey_pattern_show">
+ <%= @map.to_html %>
<div class="summary">
<p>
@@ -39,18 +40,10 @@
</div>
+<p class="after_map" />
<h3 class="journey_pattern_stop_points"><%= t('.stop_points') %></h3>
-<div class="pagination">
- <div class="page_info">
- <%= page_entries_info @stop_points %>
- </div>
- <%= will_paginate @stop_points, :container => false %>
-</div>
-<div class="stop_points paginated_content">
- <%= render :partial => "stop_points/stop_point", :collection => @stop_points %>
-</div>
-<div class="pagination">
- <%= will_paginate @stop_points, :container => false %>
+<div class="stop_points_detail" >
+ <%= render :partial => "stop_points_detail" %>
</div>
<% content_for :sidebar do %>
diff --git a/app/views/journey_patterns/show.js.erb b/app/views/journey_patterns/show.js.erb
new file mode 100644
index 000000000..aedb0fb9e
--- /dev/null
+++ b/app/views/journey_patterns/show.js.erb
@@ -0,0 +1,4 @@
+$(function (){
+ $(".stop_points_detail").html("<%= escape_javascript(render(:partial => "stop_points_detail")) %>");
+});
+
diff --git a/app/views/journey_patterns/show.kml.erb b/app/views/journey_patterns/show.kml.erb
index e08eb2255..75ca50ab5 100644
--- a/app/views/journey_patterns/show.kml.erb
+++ b/app/views/journey_patterns/show.kml.erb
@@ -3,18 +3,23 @@
<Document>
<Placemark id="route_<%= @journey_pattern.id %>" >
<name><%= @journey_pattern.name %></name>
- <%= @journey_pattern.geometry.kml_representation.html_safe %>
+ <inactive>true</inactive>
+ <%= @journey_pattern.route.geometry.kml_representation.html_safe %>
</Placemark>
- <% @journey_pattern.stop_areas.where("latitude is not null and longitude is not null").each_with_index do |stop_area, index| %>
- <Placemark id="<%= stop_area.id %>" >
- <name><%= "#{stop_area.name} (#{index+1})" %></name>
- <% if stop_area.id==@journey_pattern.stop_areas.first.id %>
+ <% @journey_pattern.route.stop_points.each_with_index do |stop_point, index| %>
+ <% if stop_point.stop_area.geometry %>
+ <Placemark id="<%= stop_point.stop_area.id %>" >
+ <name><%= "#{stop_point.stop_area.name} (#{index+1})" %></name>
+ <stop><%= @journey_pattern.stop_points.include?( stop_point) ? "true" : "false" %></stop>
+ <% if stop_point.stop_area.id==@route.stop_areas.first.id %>
<departure>true</departure>
- <% elsif stop_area.id==@journey_pattern.stop_areas.last.id %>
+ <% elsif stop_point.stop_area.id==@route.stop_areas.last.id %>
<arrival>true</arrival>
<% end %>
- <%= stop_area.geometry.kml_representation.html_safe %>
+ <iconCode><%= icon_code(stop_point, @journey_pattern)%></iconCode>
+ <%= stop_point.stop_area.geometry.kml_representation.html_safe %>
</Placemark>
+ <% end %>
<% end %>
</Document>
</kml>
diff --git a/app/views/routes/_stop_points_detail.html.erb b/app/views/routes/_stop_points_detail.html.erb
new file mode 100644
index 000000000..6c9e4afae
--- /dev/null
+++ b/app/views/routes/_stop_points_detail.html.erb
@@ -0,0 +1,10 @@
+ <div class="page_info">
+ <span class="search"> <%= t("will_paginate.page_entries_info.list") %></span> <%= page_entries_info @stop_points %>
+ </div>
+ <div class="stop_points paginated_content">
+ <%= render :partial => "stop_points/stop_point", :collection => @stop_points %>
+ </div>
+ <div class="pagination">
+ <%= will_paginate @stop_points, :container => false %>
+ </div>
+
diff --git a/app/views/routes/show.html.erb b/app/views/routes/show.html.erb
index 9980543c7..9fa1aa184 100644
--- a/app/views/routes/show.html.erb
+++ b/app/views/routes/show.html.erb
@@ -71,8 +71,8 @@
<span class="switcher" style="display: none;">-</span>
</a>
</h3>
-<div class="stop_points content" style="display: none;">
- <%= render :partial => "stop_points/stop_point", :collection => @stop_points %>
+<div class="stop_points_detail" style="display: none;">
+ <%= render :partial => "stop_points_detail" %>
</div>
<h3 class="route_journey_patterns"><%= t('.journey_patterns') %>
diff --git a/app/views/routes/show.js.erb b/app/views/routes/show.js.erb
new file mode 100644
index 000000000..aedb0fb9e
--- /dev/null
+++ b/app/views/routes/show.js.erb
@@ -0,0 +1,4 @@
+$(function (){
+ $(".stop_points_detail").html("<%= escape_javascript(render(:partial => "stop_points_detail")) %>");
+});
+
diff --git a/app/views/routes/show.kml.erb b/app/views/routes/show.kml.erb
index 4e90fa963..91ffb9918 100644
--- a/app/views/routes/show.kml.erb
+++ b/app/views/routes/show.kml.erb
@@ -3,6 +3,7 @@
<Document>
<Placemark id="route_<%= @route.id %>" >
<name><%= @route.name %></name>
+ <inactive>true</inactive>
<%= @route.geometry.kml_representation.html_safe %>
</Placemark>
<% @route.stop_areas.where("latitude is not null and longitude is not null").each_with_index do |stop_area, index| %>
diff --git a/config/locales/will_paginate.yml b/config/locales/will_paginate.yml
index a5f2ebf22..a44d740c0 100644
--- a/config/locales/will_paginate.yml
+++ b/config/locales/will_paginate.yml
@@ -6,6 +6,7 @@ en:
page_entries_info:
search: Search
+ list: Paginated list
single_page:
zero: "No item found"
one: "1 %{model} shown"
@@ -26,6 +27,7 @@ fr:
page_entries_info:
search: Recherche
+ list: Liste paginée
single_page:
zero: "Aucun élément trouvé"
one: "1 %{model} affiché(e)"