Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Index: lib/extensions/action_controller_rendering.rb
- ===================================================================
- --- lib/extensions/action_controller_rendering.rb (revision 114)
- +++ lib/extensions/action_controller_rendering.rb (revision 116)
- @@ -9,15 +9,12 @@
- path_val = params[:adapter] || args[0][:action]
- # ACC I'm setting use_full_path to false here and rewrite_template_path_for_active_scaffold has been
- # modified to return an absolute path
- + show_layout = args[0][:partial] ? false : true
- render :file => rewrite_template_path_for_active_scaffold(path_val),
- :locals => {:payload => render_to_string(args.first, &block)},
- - :use_full_path => false
- + :use_full_path => false,
- + :layout => show_layout
- @rendering_adapter = nil # recursion control
- - elsif self.class.uses_active_scaffold? && args[0] && args[0][:file]
- - # ACC I'm adding this elsif statement so that I can rewrite the file path and set use_full_path to true
- - args[0][:file] = rewrite_template_path_for_active_scaffold(args[0][:file])
- - args[0][:use_full_path] = true
- - render_without_active_scaffold(args[0])
- else
- render_without_active_scaffold(*args, &block)
- end
- @@ -42,8 +39,6 @@
- private
- def rewrite_template_path_for_active_scaffold(path)
- - # test for the actual file
- - return path if template_exists? default_template_name(path)
- base = File.join RAILS_ROOT, 'app', 'views'
- # check the ActiveScaffold-specific directories
- active_scaffold_config.template_search_path.each do |template_path|
- @@ -52,12 +47,12 @@
- # ACC I'm using this regex directory search because I don't know how to hook into the
- # rails code that would do this for me. I am assuming here that path is a non-nested
- # partial, so my regex is fragile, and will only work in that case.
- - template_file = Dir.entries(search_dir).find {|f| f =~ /^_?#{path}/ }
- + template_file = Dir.entries(search_dir).find {|f| f =~ /^#{path}/ }
- # ACC pick_template and template_exists? are the same method (aliased), using both versions
- # to express intent.
- - return pick_template(template_file) if template_exists?(template_file)
- + return File.join(search_dir, template_file) if template_exists?(template_file)
- end
- return path
- end
- end
- -end
- +end
- \ No newline at end of file
- Index: lib/extensions/action_view_rendering.rb
- ===================================================================
- --- lib/extensions/action_view_rendering.rb (revision 4730)
- +++ lib/extensions/action_view_rendering.rb (working copy)
- @@ -74,8 +74,17 @@
- private
- + # FIXME hack, this has been removed in edge rails
- + def active_scaffold_partial_pieces(partial_path)
- + if partial_path.include?('/')
- + return File.dirname(partial_path), File.basename(partial_path)
- + else
- + return controller.class.controller_path, partial_path
- + end
- + end
- +
- def rewrite_partial_path_for_active_scaffold(partial_path)
- - path, partial_name = partial_pieces(partial_path)
- + path, partial_name = active_scaffold_partial_pieces(partial_path)
- # test for the actual file
- return partial_path if File.exists? File.join(path, "_#{partial_name}")
- Index: lib/extensions/action_view_rendering.rb
- ===================================================================
- --- lib/extensions/action_view_rendering.rb (revision 4730)
- +++ lib/extensions/action_view_rendering.rb (working copy)
- @@ -74,8 +74,17 @@
- private
- + # FIXME hack, this has been removed in edge rails
- + def active_scaffold_partial_pieces(partial_path)
- + if partial_path.include?('/')
- + return File.dirname(partial_path), File.basename(partial_path)
- + else
- + return controller.class.controller_path, partial_path
- + end
- + end
- +
- def rewrite_partial_path_for_active_scaffold(partial_path)
- - path, partial_name = partial_pieces(partial_path)
- + path, partial_name = active_scaffold_partial_pieces(partial_path)
- # test for the actual file
- return partial_path if File.exists? File.join(path, "_#{partial_name}")
- Index: lib/helpers/form_column_helpers.rb
- ===================================================================
- --- lib/helpers/form_column_helpers.rb (revision 114)
- +++ lib/helpers/form_column_helpers.rb (revision 116)
- @@ -182,9 +182,18 @@
- ## Form column override signatures
- ##
- + # FIXME hack, this has been removed in edge rails
- + def active_scaffold_partial_pieces(partial_path)
- + if partial_path.include?('/')
- + return File.dirname(partial_path), File.basename(partial_path)
- + else
- + return controller.class.controller_path, partial_path
- + end
- + end
- +
- def override_form_field_partial?(column)
- - path, partial_name = partial_pieces(override_form_field_partial(column))
- - file_exists? File.join(path, "_#{partial_name}")
- + path, partial_name = active_scaffold_partial_pieces(override_form_field_partial(column))
- + File.exists? File.join(path, "_#{partial_name}")
- end
- # the naming convention for overriding form fields with partials
- Index: lib/extensions/generic_view_paths.rb
- ===================================================================
- --- lib/extensions/generic_view_paths.rb (revision 4730)
- +++ lib/extensions/generic_view_paths.rb (working copy)
- @@ -72,8 +72,8 @@
- file ? File.join(path, file) : nil
- end
- - def find_template_extension_from_handler_with_generics(template_path)
- - t_ext = find_template_extension_from_handler_without_generics(template_path)
- + def find_template_extension_from_handler_with_generics(template_path, template_format = @template.template_format)
- + t_ext = find_template_extension_from_handler_without_generics(template_path, template_format)
- if t_ext && !t_ext.empty?
- t_ext
- else
Add Comment
Please, Sign In to add comment