So I have a list of jobs which I show like this. (cleaned up..)
_list.rhtml
<table>
<% for job in @jobs %>
<tr><td><%= job.name %></td></tr>
<% end %>
I want checkboxes next to each and every job name and a button or link
somewhere else on the page to "delete selected", "publish
selected" ,
and "unpublish selected"
I have seen the RailsCast which does this, but it uses REST and I am
not using REST and am confused.
Can anyone help?
I need the data of the checkboxes in the controller. Just not sure how
to get it.
I am pretty sure I want something like this in the view.
<td align="center"><%= check_box_tag "job_ids[]",
job.id %></td>
But don''t know what the form header or submit buttons should look like
to get me the data in the controller.
Reply Reply to author Forward
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---
Hi,
You are right about the checkbox; it should look something like that.
I believe the correct form is:
<%= check_box("job_ids", jod.id) %>
Then you just use an old school form(on top of my head):
<%- form_tag :controller => ''foo'', :action =>
''bar'' do -%>
<%= check_box("job_ids", jod.id) %>
<%= submit_tag("Go")
<%- end -%>
But I might be sadly mistaken. ;)
With kind regards,
Harm
On Jan 18, 10:07 pm, Mark
<mredd...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:> So I have a list of jobs which I show like this. (cleaned up..)
>
> _list.rhtml
> <table>
> <% for job in @jobs %>
>
> <tr><td><%= job.name %></td></tr>
>
> <% end %>
>
> I want checkboxes next to each and every job name and a button or link
> somewhere else on the page to "delete selected", "publish
selected" ,
> and "unpublish selected"
>
> I have seen the RailsCast which does this, but it uses REST and I am
> not using REST and am confused.
>
> Can anyone help?
>
> I need the data of the checkboxes in the controller. Just not sure how
> to get it.
>
> I am pretty sure I want something like this in the view.
> <td align="center"><%= check_box_tag
"job_ids[]", job.id %></td>
>
> But don''t know what the form header or submit buttons should look
like
> to get me the data in the controller.
>
> Reply Reply to author Forward
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---
Yea, not so much. I need to then access the data in the controller. And I want to be able to do different things to the data based on three different (Links or Submit Buttons) On Jan 18, 4:23 pm, harm <harmaa...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hi, > > You are right about the checkbox; it should look something like that. > I believe the correct form is: > <%= check_box("job_ids", jod.id) %> > Then you just use an old school form(on top of my head): > <%- form_tag :controller => ''foo'', :action => ''bar'' do -%> > <%= check_box("job_ids", jod.id) %> > <%= submit_tag("Go") > <%- end -%> > But I might be sadly mistaken. ;) > > With kind regards, > Harm > > On Jan 18, 10:07 pm, Mark <mredd...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > So I have a list of jobs which I show like this. (cleaned up..) > > > _list.rhtml > > <table> > > <% for job in @jobs %> > > > <tr><td><%= job.name %></td></tr> > > > <% end %> > > > I want checkboxes next to each and every job name and a button or link > > somewhere else on the page to "delete selected", "publish selected" , > > and "unpublish selected" > > > I have seen the RailsCast which does this, but it uses REST and I am > > not using REST and am confused. > > > Can anyone help? > > > I need the data of the checkboxes in the controller. Just not sure how > > to get it. > > > I am pretty sure I want something like this in the view. > > <td align="center"><%= check_box_tag "job_ids[]", job.id %></td> > > > But don''t know what the form header or submit buttons should look like > > to get me the data in the controller. > > > Reply Reply to author Forward--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On Jan 19, 10:36 pm, Mark <mredd...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Yea, not so much. > > I need to then access the data in the controller.But you can pull that from the params right? params[:job_ids] is an array of ids.> > And I want to be able to do different things to the data based on > three different (Links or Submit Buttons)In that case you can look at the params[:commit] value.> > On Jan 18, 4:23 pm, harm <harmaa...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > Hi, > > > You are right about the checkbox; it should look something like that. > > I believe the correct form is: > > <%= check_box("job_ids", jod.id) %> > > Then you just use an old school form(on top of my head): > > <%- form_tag :controller => ''foo'', :action => ''bar'' do -%> > > <%= check_box("job_ids", jod.id) %> > > <%= submit_tag("Go") > > <%- end -%> > > But I might be sadly mistaken. ;) > > > With kind regards, > > Harm > > > On Jan 18, 10:07 pm, Mark <mredd...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > So I have a list of jobs which I show like this. (cleaned up..) > > > > _list.rhtml > > > <table> > > > <% for job in @jobs %> > > > > <tr><td><%= job.name %></td></tr> > > > > <% end %> > > > > I want checkboxes next to each and every job name and a button or link > > > somewhere else on the page to "delete selected", "publish selected" , > > > and "unpublish selected" > > > > I have seen the RailsCast which does this, but it uses REST and I am > > > not using REST and am confused. > > > > Can anyone help? > > > > I need the data of the checkboxes in the controller. Just not sure how > > > to get it. > > > > I am pretty sure I want something like this in the view. > > > <td align="center"><%= check_box_tag "job_ids[]", job.id %></td> > > > > But don''t know what the form header or submit buttons should look like > > > to get me the data in the controller. > > > > Reply Reply to author Forward--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Ok.
So I finally got that working.
Parameters: {"commit"=>"delete selected",
"job_ids"=>["1632", "1633",
"1634"], "action"=>"updateselected",
"controller"=>"jobs"}
I can access the Ids no problem from the controller.
Now the only thing I would like to do is make these "links" instead of
"submit buttons" to make the app look a little better.
I want to either have three links [Delete Selected, Publish
Selected, UnPublish Selected]
Or do a Drop down like Gmail does for the actions availble when I
select a bunch of emails.
Can anyone help with that?
Right now all I have in the view is
<%= submit_tag ''delete selected''%>
<%= submit_tag ''publish selected''%>
...
Thanks,
Mark
On Jan 21, 3:29 am, harm
<harmaa...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:> On Jan 19, 10:36 pm, Mark
<mredd...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>
> > Yea, not so much.
>
> > I need to then access the data in the controller.
>
> But you can pull that from the params right? params[:job_ids] is an
> array of ids.
>
>
>
> > And I want to be able to do different things to the data based on
> > three different (Links orSubmitButtons)
>
> In that case you can look at the params[:commit] value.
>
>
>
> > On Jan 18, 4:23 pm, harm
<harmaa...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>
> > > Hi,
>
> > > You are right about the checkbox; it should look something like
that.
> > > I believe the correct form is:
> > > <%= check_box("job_ids", jod.id) %>
> > > Then you just use an old school form(on top of my head):
> > > <%- form_tag :controller => ''foo'',
:action => ''bar'' do -%>
> > > <%= check_box("job_ids", jod.id) %>
> > > <%= submit_tag("Go")
> > > <%- end -%>
> > > But I might be sadly mistaken. ;)
>
> > > With kind regards,
> > > Harm
>
> > > On Jan 18, 10:07 pm, Mark
<mredd...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>
> > > > So I have a list of jobs which I show like this. (cleaned
up..)
>
> > > > _list.rhtml
> > > > <table>
> > > > <% for job in @jobs %>
>
> > > > <tr><td><%= job.name
%></td></tr>
>
> > > > <% end %>
>
> > > > I want checkboxes next to each and every job name and a
button orlink
> > > > somewhere else on the page to "delete selected",
"publish selected" ,
> > > > and "unpublish selected"
>
> > > > I have seen the RailsCast which does this, but it uses REST
and I am
> > > > not using REST and am confused.
>
> > > > Can anyone help?
>
> > > > I need the data of the checkboxes in the controller. Just
not sure how
> > > > to get it.
>
> > > > I am pretty sure I want something like this in the view.
> > > > <td align="center"><%= check_box_tag
"job_ids[]", job.id %></td>
>
> > > > But don''t know what the form header orsubmitbuttons
should look like
> > > > to get me the data in the controller.
>
> > > > Reply Reply to author Forward
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---