aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarc Florisson2014-03-28 23:58:27 +0100
committerMarc Florisson2014-03-28 23:58:27 +0100
commitcb8083bfaab30ad168e3ace50ab77b30f78754fe (patch)
treedabf5aa75da3ab159853244ddd88587dcfe83d69
parent35d2cb037f8f917136a6d2b89e92638e0383505a (diff)
downloadchouette-core-cb8083bfaab30ad168e3ace50ab77b30f78754fe.tar.bz2
use cocoon for stop_point
-rw-r--r--app/views/routes/_form.html.erb16
-rw-r--r--app/views/routes/_stop_point_fields.html.erb9
-rw-r--r--app/views/stop_points/new.html.erb5
3 files changed, 27 insertions, 3 deletions
diff --git a/app/views/routes/_form.html.erb b/app/views/routes/_form.html.erb
index ddabcc528..152fe6d97 100644
--- a/app/views/routes/_form.html.erb
+++ b/app/views/routes/_form.html.erb
@@ -1,14 +1,24 @@
<%= semantic_form_for [@referential, @line, @route] do |form| %>
- <%= form.inputs do %>
+ <%= form.inputs do %>
<%= form.input :name %>
<%= form.input :published_name %>
<%= form.input :number %>
- <%= form.input :comment %>
+ <%= form.input :comment %>
<%= form.input :opposite_route, :as => :select, :collection => @line.routes.select { |r| r.id != @route.id } %>
<%= form.input :direction_code, :as => :select, :collection => Chouette::Route.directions, :include_blank => false, :member_label => Proc.new { |mode| t("directions.label.#{mode}") } %>
<%= form.input :wayback_code, :as => :select, :collection => Chouette::Route.waybacks, :include_blank => false, :member_label => Proc.new { |mode| t("waybacks.label.#{mode}") } %>
- <%= form.input :objectid, :required => !@route.new_record?, :input_html => { :disabled => !@route.new_record? } %>
+ <%= form.input :objectid, :required => !@route.new_record?, :input_html => { :disabled => !@route.new_record? } %>
<% end %>
+ <div class="stop_points content" >
+ <div id="stop_points">
+ <%= form.semantic_fields_for :stop_points do |p| %>
+ <%= render "stop_point_fields", :f => p %>
+ <% end %>
+ </div>
+ <%= link_to_add_association t("routes.actions.add_stop_point"), form, :stop_points ,
+ :"data-association-insertion-method" => "append",
+ :"data-association-insertion-node" => "div#stop_points"%>
+ </div>
<%= form.actions do %>
<%= form.action :submit, :as => :button %>
diff --git a/app/views/routes/_stop_point_fields.html.erb b/app/views/routes/_stop_point_fields.html.erb
new file mode 100644
index 000000000..af388bc47
--- /dev/null
+++ b/app/views/routes/_stop_point_fields.html.erb
@@ -0,0 +1,9 @@
+<%= f.inputs :class => 'stop_points nested-fields' do %>
+ <%= f.input :stop_area_id, :as => :hidden %>
+ <% if f.object.stop_area.nil? %>
+ <p>nouveau formulaire</p>
+ <% else %>
+ <%= f.object.stop_area.name %>
+ <% end %>
+ <%= link_to_remove_association t('actions.destroy'), f %>
+<% end %>
diff --git a/app/views/stop_points/new.html.erb b/app/views/stop_points/new.html.erb
index 14eba5bcc..ee2495ee0 100644
--- a/app/views/stop_points/new.html.erb
+++ b/app/views/stop_points/new.html.erb
@@ -1,5 +1,10 @@
<%= title_tag t('.title', :route => @route.name) %>
+<ul>
+ <% @route.stop_areas.last(3).each do |stop_area| %>
+ <li><%= stop_area.parent.name %></li>
+ <% end %>
+</ul>
<%= semantic_form_for [@referential, @line, @route, @stop_point] do |form| %>
<div>
<%= form.inputs do %>