Sha256: f864bf4d9ecf76a9a004ad45449579a06df2bf9b010bb5a2992218de086314d3

Contents?: true

Size: 995 Bytes

Versions: 3

Compression:

Stored size: 995 Bytes

Contents

module Coco
  module App
    module Elements
      class Link < Coco::Link
        include Concerns::AcceptsOptions
        include Concerns::AcceptsTheme

        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::SharedHelper
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
coveragebook_components-0.10.1.beta.2 app/components/coco/app/elements/link/link.rb
coveragebook_components-0.10.1.beta.1 app/components/coco/app/elements/link/link.rb
coveragebook_components-0.10.1.beta.0 app/components/coco/app/elements/link/link.rb