app/components/coco/app/elements/link/link.rb in coveragebook_components-0.7.8 vs app/components/coco/app/elements/link/link.rb in coveragebook_components-0.7.9

- old
+ new

@@ -7,9 +7,27 @@ THEMES = %W[positive primary warning negative info neutral-dark neutral-light] << nil accepts_option :theme, from: THEMES accepts_option :underline, from: [true, false] + + before_initialize do |kwargs| + if kwargs.key?(:modal) + modal_name = (kwargs[:modal] == true) ? "default" : kwargs[:modal] + kwargs[:data] = kwargs.fetch(:data, {}).merge(coco_modal_data_attributes(modal_name)) + kwargs.delete(:modal) + end + if kwargs.key?(:frame) + turbo_data = {turbo: true, turbo_frame: kwargs[:frame]} + kwargs[:data] = kwargs.fetch(:data, {}).merge(turbo_data) + kwargs.delete(:frame) + end + kwargs + end + + class << self + include Coco::BaseHelper + end end end end end