Sha256: e4ce18ddc385bd5eb41ebd2ba2a958c1af9367a0f8757ad1c2c4e64e55f2cb83

Contents?: true

Size: 532 Bytes

Versions: 1

Compression:

Stored size: 532 Bytes

Contents

module Form
  module Component
    class Button < Base
      def attributes
        {
          :value => text,
          :type => :submit
        }.merge(options)
      end

      def text
        scopes = [
          [:form, :buttons, form.base_name, name].flatten.compact.join(".").to_sym,
          :"form.buttons.#{name}",
          humanize(name)
        ].compact

        options.fetch :text, t(scopes.shift, default: scopes)
      end

      def to_html
        Tag.new(:input, attributes).to_s
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
form-0.0.1.alpha1 lib/form/component/button.rb