RailsCasts Pro episodes are now free!

Learn more or hide this

David Van Der Beek's Profile

GitHub User: dvanderbeek

Comments by David Van Der Beek

Avatar

Does anyone know how to get a background image working when following this methodology? I tried setting it in the controller and in the PDF class where the margins get set. The only thing I can get to work is adding an image the full size of the page, but if I try to repeat that using Prawn's repeat method, the image covers up all the content on the pages. I can't add the image manually one page at a time because the length of the content determines how many pages there are.

Avatar

This is what I came up with that seems to work:

_task.html.erb:

<%= formfor task do |f| %>
<%= f.check_box :complete, id: "task_complete
#{task.id}" %>
<%= f.submit "Update" %>
<%= f.label "complete_#{task.id}", task.name %>
<%= link_to "(remove)", task, method: :delete, data: {confirm: "Are you sure?"}, remote: true %>
<% end %>

Avatar

Is there an issue in _task.html.erb where clicking on the label element for each task checks/un-checks the completed box for the first task in the list, or did I miss something?

What's the best way to assign a unique name to the checkboxes for each task?

Avatar

I'm having trouble with a slightly more advanced version of this where I'm trying to use connected sortable lists and sort things between lists. I have a few models (Page, Row, Column, Block) and want to let users drag blocks between columns. The tricky part that I can't figure out is the best way to delete a column/row if it no longer has blocks after sorting. Can anyone help? I posted the question in more detail on stackoverflow here http://stackoverflow.com/questions/10500994/rails-sort-connected-lists-and-delete-empty-parent