[Cmsplugin-users] hello and question about sortable_list

David Tapiador del Dujo david.tapiador at gnoxys.net
Thu Sep 4 05:05:08 EDT 2008


First at all, hello! that is my first email! :D

I just use the last version of cms_plugin for a managment aplication in a 
Rails 2.1.0. environment

My question is a about sortable_list and if it is possible to arrange in it 
differents field more dinamically... 

I mean... i have to views that need a sortable list about the model 
MacrosAction. One, is the own list in index action, but other go inside of an 
other show action that belongs to the Macro model, those has_many: 
macros_actions.

The second list should render differents fields than the first. For example, 
i'm not interested in know who is the macro owner of this macro_action in the 
second case, but yes in one.

Maybe one choice is to create a new option in sortable_list in which you can 
set which act_as_sortable list are you chosing, por example:

#
class MacrosAction < ActiveRecord::Base

  acts_as_sortable :columns => [ { :name => "My MacroAction Name",
                                   :content => proc { |helper, macros_action| 
                                      macros_action.name }},
                                  :created_at ],
		   :list_name => "index"

  acts_as_sortable :columns => [ { :name => "My *Macro* Name",
                                   :content => proc { |helper, macros_action| 
                                      macros_action.macro.name }},
                                  :created_at ],
		   :list_name => "inside_macro"
end

Then, in view, it can be rendered as:

#
    <%= sortable_list @macros_actions, MacroAction, :append => "&q=#{ 
params[:q]}", :list => "index"%>

or just in second context.

#
    <%= sortable_list @macros_actions, MacroAction, :append => "&q=#{ 
params[:q]}", :list => "inside_macro" %>


It is only a suggestion, maybe it can be done by other way...

Ciao!
-- 
David Tapiador del Dujo
-----------------------------------------------
Gnoxys, Desarrollo y Sistemas de Software Libre

Tlf. Movil: 653 92 53 38
david.tapiador at gnoxys.net
http://www.gnoxys.net
-----------------------------------------------


More information about the Cmsplugin-users mailing list