diff options
| -rw-r--r-- | Gemfile | 4 | ||||
| -rw-r--r-- | Gemfile.lock | 5 | ||||
| -rw-r--r-- | app/views/lines/_form.erb | 28 | ||||
| -rw-r--r-- | app/views/vehicle_journeys/_form.html.erb | 2 | ||||
| -rw-r--r-- | db/schema.rb | 15 |
5 files changed, 40 insertions, 14 deletions
@@ -76,8 +76,8 @@ gem 'google-analytics-rails' gem 'will_paginate', '~> 3.0' gem 'ransack' gem 'squeel' -gem 'ninoxe', :git => 'https://github.com/afimb/ninoxe.git' -#gem 'ninoxe',:path => '~/workspace/chouette/ninoxe' +gem 'ninoxe', :git => 'https://github.com/afimb/ninoxe.git', :branch => 'footnotes' +#gem 'ninoxe',:path => '~/dev/ninoxe_footnotes' #gem 'ninoxe', '~> 1.1.3' gem 'acts_as_list', '0.1.6' diff --git a/Gemfile.lock b/Gemfile.lock index 6925e223d..aacd25631 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,8 +1,9 @@ GIT remote: https://github.com/afimb/ninoxe.git - revision: 95471a42daa8a0183f94b1f3beac9242033ed236 + revision: b612664e38a1c1e778d19875a9975c98e468e106 + branch: footnotes specs: - ninoxe (1.1.3) + ninoxe (1.1.4) activerecord (~> 3.2.13) acts-as-taggable-on (>= 3) acts_as_list (>= 0.1.6) diff --git a/app/views/lines/_form.erb b/app/views/lines/_form.erb index 0e393ac53..1ef94e02f 100644 --- a/app/views/lines/_form.erb +++ b/app/views/lines/_form.erb @@ -1,11 +1,11 @@ <!-- <%= @line.errors.inspect %> --> <%= semantic_form_for [@referential, @line] do |form| %> - <%= form.inputs do %> - <%= form.input :network, :as => :select, :collection => Chouette::Network.all, :include_blank => false %> + <%= form.inputs do %> + <%= form.input :network, :as => :select, :collection => Chouette::Network.all, :include_blank => false %> <%= form.input :company, :as => :select, :collection => Chouette::Company.all, :include_blank => false%> <%= form.input :name %> <%= form.input :published_name %> - <%= form.input :registration_number, :input_html => { :title => t("formtastic.titles.line.registration_number")} %> + <%= form.input :registration_number, :input_html => { :title => t("formtastic.titles.line.registration_number")} %> <%= form.input :number %> <%= form.input :transport_mode, :as => :select, :collection => Chouette::Line.transport_modes, :include_blank => false, :member_label => Proc.new { |mode| t("transport_modes.label.#{mode}") } %> <%= form.input :color, :as => :string %> @@ -13,24 +13,34 @@ <%= form.input :url %> <%= form.input :mobility_restricted_suitability, :as => :select, :collection => [[@line.human_attribute_name("accessible"), true], [@line.human_attribute_name("not_accessible"), false]], :include_blank => true %> <%= form.input :flexible_service, :as => :select, :collection => [[@line.human_attribute_name("on_demaond_fs"), true], [@line.human_attribute_name("regular_fs"), false]], :include_blank => true %> - <%= form.input :comment %> - <%= form.input :objectid, :required => !@line.new_record?, :input_html => { :title => t("formtastic.titles.line.objectid")} %> + <%= form.input :comment %> + <%= form.input :objectid, :required => !@line.new_record?, :input_html => { :title => t("formtastic.titles.line.objectid")} %> <% end %> - <%= form.inputs do %> + <%= form.inputs do %> <%= form.input :group_of_line_tokens, :label => t('.group_of_lines'), :as => :text, :input_html => { :"data-pre" => ( @line.group_of_lines.map { |group_of_line| { :id => group_of_line.id, :name => group_of_line.name } } ).to_json } %> + + <div id="footnotes"> + <%= form.semantic_fields_for :footnotes do |f| %> + <%= render "footnotes/footnote_fields", :f => f %> + <% end %> + </div> + <%= link_to_add_association t("footnotes.actions.add_footnote"), form, :footnotes , + :partial => "footnotes/footnote_fields", + :"data-association-insertion-method" => "append", + :"data-association-insertion-node" => "div#footnotes"%> <% end %> <%= form.actions do %> - <%= form.action :submit, :as => :button %> + <%= form.action :submit, :as => :button %> <%= form.action :cancel, :as => :link %> <% end %> <% end %> <script> $(function() { - $( "#line_group_of_line_tokens" ).tokenInput('<%= name_filter_referential_group_of_lines_path(@referential, :format => :json) %>', { - crossDomain: false, + $( "#line_group_of_line_tokens" ).tokenInput('<%= name_filter_referential_group_of_lines_path(@referential, :format => :json) %>', { + crossDomain: false, prePopulate: $('#group_of_line_tokens').data('pre'), minChars: 3, preventDuplicates: true, diff --git a/app/views/vehicle_journeys/_form.html.erb b/app/views/vehicle_journeys/_form.html.erb index 5322f3eb4..3acc22950 100644 --- a/app/views/vehicle_journeys/_form.html.erb +++ b/app/views/vehicle_journeys/_form.html.erb @@ -52,6 +52,8 @@ </tbody> </table> + <%= form.input :footnote_ids, :label => "mon label", :as => :check_boxes, :collection => @line.footnotes.map { |f| [ "#{f.code} #{f.label}", f.id.to_s]} %> + <% end %> <%= form.actions do %> diff --git a/db/schema.rb b/db/schema.rb index ab6b71378..40f04d44f 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 20141216085004) do +ActiveRecord::Schema.define(:version => 20150120183020) do create_table "access_links", :force => true do |t| t.integer "access_point_id", :limit => 8 @@ -217,6 +217,19 @@ ActiveRecord::Schema.define(:version => 20141216085004) do t.integer "choice_code" end + create_table "footnotes", :force => true do |t| + t.integer "line_id", :limit => 8 + t.string "code" + t.string "label" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "footnotes_vehicle_journeys", :id => false, :force => true do |t| + t.integer "vehicle_journey_id", :limit => 8 + t.integer "footnote_id", :limit => 8 + end + create_table "group_of_lines", :force => true do |t| t.string "objectid", :null => false t.integer "object_version" |
