On 07/29/2011 03:19 PM, Chris Lalancette wrote:
On 07/29/11 - 01:19:26PM, Tomas Sedovic wrote:
> On 07/29/2011 12:27 PM, Chris Lalancette wrote:
>> All,
>> Taking a quick look around the code, it doesn't seem like we need the
>> rack-restful_submit gem anymore. Is that true? If so, I would like to remove
>> it from the Gemfile and the specfile, but I wanted to make sure I wasn't
>> missing anything before doing that.
>>
>> Thanks,
>
> Hey Cris,
>
> The scenario for restful_submit is this: you have a list of stuff with
> checkboxes. You can select multiple items and run several actions on all
> of them at once.
>
> Example:
>
> We give you a list of deployments and you'd like to select 4 of them
> that are running and stop them. Or select the 5 that are down and
> restart them. Or delete them.
>
> Or like the Gmail interface.
>
> Once we have more than one such action (stop/restart/delete/whatever),
> we need restful_submit if we want it to work with JavaScript disabled
> (which we do).
>
> Currently, we don't have that situation in the UI, so we could remove it
> now and put it back once that need arises.
>
> However, we do use the `restful_submit_tag` helper in our views, so
> ditching the gem would mean rewriting the forms to use regular submit
> instead.
Right, thanks for the explanation. There is still something I don't
understand, though. If you look in (say)
src/app/views/pool_families/_list.haml, you do indeed see a reference to
restful_submit_tag. But then if you look in
src/app/helpers/application_helper.rb, you'll see that restful_submit_tag is
defined in there.
So it would seem to me that we already have that functionality in our codebase,
and we don't need the external gem. What am I missing?
It's a bit more complicated.
All the helper does is add some hidden params to the "restful action
buttons" in our views/generated html.
The restful_submit gem provides a Rack middleware that translates these
params to appropriate controller actions.
It's very similar to using `_method="put"` in an HTML form and have
Rails understand that as a HTTP PUT request.
If we drop the gem but keep Conductor untouched, there will be no
errors, but the restful_submit_buttons will not behave correctly.
Thomas
--
No trees were killed to send this message, but a large number of
electrons were terribly inconvenienced.