aa_acts_as_list in trunk

4 views
Skip to first unread message

Antonio Bardazzi Multicore-Sistemi.com

unread,
Oct 5, 2007, 11:00:47 AM10/5/07
to ActiveScaffold : Ruby on Rails plugin
A modification to aa_acts_as_list to work in as trunk in
active_scaffold_acts_as_list/lib/config/
core.rb

line 8
rename
def self.template_search_path_with_aal to def
template_search_path_with_aal
line
14-17:
#class <<
self
#
alias_method_chain :template_search_path, :aal
#end
alias_method_chain :template_search_path, :aal

For my porpouse I've also added a feature to order (ASC) every
singular association form
field
that reference an acts_as_list model (works only for simple
selects):

in active_scaffold_acts_as_list/init.rb
add:
load 'helpers/
association_helpers.rb'

create active_scaffold_acts_as_list/lib/helpers/association_helpers.rb
copying
from active_scaffold_acts_as_list/lib/helpers/association_helpers.rb
function
association_options_find to rename
association_options_find_with_aal
and
options_for_association

def association_options_find_with_aal(association, conditions =
nil)
if
association.klass.respond_to?'acts_as_list'

association.klass.find(:all
, :conditions => controller.send(:merge_conditions,
conditions,
association.options[:conditions]) , :order
=>
"#{association.klass.table_name}.#{association.klass.new.position_column}
ASC")

else ...

alias_method_chain :association_options_find, :aal

def
options_for_association_with_aal(association)
if
association.klass.respond_to?'acts_as_list'
available_records.collect { |model| [ model.to_label,
model.id ] }
else ...

Antonio Bardazzi Multicore-Sistemi.com

unread,
Oct 6, 2007, 7:11:22 PM10/6/07
to ActiveScaffold : Ruby on Rails plugin
And to correct link the css edit lib/helpers/view_helpers.rb line 5:
def active_scaffold_includes_with_aal(frontend = :default)
css =
stylesheet_link_tag(ActiveScaffold::Config::Core.asset_path('aal-
stylesheet.css', frontend))
ie_css =
stylesheet_link_tag(ActiveScaffold::Config::Core.asset_path('aal-
stylesheet-ie.css', frontend))
active_scaffold_includes_without_aal(frontend) + "\n" + css + "\n<!--
[if IE]>" + ie_css + "<![endif]-->\n"
end


On 5 Ott, 17:00, "Antonio Bardazzi Multicore-Sistemi.com"


<antonio.barda...@gmail.com> wrote:
> A modification to aa_acts_as_list to work in astrunkin
> active_scaffold_acts_as_list/lib/config/
> core.rb
>
> line 8
> rename
> def self.template_search_path_with_aal to def
> template_search_path_with_aal
> line
> 14-17:
> #class <<
> self
> #
> alias_method_chain :template_search_path, :aal
> #end
> alias_method_chain :template_search_path, :aal
>
> For my porpouse I've also added a feature to order (ASC) every
> singular association form
> field

> that reference anacts_as_listmodel (works only for simple

Reply all
Reply to author
Forward
0 new messages