Sha256: d3b91305885c94678bc3ffd32c77cef506d7dc053537b2973204a70aeb6c24a0

Contents?: true

Size: 491 Bytes

Versions: 3

Compression:

Stored size: 491 Bytes

Contents

# frozen_string_literal: true

class Scarpe
  class WebviewLink < WebviewWidget
    def initialize(properties)
      super

      bind("click") do
        send_self_event(event_name: "click")
      end
    end

    def element
      HTML.render do |h|
        h.a(**attributes) do
          @text
        end
      end
    end

    def attributes
      {
        id: html_id,
        href: @click,
        onclick: (handler_js_code("click") if @has_block),
      }.compact
    end
  end
end

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
lacci-0.2.1 lib/scarpe/wv/link.rb
scarpe-0.2.1 lib/scarpe/wv/link.rb
scarpe-0.2.0 lib/scarpe/wv/link.rb