[Nitro] Fwd: [ nitro-Bugs-3556 ] part/admin does not respond well to array controls

Bryan Soto bryan.a.soto at gmail.com
Wed Feb 15 16:28:08 EST 2006


Not quite an RSS feed. :/

zimbu, Chris, what do you think? I believe you guys did some work on the
controls?

bryan

---------- Forwarded message ----------
From: noreply at rubyforge.org <noreply at rubyforge.org>
Date: Feb 13, 2006 5:02 PM
Subject: [ nitro-Bugs-3556 ] part/admin does not respond well to array
controls
To: noreply at rubyforge.org

Bugs item #3556, was opened at 2006-02-13 20:02
You can respond by visiting:
http://rubyforge.org/tracker/?func=detail&atid=1670&aid=3556&group_id=418

Category: Nitro
Group: None
Status: Open
Resolution: None
Priority: 3
Submitted By: Nobody (None)
Assigned to: Nobody (None)
Summary: part/admin does not respond well to array controls

Initial Comment:
Steps to reproduce:

1. Create a model which has an Array property
2. Require 'nitro', 'og' and 'part/admin'
3. Start your web server
4. Go to the /admin and click on your model
5. Try to create a new instance of your model class, and you should get this
error:

undefined local variable or method `emit_container_start' for
#<Nitro::ArrayControl:0x1698b38>

/usr/local/lib/ruby/gems/1.8/gems/nitro-0.28.0/lib/nitro/helper/form/controls.rb:170:in
`render'


Patch to fix might be (someone needs to sanity check)

--- /usr/local/lib/ruby/gems/1.8/gems/nitro-0.28.0/lib/nitro/helper/form/controls.rb
   2006-02-14
11:55:21.000000000 +1100
+++ -   2006-02-14 12:05:57.000000000 +1100
@@ -192,6 +192,14 @@
     }
   end

+  def emit_container_start
+    %{<div class="array_container">}
+  end
+
+  def emit_container_end
+    %{</div>}
+  end
+
   def emit_js
     %{
       <script type="text/javascript">
@@ -218,7 +218,7 @@
           node.getElementsByTagName
('input')[0].removeAttribute('disabled');
           if(container.lastChild==ctl) container.appendChild(node);
           else container.insertBefore(node, ctl.nextSibling);
-          if(container.childNodes.length>1) container.getElementsByTagName
('input')[0].disabled='';
+          if(container.childNodes.length>1) container.getElementsByTagName
('input')[1].disabled='';
         }
       </script>
     }

The second part of the patch is because the remove array element button
didn't activate due to the off by one error.


----------------------------------------------------------------------

You can respond by visiting:
http://rubyforge.org/tracker/?func=detail&atid=1670&aid=3556&group_id=418
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/nitro-general/attachments/20060215/4a484487/attachment.html 


More information about the Nitro-general mailing list