Extending the Rails Recipies sortable list example to includ

Hi all

I have a site design with 3 sortable lists on the same page. i want to
be able to drag my

  • s between
      s if that makes sense. how can i
      change the example code to do this:

      controller:

      class GroceryListController < ApplicationController
      layout “standard”

      def show
      @grocery_list = GroceryList.find(params[:id])
      end

      def sort
      @grocery_list = GroceryList.find(params[:id])
      @grocery_list.food_items.each do |food_item|
      food_item.position = params[‘grocery-
      list’].index(food_item.id.to_s) + 1
      food_item.save
      end
      render :nothing => true
      end

      end

      view:

      <%= @grocery_list.person.name %>'s Grocery List

      <%= @grocery_list.name %>

        <% @grocery_list.food_items.each do |food_item| %>
      • <%= food_item.quantity %> units of <%= food_item.name %>
      • <% end %>

      <%= sortable_element ‘grocery-list’,
      :url => { :action => “sort”, :id => @grocery_list },
      :complete => visual_effect(:highlight, ‘grocery-list’)
      %>

  • Doesn’t anyone know a tutorial for this?

    Marc

    This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

    | Privacy Policy | Terms of Service | Remote Ruby Jobs