Class: ShadcnPhlexcomponents::AlertDialogActionTo

Inherits:
AlertDialogAction show all
Defined in:
lib/shadcn_phlexcomponents/components/alert_dialog.rb

Constant Summary

Constants inherited from Base

Base::SANITIZER_ALLOWED_ATTRIBUTES, Base::SANITIZER_ALLOWED_TAGS, Base::TAILWIND_MERGER

Instance Method Summary collapse

Methods inherited from AlertDialogAction

#class_variants, #default_attributes

Methods inherited from Base

#before_template, #convert_collection_hash_to_struct, #default_attributes, #find_as_child, #icon, #item_disabled?, #merge_default_attributes, #merged_as_child_attributes, #nokogiri_attributes_to_hash, #overlay, #sanitize_as_child

Constructor Details

#initialize(name = nil, options = nil, html_options = nil) ⇒ AlertDialogActionTo

Returns a new instance of AlertDialogActionTo.



294
295
296
297
298
# File 'lib/shadcn_phlexcomponents/components/alert_dialog.rb', line 294

def initialize(name = nil, options = nil, html_options = nil)
  @name = name
  @options = options
  @html_options = html_options
end

Instance Method Details

#view_template ⇒ Object



300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
# File 'lib/shadcn_phlexcomponents/components/alert_dialog.rb', line 300

def view_template(&)
  if block_given?
    @html_options = @options
    @options = @name
  end

  @html_options ||= {}
  @variant = @html_options.delete(:variant) || :default
  @size = @html_options.delete(:size) || :default
  merge_default_attributes({})
  @html_options = mix(@attributes, @html_options)

  if block_given?
    button_to(@options, @html_options, &)
  else
    button_to(@name, @options, @html_options)
  end
end