Skip to content

Commit

Permalink
Remove support for fragment rendering
Browse files Browse the repository at this point in the history
  • Loading branch information
joeldrapper committed Feb 3, 2025
1 parent 0c6d713 commit dc527b5
Show file tree
Hide file tree
Showing 5 changed files with 2 additions and 77 deletions.
1 change: 0 additions & 1 deletion lib/phlex/rails.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ module Rails
autoload :BufferedLabelBuilder, "phlex/rails/buffered_label_builder"
autoload :BufferedRadioButtonBuilder, "phlex/rails/buffered_radio_button_builder"
autoload :CSV, "phlex/rails/csv"
autoload :FragmentFinder, "phlex/rails/fragment_finder"
autoload :HTML, "phlex/rails/html"
autoload :HelperFinder, "phlex/rails/helper_finder"
autoload :HelperMacros, "phlex/rails/helper_macros"
Expand Down
28 changes: 0 additions & 28 deletions lib/phlex/rails/fragment_finder.rb

This file was deleted.

2 changes: 0 additions & 2 deletions lib/phlex/rails/helper_macros.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ def register_output_helper(method_name)
def #{method_name}(*args, **kwargs, &block)
context = @_context
return if context.fragments && !context.in_target_fragment
output = if block
helpers.#{method_name}(*args, **kwargs) { capture(&block) }
Expand Down Expand Up @@ -43,7 +42,6 @@ def register_builder_yielding_helper(method_name, builder)
def #{method_name}(*args, **kwargs)
context = @_context
return if context.fragments && !context.in_target_fragment
output = if block_given?
helpers.#{method_name}(*args, **kwargs) { |form|
capture do
Expand Down
8 changes: 2 additions & 6 deletions lib/phlex/rails/sgml.rb
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,8 @@ def render(*args, **kwargs, &block)
end

def render_in(view_context, &erb)
fragments = if view_context.request && (fragment_header = view_context.request.headers["X-Fragment"])
fragment_header.split
end

if erb
call(view_context:, fragments:) { |*args|
call(view_context:) { |*args|
if args.length == 1 && Phlex::SGML === args[0] && !erb.source_location&.[](0)&.end_with?(".rb")
unbuffered = Phlex::Rails::Unbuffered.new(args[0])
raw(helpers.capture(unbuffered, &erb))
Expand All @@ -78,7 +74,7 @@ def render_in(view_context, &erb)
end
}.html_safe
else
call(view_context:, fragments:).html_safe
call(view_context:).html_safe
end
end

Expand Down
40 changes: 0 additions & 40 deletions test/phlex/fragment_finder_test.rb

This file was deleted.

0 comments on commit dc527b5

Please sign in to comment.