Phlex 1.2 -- blocks? #454
-
|
Hi, Given the following which worked as-is in < 1.2: # frozen_string_literal: true
module Views
module Components
class DataTable::Row::Cell < Base
attr_reader :condensed
def initialize(**options, &content)
@condensed = options.delete(:condensed) { false }
@content = content
super(**options)
end
def template
return if options[:show] == false
td(
**mix(
options,
classes(
'whitespace-nowrap py-4 pl-4 pr-3 text-sm font-normal text-slate-500 first:pl-8 dark:text-slate-300',
-> { condensed == :hidden } => 'group-condensed:hidden',
-> { condensed == :only } => 'hidden group-condensed:table-cell'
)
),
&@content
)
end
end
end
endNow that Phlex is taking my block, what is the recommended way to do this? I know (learned through trial and error, rather) I can make it instantly work by getting rid of the block argument in the initializer and replacing Thanks! |
Beta Was this translation helpful? Give feedback.
Answered by
joeldrapper
Jan 25, 2023
Replies: 1 comment 2 replies
-
|
The content block will be given to |
Beta Was this translation helpful? Give feedback.
2 replies
Answer selected by
Bumppoman
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The content block will be given to
templateso you can eitheryieldinsidetemplateor update it to take a block, e.g.def template(&content).