diff --git a/card/mod/01_core/set/all/collection.rb b/card/mod/01_core/set/all/collection.rb index 90e44142c..42be35609 100644 --- a/card/mod/01_core/set/all/collection.rb +++ b/card/mod/01_core/set/all/collection.rb @@ -175,22 +175,41 @@ def set_search_params_variables! hash end end end -end -def each_nest args={} - Card::Content.new(content, self).find_chunks( Card::Chunk::Reference ).each do |chunk| - yield(chunk.referee_name, nest_args(chunk, args)) + + def each_nest args={} + Card::Content.new(card.content, card).find_chunks( Card::Chunk::Reference ).each do |chunk| + yield(chunk.referee_name, nest_args(chunk, args)) + end + end + + def map_nest args={} + result = [] + each_nest args do |name, nest_args| + result << yield(name, nest_args) + end + result end -end -def map_nest args={} - result = [] - each_nest args do |name, nest_args| - result << yield(name, nest_args) + # process args for links and inclusions + def nest_args chunk, args + r_args = item_args(args) + if @inclusion_opts + r_args.merge! @inclusion_opts.clone + end + if chunk.kind_of? Card::Chunk::Include + r_args.merge!(chunk.options) + elsif chunk.kind_of? Card::Chunk::Link + r_args.reverse_merge!(:view=>:link, :title=>chunk.link_text) + end + r_args end - result + end + + + format :html do view :tabs do |args| tab_buttons = '' @@ -214,20 +233,6 @@ def default_tabs_args args end - # process args for links and inclusions - def nest_args chunk, args - r_args = item_args(args) - if @inclusion_opts - r_args.merge! @inclusion_opts.clone - end - if chunk.kind_of? Card::Chunk::Include - r_args.merge!(chunk.options) - elsif chunk.kind_of? Card::Chunk::Link - r_args.reverse_merge!(:view=>:link, :title=>chunk.link_text) - end - r_args - end - # create a path for a nest with respect ot the inclusion options def nest_path name, nest_args path_args = {:view=>nest_args.delete(:view)} diff --git a/card/mod/05_standard/set/type/search_type.rb b/card/mod/05_standard/set/type/search_type.rb index 5ea62c449..b6205f64d 100644 --- a/card/mod/05_standard/set/type/search_type.rb +++ b/card/mod/05_standard/set/type/search_type.rb @@ -18,7 +18,7 @@ def item_type def each_nest args={} item_names(args) do |name| - yield(name, nest_args(args.reverse_merge!(:item=>:content)) + yield(name, nest_args(args.reverse_merge!(:item=>:content))) end end