nofxx-formtastic 0.1.7 → 0.1.8
Sign up to get free protection for your applications and to get access to all the features.
- data/README.textile +1 -9
- data/lib/formtastic.rb +3 -3
- metadata +1 -1
data/README.textile
CHANGED
@@ -4,7 +4,7 @@ Formtastic is a Rails FormBuilder DSL (with some other goodies) to make it far e
|
|
4
4
|
|
5
5
|
h2. Warning
|
6
6
|
|
7
|
-
This fork adds jQuery only add/remove nested partial.
|
7
|
+
This fork adds a jQuery only add/remove nested partial.
|
8
8
|
|
9
9
|
h2. The Story
|
10
10
|
|
@@ -99,14 +99,6 @@ If you're a little more old school, install it as a plugin:
|
|
99
99
|
./script/plugin install git://github.com/justinfrench/formtastic.git
|
100
100
|
</pre>
|
101
101
|
|
102
|
-
h3. jQuery
|
103
|
-
|
104
|
-
To use the cliente side add/remove partial, make sure you got:
|
105
|
-
|
106
|
-
* "jquery.template":http://stanlemon.net/projects/jquery-templates.html
|
107
|
-
|
108
|
-
Avaiable on the DOM.
|
109
|
-
|
110
102
|
h2. Usage
|
111
103
|
|
112
104
|
Forms are really boring to code... you want to get onto the good stuff as fast as possible.
|
data/lib/formtastic.rb
CHANGED
@@ -355,8 +355,8 @@ module Formtastic #:nodoc:
|
|
355
355
|
form.gsub!(/\[(\d+)\]/, '__idxx__')
|
356
356
|
|
357
357
|
function = "if (typeof #{variable} == 'undefined') #{variable} = #{$1};
|
358
|
-
$(#{container}).append(
|
359
|
-
#{variable}).replace(/__idxx__/g,
|
358
|
+
$(#{container}).append(#{form.to_json}.replace(/__idx__/g, 'attributes_' +
|
359
|
+
#{variable}).replace(/__idxx__/g, '[' + #{variable}++ + ']'))"
|
360
360
|
|
361
361
|
template.link_to_function(name, function, opts)
|
362
362
|
end
|
@@ -375,7 +375,7 @@ module Formtastic #:nodoc:
|
|
375
375
|
|
376
376
|
output = associated.map do |element|
|
377
377
|
fields_for(association_name(name), element, (opts[:fields_for] || {}).merge(:name => name)) do |f|
|
378
|
-
render({:partial => "#{partial}", :locals => {local_assign_name.to_sym => element, :f => f}.merge(opts[:locals] || {})}.merge(opts[:render] || {}))
|
378
|
+
template.render({:partial => "#{partial}", :locals => {local_assign_name.to_sym => element, :f => f}.merge(opts[:locals] || {})}.merge(opts[:render] || {}))
|
379
379
|
end
|
380
380
|
end
|
381
381
|
output.join
|