Skip to content

Keppler File Input

Anyelo Petit edited this page Jul 28, 2018 · 7 revisions

Keppler File Input

Keppler File Input está basado en Bootstrap File Input

Repositorio de GitHub: https://github.com/kartik-v/bootstrap-fileinput

Basic Usage:

= f.input :image, as: :keppler_file

Load multiple images

# Migration
t.jsonb :images

# Controller
params.require(:gallery).permit( { images: [] })

# Form
= f.input :images, as: :keppler_file, multiple: true

Allow types

= f.input :images, as: :keppler_file, type: %w[image video audio pdf]

Allow formats

= f.input :images, as: :keppler_file, type: %w[image], formats: [jpg jpeg png svg]
= f.input :videos, as: :keppler_file, type: %w[video], formats: [mp4 mkv opg avi]
= f.input :audios, as: :keppler_file, type: %w[audio], formats: [mp3]

Configuring file size

= f.input :images, as: :keppler_file, max_size: 5000     # default 225 (KB)
= f.input :images, as: :keppler_file, max_preview_size: 5000     # default 25600 // 25 MB

Nota: el input posee un script interno para cada input_id con configuración de lenguaje con el idioma actual e íconos de Simple Line Icon, así como para los tipos y formatos disponibles y para la vista previa cuando el campo ya existe y tiene registros guardados.

Clone this wiki locally