Sha256: 82ed1688c8509ab07c7e4b81dbd728f032ca06266ee4db57b4819e1d8a476aa6

Contents?: true

Size: 725 Bytes

Versions: 12

Compression:

Stored size: 725 Bytes

Contents

# frozen_string_literal: true

module Ariadne
  module Forms
    module Dsl
      # :nodoc:
      class SubmitButtonInput < Input
        attr_reader :name, :label, :block

        def initialize(**options, &block)
          @block = block

          super(**options)
        end

        def to_component
          html_attrs = @input_attributes || {}
          @block.call(Ariadne::UI::Button::Component.new(type: :submit, **@options, html_attrs: html_attrs))
        end

        def before_render
          content # ensures that block is called
        end

        # :nocov:
        def type
          :submit_button
        end

        def supports_validation?
          false
        end
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
ariadne_view_components-0.0.74.1 lib/ariadne/forms/dsl/submit_button_input.rb
ariadne_view_components-0.0.74 lib/ariadne/forms/dsl/submit_button_input.rb
ariadne_view_components-0.0.73 lib/ariadne/forms/dsl/submit_button_input.rb
ariadne_view_components-0.0.72 lib/ariadne/forms/dsl/submit_button_input.rb
ariadne_view_components-0.0.71 lib/ariadne/forms/dsl/submit_button_input.rb
ariadne_view_components-0.0.70 lib/ariadne/forms/dsl/submit_button_input.rb
ariadne_view_components-0.0.69 lib/ariadne/forms/dsl/submit_button_input.rb
ariadne_view_components-0.0.68 lib/ariadne/forms/dsl/submit_button_input.rb
ariadne_view_components-0.0.67 lib/ariadne/forms/dsl/submit_button_input.rb
ariadne_view_components-0.0.66 lib/ariadne/forms/dsl/submit_button_input.rb
ariadne_view_components-0.0.65 lib/ariadne/forms/dsl/submit_button_input.rb
ariadne_view_components-0.0.64 lib/ariadne/forms/dsl/submit_button_input.rb