Sha256: 8c4b8510256ca4515dd4280c87a90196ae0cb991b5dd2943bcfce6e0e86e9641

Contents?: true

Size: 635 Bytes

Versions: 1

Compression:

Stored size: 635 Bytes

Contents

require 'formtastic'

module Formtastic
  module Inputs
    class UploaderInput
      include ::Formtastic::Inputs::Base

      def to_html
        input_wrapping do
          label_html << builder.uploader_field(method, input_html_options)
        end
      end

      def input_html_options
        data = super
        data[:confirm_delete] = options[:confirm_delete]
        data[:confirm_message] = localized_confirm_message
        data
      end

      protected

      def localized_confirm_message
        localized_string(method, method, :delete_confirmation) || I18n.t('uploader.confirm_delete')
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rails-uploader-0.2.8 lib/uploader/hooks/formtastic.rb