Sha256: 43d7658f810b01cc7a1488b5bae0cc67ca5cab33d105c5ada9dea71099f271dd

Contents?: true

Size: 692 Bytes

Versions: 1

Compression:

Stored size: 692 Bytes

Contents

module SimpleVoiceInput
  module VoiceInputHelper
    def voice_input(method, options = {})
      input_html_options = options[:input_html] || {}
      input_html_options[:class] = Array(input_html_options[:class]) << 'voice-input'
      input_html_options[:placeholder] ||= 'Diga algo...'

      @template.content_tag(:div, class: 'voice-input-container') do
        self.input(method, options.merge(input_html: input_html_options)) +
            @template.content_tag(:span, '🎤', class: 'microphone-icon', data: { target: "voice-input-#{method}" })
      end
    end
  end
end

# Extende o SimpleForm
SimpleForm::FormBuilder.include SimpleVoiceInput::VoiceInputHelper

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
simple_voice_input-0.1.0 lib/simple_voice_input/voice_input_helper.rb