_updateFields js should start with first list item position of 1, not 0 #1

Open
aepstein wants to merge 16 commits from aepstein/patch-1 into master
4 changed files with 31 additions and 3 deletions
Showing only changes of commit 78b54a1002 - Show all commits

View File

@ -16,4 +16,4 @@ end
# To use debugger (ruby-debug for Ruby 1.8.7+, ruby-debug19 for Ruby 1.9.2+)
# gem 'ruby-debug'
# gem 'ruby-debug19'
# gem 'ruby-debug19'

View File

@ -39,4 +39,4 @@ begin
Jeweler::GemcutterTasks.new
rescue LoadError
puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
end
end

View File

@ -10,7 +10,11 @@ module Cocoon
# configure our plugin on boot
initializer "cocoon.initialize" do |app|
ActionView::Base.send :include, Cocoon::ViewHelpers
if Object.const_defined?("Formtastic") and Formtastic.const_defined?("Inputs")
require 'cocoon/formtastic/cocoon_input'
end
end
end
end
end

View File

@ -0,0 +1,24 @@
require 'formtastic'
class CocoonInput
include ::Formtastic::Inputs::Base
def to_html
output = []
output << label_html
output << builder.semantic_fields_for(method) do |fields|
if fields.object
template.render :partial => "#{method.to_s.singularize}_fields", :locals => { :f => fields }
end
end
output << template.content_tag(:div, :class => 'links') do
template.link_to_add_association template.t('.add'), builder, method
end
template.content_tag(:li, output.join('').html_safe, :class => 'input cocoon')
end
end