Jacques,
Any word on whether this patch was accepted? Do we need to make more noise?
:-)

..tony..

On Wed, Jan 28, 2009 at 9:56 PM, Jacques Crocker <[email protected]> wrote:

>
> I worked with Tony to get Cult Hero's patch spec'ed and available
> easily from an up to date fork of 1.0.x. Patch seems to be working
> great, and ready to be reviewed and merged in:
> https://github.com/merbjedi/merb/commits/1.0.x
>
> We also made a fix for the radio_button helper which needed a :checked
> option in order to turn it on or off by default. Here is a ticket to
> the lighthouse bug on it that includes the patch
> http://merb.lighthouseapp.com/projects/7433-merb/tickets/1209
>
> Feedback welcome. Please let us know about any other issues with merb-
> helpers and we can work together to get things fixed up and stable.
>
> Thanks
>
> On Jan 28, 3:23 pm, Jacques Crocker <[email protected]> wrote:
> > They definitely are crucial to repair. So lets fix them.
> >
> > I'll put some time in tonight to take a look and provide some
> > assistance in getting the check_box form helpers spec'ed up and
> > functional. Hopefully we can get it fixed and merged into the next
> > 1.0.x release.
> >
> > View helpers on Merb are great, but they do seem to have a few gaps. I
> > usually work around the issues I've found (including the checkbox one)
> > by just going back to manually generating the html (input fields). But
> > it's much better if we focus on providing a fix for everyone by
> > patching the framework.
> >
> > On Jan 28, 2:47 pm, Tony Mann <[email protected]> wrote:
> >
> > > While I am thinking about this, it seems like there is not an effective
> test
> > > suite for checking these helpers, since they remain broken from release
> to
> > > release. Is this the case? Are so few people using form helpers that
> these
> > > bugs are not crucial to repair?
> > > ..tony..
> >
> > > On Wed, Jan 28, 2009 at 2:45 PM, Tony Mann <[email protected]>
> wrote:
> > > > Another issue that needs a patch is that the :checked attribute does
> not
> > > > work in radio_button. This is referenced here:
> >
> > > >
> http://merb.lighthouseapp.com/projects/7433/tickets/1131-radio_group-...
> >
> > > > It can be monkey_patched around as follows:
> >
> > > > module Merb::Helpers::Form::Builder
> > > >     class Base
> > > >       def considered_true?(value)
> > > >         value && value != "false" && value != "0" && value != 0
> > > >       end
> >
> > > >       def update_unbound_controls(attrs, type)
> > > >         case type
> > > >         when "checkbox"
> > > >           update_unbound_check_box(attrs)
> > > >         when "file"
> > > >           @multipart = true
> > > >         end
> >
> > > >         attrs[:disabled] ? attrs[:disabled] = "disabled" :
> > > > attrs.delete(:disabled)
> > > >         attrs[:checked]  ? attrs[:checked]  = "checked"  :
> > > > attrs.delete(:checked)
> > > >       end
> > > >     end
> > > >   end
> >
> > > > Do you think I need to file a new bug for this? My patch above is not
> > > > perfect, since it overlaps the handling for checkboxes, so I would
> need to
> > > > tweak it a bit before submitting it.
> >
> > > > ..tony..
> >
> > > > On Wed, Jan 28, 2009 at 2:34 PM, Roy Wright <[email protected]>
> wrote:
> >
> > > >> +1
> >
> > > >> It would be nice not to have to manually patch this every release...
> >
> > > >> TIA,
> > > >> Roy
> >
> > > >> On Jan 28, 2009, at 3:18 PM, Jacques Crocker wrote:
> >
> > > >> > +1
> >
> > > >> > Patch looks good. Very simple check for "false", but its needed
> for
> > > >> > checkboxes to work correctly. Might be useful to throw in a few
> specs
> > > >> > for it (should be simple).
> >
> > > >> > May be that Yehuda didn't see it (it wasn't assigned to anyone). I
> > > >> > went ahead and fixed that on lighthouse
> >
> > > >> > Please merge this patch into 1.0.8.2 if possible.
> >
> > > >> > On Jan 28, 12:25 pm, Tony Mann <[email protected]> wrote:
> > > >> >> Well, we are not making enough noise, since bound checkboxes
> > > >> >> *still* do not
> > > >> >> work in 1.0.8.1. What will it take to get this patch in?
> > > >> >> ..tony..
> >
> > > >> >> On Sat, Jan 10, 2009 at 6:53 AM, Ted Han <[email protected]>
> wrote:
> >
> > > >> >>> It was probably overlooked :\
> >
> > > >> >>> Let's see about making enough noise to get it included... :)
> >
> > > >> >>> -knowtheory
> >
> > > >> >>> On Wed, Jan 7, 2009 at 3:50 PM, phatmann <[email protected]
> >
> > > >> >>> wrote:
> >
> > > >> >>>> I see that this patch did not make it into 1.0.6 nor 1.0.7. Any
> > > >> >>>> idea
> > > >> >>>> why? As is, bound check_boxes and radio_buttons are essentially
> > > >> >>>> broken.
> >
> > > >> >>>> ..tony..
> >
> > > >> >>>> On Dec 17 2008, 7:11 pm, cult hero <[email protected]>
> wrote:
> > > >> >>>>> I submitted the patch successfully:
> >
> > > >>
> http://merb.lighthouseapp.com/projects/7433-merb/tickets/1138-patch-f
> > > >> >>>>> .
> > > >> >>> ..
> >
> > > >> >>>>> On Dec 17, 6:43 pm, cult hero <[email protected]>
> wrote:
> >
> > > >> >>>>>> I've figured out what's causing the problem with checkboxes.
> It
> > > >> >>>>>> appears to be unrelated to the select and radio problems.
> (I'll
> > > >> >>>>>> look
> > > >> >>>>>> into that later since I'm playing with the form stuff now
> > > >> >>>>>> anyway.) In
> > > >> >>>>>> the meantime, here's the problem:
> >
> > > >> >>>>>> File: merb-helpers/lib/merb-helpers/form/builders.rb
> >
> > > >> >>>>>> def considered_true?(value)
> > > >> >>>>>>   value && value != "0" && value != 0
> > > >> >>>>>> end
> >
> > > >> >>>>>> I noticed considered_true? was returning true when it didn't
> > > >> >>>>>> seem like
> > > >> >>>>>> it should. I checked the value of "value" being fed to
> > > >> >>>>>> considered_true? by update_bound_check_box and it was "false"
> > > >> >>>>>> when it
> > > >> >>>>>> should have been. So it appeared that considered_true?(false)
> was
> > > >> >>>>>> returning true, which made no sense. However, looking further
> I
> > > >> >>>>>> got
> > > >> >>>>>> this output:
> >
> > > >> >>>>>> value: false
> > > >> >>>>>> value.class: String
> > > >> >>>>>> value && value != "0" && value != 0: true
> > > >> >>>>>> value != "0": true
> > > >> >>>>>> value != 0: true
> >
> > > >> >>>>>> I presumed "value" was a boolean false. Turns out, it's a
> > > >> >>>>>> String with
> > > >> >>>>>> the value "false."
> >
> > > >> >>>>>> So, one possible solution is:
> >
> > > >> >>>>>> def considered_true?(value)
> > > >> >>>>>>   value && value != "false" && value != "0" && value != 0
> > > >> >>>>>> end
> >
> > > >> >>>>>> This works fine for me. However, what I don't know is whether
> > > >> >>>>>> value,
> > > >> >>>>>> which is retrieved from "val = control_value(method)" is
> > > >> >>>>>> supposed to
> > > >> >>>>>> be "false" (String) or false (FalseClass). Looking at
> > > >> >>>>>> control_value it
> > > >> >>>>>> appears to deliberately return a string. From what I can
> tell,
> > > >> >>>>>> the
> > > >> >>>>>> above solution works though since considered_true? is only
> called
> > > >> >>>>>> inside update_bound_check_box, so it wouldn't affect a text
> > > >> >>>>>> field with
> > > >> >>>>>> the value "false" in any weird manner.
> >
> > > >> >>>>>> I've never submitted a patch before, but I found a guide on
> > > >> >>>>>> using git
> > > >> >>>>>> and I'm going to try in just a few minutes. I'm pretty new to
> > > >> >>>>>> this
> > > >> >>>>>> whole git thing!
> >
> > > >> >>>>>> On Dec 17, 8:41 am, cult hero <[email protected]>
> wrote:
> >
> > > >> >>>>>>> I hope it's a bug. I'll feel better about my own skill level
> > > >> >>>>>>> if it
> > > >> >>> is!
> >
> > > >> >>>>>>> I try and limit the number of questions I ask around here in
> a
> > > >> >>>>>>> day
> > > >> >>> and
> > > >> >>>>>>> I'd already hit my quota just before I noticed this problem
> last
> > > >> >>>>>>> night. I'm hesitant to start filing any bug reports until I
> > > >> >>>>>>> get some
> > > >> >>>>>>> level of confirmation here or have a higher level of
> > > >> >>>>>>> competence with
> > > >> >>>>>>> Merb.
> >
> > > >> >>>>>>> On Dec 17, 12:14 am, "Yehuda Katz" <[email protected]>
> wrote:
> >
> > > >> >>>>>>>> This potentially sounds like a bug. I'll try and take a
> look
> > > >> >>>>>>>> at it
> > > >> >>> in the
> > > >> >>>>>>>> morning when I get in to work. Someone else reported a
> similar
> > > >> >>> issue with
> > > >> >>>>>>>> radio_group to me this morning so I wonder if there's
> something
> > > >> >>> I'm missing
> > > >> >>>>>>>> here.
> > > >> >>>>>>>> -- Yehuda
> >
> > > >> >>>>>>>> On Tue, Dec 16, 2008 at 10:55 PM, cult hero <
> > > >> >>> [email protected]> wrote:
> >
> > > >> >>>>>>>>> I started making my first forms today and things seem
> smooth
> > > >> >>> except...
> >
> > > >> >>>>>>>>> The check_box field makes no sense to me at all. Here is
> the
> > > >> >>> code it
> > > >> >>>>>>>>> produces:
> >
> > > >> >>>>>>>>> <input type="hidden" class="hidden"
> name="person[is_active]"
> > > >> >>> value="0"/
> > > >> >>>>>>>>>> <input type="checkbox" class="checkbox"
> > > >> >>> name="person[is_active]"
> > > >> >>>>>>>>> value="1" checked="checked" id="person_is_active"/><label
> > > >> >>>>>>>>> for="person_is_active">Is name?: </label>
> >
> > > >> >>>>>>>>> That does make sense. The trouble is, no matter what the
> value
> > > >> >>> of
> > > >> >>>>>>>>> "is_active" is for @person, the box is ALWAYS checked. I
> even
> > > >> >>> tried
> > > >> >>>>>>>>> adding :boolean => @person.is_active to see if that would
> do
> > > >> >>>>>>>>> it,
> > > >> >>> but
> > > >> >>>>>>>>> it's still checked. It works when the checkbox isn't bound
> > > >> >>>>>>>>> to a
> > > >> >>> model,
> > > >> >>>>>>>>> but when it is I get this problem. To make sure I wasn't
> > > >> >>>>>>>>> crazy I
> > > >> >>> even
> > > >> >>>>>>>>> have the value of @person.is_active display at the top of
> the
> > > >> >>> form.
> > > >> >>>>>>>>> True or false, the checkbox is always checked.
> >
> > > >> >>>>>>>>> Is this a bug or am I just missing something ridiculously
> > > >> >>> simple?
> >
> > > >> >>>>>>>> --
> > > >> >>>>>>>> Yehuda Katz
> > > >> >>>>>>>> Developer | Engine Yard
> > > >> >>>>>>>> (ph) 718.877.1325
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"merb" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [email protected]
For more options, visit this group at http://groups.google.com/group/merb?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to