diff options
| author | Marc Florisson | 2014-05-23 16:08:45 +0200 |
|---|---|---|
| committer | Michel Etienne | 2014-06-24 08:18:51 +0200 |
| commit | 627bce16a180aeaa955635b2bcd60ff242fb0b36 (patch) | |
| tree | 8b11ed666e0c70f8b097135da4f8fe9088a2edbb | |
| parent | ac4a70b85680a59cc2298f542ac429e2504edddf (diff) | |
| download | chouette-core-627bce16a180aeaa955635b2bcd60ff242fb0b36.tar.bz2 | |
fix stop_point insertion on route#edit, enhance error page
| -rw-r--r-- | app/views/routes/_stop_point_fields.html.erb | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/app/views/routes/_stop_point_fields.html.erb b/app/views/routes/_stop_point_fields.html.erb index 72790b519..bc9d4e8db 100644 --- a/app/views/routes/_stop_point_fields.html.erb +++ b/app/views/routes/_stop_point_fields.html.erb @@ -2,11 +2,12 @@ <%= f.inputs do %> <%= link_to_remove_association "<i class='fa fa-trash-o'></i>".html_safe, f %> <span class="handle" alt="<%= t('stop_points.index.move') %>" title="<%= t('stop_points.index.move') %>" ><i class='fa fa-arrows'></i></span> - <% if f.object.stop_area.nil? %> + <% if f.object.stop_area.nil? || f.object.new_record? %> <%= f.input :id, :as => :hidden, :input_html => { :class => "stop_point_id added_stop_point", :value => "" } %> <%= f.input :position, :as => :hidden, :input_html => { :class => "position" } %> - <%= f.input :stop_area_id, :label => false, :input_html => { :class => "new_stop_point stop_area_id", :"data-pre" => [].to_json } %> - <% else %> + <% data_pre = (f.object.stop_area.nil?) ? [] : [ :id => f.object.stop_area.id, :name => "#{f.object.stop_area.name} #{f.object.stop_area.country_code}" ] %> + <%= f.input :stop_area_id, :label => false, :input_html => { :class => "new_stop_point stop_area_id", :"data-pre" => data_pre.to_json } %> + <% else %> <%= f.input :id, :as => :hidden, :input_html => { :class => "stop_point_id" } %> <%= f.input :position, :as => :hidden, :input_html => { :class => "position" } %> <%= f.input :stop_area_id, :as => :hidden, :input_html => { :class => "stop_area_id"} %> |
