aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlban Peignier2012-07-11 12:01:27 +0200
committerAlban Peignier2012-07-11 12:01:27 +0200
commit0a44390146ef87422fe2213158a7abcba0253ed1 (patch)
tree88bde3edfcad596439d49985bcb2d74cb86c4408
parent70b9756a1b3aadbdbb3ccd9cbb0503e524df53e1 (diff)
downloadchouette-core-0a44390146ef87422fe2213158a7abcba0253ed1.tar.bz2
Add a StopAreaController#default_geometry to compute missing geometries. Fixes #47
-rw-r--r--Gemfile.lock2
-rw-r--r--app/controllers/stop_areas_controller.rb6
-rw-r--r--app/views/stop_areas/index.html.erb3
-rw-r--r--config/locales/stop_areas.yml4
-rw-r--r--config/routes.rb3
5 files changed, 16 insertions, 2 deletions
diff --git a/Gemfile.lock b/Gemfile.lock
index fe315519f..d2c22f5d4 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -1,6 +1,6 @@
GIT
remote: git://chouette.dryade.priv/ninoxe
- revision: cebb174290257773b95eb663cdcb107dccf1fca6
+ revision: f75aaa8ba65bc798d663a2d8b9b4c2bd45986fce
specs:
ninoxe (0.0.8)
GeoRuby
diff --git a/app/controllers/stop_areas_controller.rb b/app/controllers/stop_areas_controller.rb
index 8d55a49d5..4f8aec734 100644
--- a/app/controllers/stop_areas_controller.rb
+++ b/app/controllers/stop_areas_controller.rb
@@ -58,6 +58,12 @@ class StopAreasController < ChouetteController
edit!
end
+ def default_geometry
+ count = referential.stop_areas.without_geometry.default_geometry!
+ flash[:notice] = I18n.translate("stop_areas.default_geometry_success", :count => count)
+ redirect_to referential_stop_areas_path(@referential)
+ end
+
protected
alias_method :stop_area, :resource
diff --git a/app/views/stop_areas/index.html.erb b/app/views/stop_areas/index.html.erb
index 0d2a925cc..a8a12ee52 100644
--- a/app/views/stop_areas/index.html.erb
+++ b/app/views/stop_areas/index.html.erb
@@ -24,7 +24,8 @@
<% content_for :sidebar do %>
<ul class="actions">
- <li><%= link_to t('stop_areas.actions.new'), new_referential_stop_area_path(@referential), :class => "add" %></li>
+ <li><%= link_to t('stop_areas.actions.new'), new_referential_stop_area_path(@referential), :class => "add" %></li>
+ <li><%= link_to t('stop_areas.actions.default_geometry'), default_geometry_referential_stop_areas_path(@referential), :method => :put %></li>
</ul>
<h3><%= t(".selection") %></h3>
diff --git a/config/locales/stop_areas.yml b/config/locales/stop_areas.yml
index 2aeb158db..2d920435d 100644
--- a/config/locales/stop_areas.yml
+++ b/config/locales/stop_areas.yml
@@ -1,5 +1,6 @@
en:
stop_areas:
+ default_geometry_success: "%{count} modified stop areas"
stop_area:
no_position: No Position
lines: "Lines :"
@@ -12,6 +13,7 @@ en:
add_children: Manage Children
add_routing_lines: "Manage constraint's lines"
add_routing_stops: "Manage constraint's stops"
+ default_geometry: "Compute missing geometries"
new:
title: Add a new stop
edit:
@@ -74,6 +76,7 @@ en:
fr:
stop_areas:
+ default_geometry_success: "%{count} arrêts modifiés"
stop_area:
no_position: Pas de position
lines: "Lignes :"
@@ -86,6 +89,7 @@ fr:
add_children: Gérer les fils
add_routing_lines: "Gérer les lignes de l'ITL"
add_routing_stops: "Gérer les arrêts de l'ITL"
+ default_geometry: "Calculer les géométries manquantes"
new:
title: Ajouter un arrêt
edit:
diff --git a/config/routes.rb b/config/routes.rb
index a5bc53230..de74fa522 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -66,6 +66,9 @@ ChouetteIhm::Application.routes.draw do
get 'add_routing_lines'
get 'add_routing_stops'
end
+ collection do
+ put 'default_geometry'
+ end
end
resources :connection_links do