Guest User

Untitled

a guest
Apr 21st, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.13 KB | None | 0 0
  1. Index: lib/extensions/action_controller_rendering.rb
  2. ===================================================================
  3. --- lib/extensions/action_controller_rendering.rb (revision 114)
  4. +++ lib/extensions/action_controller_rendering.rb (revision 116)
  5. @@ -9,15 +9,12 @@
  6. path_val = params[:adapter] || args[0][:action]
  7. # ACC I'm setting use_full_path to false here and rewrite_template_path_for_active_scaffold has been
  8. # modified to return an absolute path
  9. + show_layout = args[0][:partial] ? false : true
  10. render :file => rewrite_template_path_for_active_scaffold(path_val),
  11. :locals => {:payload => render_to_string(args.first, &block)},
  12. - :use_full_path => false
  13. + :use_full_path => false,
  14. + :layout => show_layout
  15. @rendering_adapter = nil # recursion control
  16. - elsif self.class.uses_active_scaffold? && args[0] && args[0][:file]
  17. - # ACC I'm adding this elsif statement so that I can rewrite the file path and set use_full_path to true
  18. - args[0][:file] = rewrite_template_path_for_active_scaffold(args[0][:file])
  19. - args[0][:use_full_path] = true
  20. - render_without_active_scaffold(args[0])
  21. else
  22. render_without_active_scaffold(*args, &block)
  23. end
  24. @@ -42,8 +39,6 @@
  25. private
  26.  
  27. def rewrite_template_path_for_active_scaffold(path)
  28. - # test for the actual file
  29. - return path if template_exists? default_template_name(path)
  30. base = File.join RAILS_ROOT, 'app', 'views'
  31. # check the ActiveScaffold-specific directories
  32. active_scaffold_config.template_search_path.each do |template_path|
  33. @@ -52,12 +47,12 @@
  34. # ACC I'm using this regex directory search because I don't know how to hook into the
  35. # rails code that would do this for me. I am assuming here that path is a non-nested
  36. # partial, so my regex is fragile, and will only work in that case.
  37. - template_file = Dir.entries(search_dir).find {|f| f =~ /^_?#{path}/ }
  38. + template_file = Dir.entries(search_dir).find {|f| f =~ /^#{path}/ }
  39. # ACC pick_template and template_exists? are the same method (aliased), using both versions
  40. # to express intent.
  41. - return pick_template(template_file) if template_exists?(template_file)
  42. + return File.join(search_dir, template_file) if template_exists?(template_file)
  43. end
  44. return path
  45. end
  46. end
  47. -end
  48. +end
  49. \ No newline at end of file
  50. Index: lib/extensions/action_view_rendering.rb
  51. ===================================================================
  52. --- lib/extensions/action_view_rendering.rb (revision 4730)
  53. +++ lib/extensions/action_view_rendering.rb (working copy)
  54. @@ -74,8 +74,17 @@
  55.  
  56. private
  57.  
  58. + # FIXME hack, this has been removed in edge rails
  59. + def active_scaffold_partial_pieces(partial_path)
  60. + if partial_path.include?('/')
  61. + return File.dirname(partial_path), File.basename(partial_path)
  62. + else
  63. + return controller.class.controller_path, partial_path
  64. + end
  65. + end
  66. +
  67. def rewrite_partial_path_for_active_scaffold(partial_path)
  68. - path, partial_name = partial_pieces(partial_path)
  69. + path, partial_name = active_scaffold_partial_pieces(partial_path)
  70.  
  71. # test for the actual file
  72. return partial_path if File.exists? File.join(path, "_#{partial_name}")
  73.  
  74. Index: lib/extensions/action_view_rendering.rb
  75. ===================================================================
  76. --- lib/extensions/action_view_rendering.rb (revision 4730)
  77. +++ lib/extensions/action_view_rendering.rb (working copy)
  78. @@ -74,8 +74,17 @@
  79.  
  80. private
  81.  
  82. + # FIXME hack, this has been removed in edge rails
  83. + def active_scaffold_partial_pieces(partial_path)
  84. + if partial_path.include?('/')
  85. + return File.dirname(partial_path), File.basename(partial_path)
  86. + else
  87. + return controller.class.controller_path, partial_path
  88. + end
  89. + end
  90. +
  91. def rewrite_partial_path_for_active_scaffold(partial_path)
  92. - path, partial_name = partial_pieces(partial_path)
  93. + path, partial_name = active_scaffold_partial_pieces(partial_path)
  94.  
  95. # test for the actual file
  96. return partial_path if File.exists? File.join(path, "_#{partial_name}")
  97.  
  98. Index: lib/helpers/form_column_helpers.rb
  99. ===================================================================
  100. --- lib/helpers/form_column_helpers.rb (revision 114)
  101. +++ lib/helpers/form_column_helpers.rb (revision 116)
  102. @@ -182,9 +182,18 @@
  103. ## Form column override signatures
  104. ##
  105.  
  106. + # FIXME hack, this has been removed in edge rails
  107. + def active_scaffold_partial_pieces(partial_path)
  108. + if partial_path.include?('/')
  109. + return File.dirname(partial_path), File.basename(partial_path)
  110. + else
  111. + return controller.class.controller_path, partial_path
  112. + end
  113. + end
  114. +
  115. def override_form_field_partial?(column)
  116. - path, partial_name = partial_pieces(override_form_field_partial(column))
  117. - file_exists? File.join(path, "_#{partial_name}")
  118. + path, partial_name = active_scaffold_partial_pieces(override_form_field_partial(column))
  119. + File.exists? File.join(path, "_#{partial_name}")
  120. end
  121.  
  122. # the naming convention for overriding form fields with partials
  123.  
  124. Index: lib/extensions/generic_view_paths.rb
  125. ===================================================================
  126. --- lib/extensions/generic_view_paths.rb (revision 4730)
  127. +++ lib/extensions/generic_view_paths.rb (working copy)
  128. @@ -72,8 +72,8 @@
  129. file ? File.join(path, file) : nil
  130. end
  131.  
  132. - def find_template_extension_from_handler_with_generics(template_path)
  133. - t_ext = find_template_extension_from_handler_without_generics(template_path)
  134. + def find_template_extension_from_handler_with_generics(template_path, template_format = @template.template_format)
  135. + t_ext = find_template_extension_from_handler_without_generics(template_path, template_format)
  136. if t_ext && !t_ext.empty?
  137. t_ext
  138. else
Add Comment
Please, Sign In to add comment