Sha256: a6026fdbef638cfee81a8de92185c294dea50bf07e4b81a41585231c86a5e69c
Contents?: true
Size: 734 Bytes
Versions: 1
Compression:
Stored size: 734 Bytes
Contents
module Coco class ImageUploader < Coco::Component include Concerns::AcceptsOptions accepts_option :click, from: [true, false], default: true accepts_option :drop, from: [true, false], default: true attr_reader :name, :accept, :form_builder def initialize(name: nil, accept: "image/*", form_builder: nil, **kwargs) @name = name || random_id @accept = accept @form_builder = form_builder end def file_field(**kwargs) if form_builder form_builder.file_field(@name, **kwargs) else file_field_tag(@name, **kwargs) end end def clickable? get_option_value(:click) end def droppable? get_option_value(:drop) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
coveragebook_components-0.5.0 | app/components/coco/base/image_uploader/image_uploader.rb |