lib/lifeform/libraries/default/button.rb in lifeform-0.12.0 vs lib/lifeform/libraries/default/button.rb in lifeform-0.13.0
- old
+ new
@@ -21,21 +21,20 @@
end
def template(&block)
return "" if !@if.nil? && !@if
- wrapper_tag = dashed self.class.const_get(:WRAPPER_TAG)
button_tag = dashed self.class.const_get(:BUTTON_TAG)
-
label_text = block ? capture(self, &block) : @label.is_a?(Proc) ? @label.pipe : @label # rubocop:disable Style/NestedTernaryOperator
field_body = html -> { <<~HTML # rubocop:disable Bridgetown/HTMLEscapedHeredoc
<#{button_tag}#{html_attributes @attributes, prefix_space: true}>#{text -> { label_text }}</#{button_tag}>
HTML
}
- return field_body unless wrapper_tag
+ return field_body unless self.class.const_get(:WRAPPER_TAG)
+ wrapper_tag = dashed self.class.const_get(:WRAPPER_TAG)
html -> { <<~HTML # rubocop:disable Bridgetown/HTMLEscapedHeredoc
<#{wrapper_tag} #{html_attributes name: @attributes[:name]}>#{field_body}</#{wrapper_tag}>
HTML
}
end