diff options
| author | Marc Florisson | 2014-05-23 16:08:45 +0200 |
|---|---|---|
| committer | Marc Florisson | 2014-05-23 16:08:45 +0200 |
| commit | 4a2cceba7c996479c1d07b90f2a6738b24bfe997 (patch) | |
| tree | dbe4c558685781ef30c0eb832fb8bd76cf8ad0b8 | |
| parent | 892b77d62545bfed21df31cda9a82d9f81463af5 (diff) | |
| download | chouette-core-4a2cceba7c996479c1d07b90f2a6738b24bfe997.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"} %> |
