2024-07-04 18:02:17 +00:00
|
|
|
-#
|
|
|
|
Un item de un array.
|
|
|
|
|
|
|
|
Además de los valores por defecto, se pueden pasar otros atributos
|
|
|
|
para el div del ítem.
|
|
|
|
|
|
|
|
@param :value [String] El valor (requerido)
|
|
|
|
@param :human-value [String] El valor legible por humanes (opcional)
|
2024-07-05 14:56:48 +00:00
|
|
|
@param :send-value [String] El valor que se envía al controlador (opcional)
|
2024-07-04 18:02:17 +00:00
|
|
|
@param :searchable-value [String] El valor para usar en el filtro (opcional)
|
|
|
|
|
|
|
|
:ruby
|
|
|
|
local_assigns[:'human-value'] ||= value
|
2024-07-05 14:56:48 +00:00
|
|
|
local_assigns[:'send-value'] ||= local_assigns[:'human-value']
|
2024-07-04 18:02:17 +00:00
|
|
|
local_assigns[:'searchable-value'] ||= local_assigns[:'human-value'].remove_diacritics.downcase
|
|
|
|
local_assigns.delete(:value)
|
|
|
|
|
|
|
|
data = local_assigns.delete(:data)
|
|
|
|
data ||= {}
|
|
|
|
data[:'human-value'] = local_assigns.delete(:'human-value')
|
2024-07-05 14:56:48 +00:00
|
|
|
data[:'send-value'] = local_assigns.delete(:'send-value')
|
2024-07-04 18:02:17 +00:00
|
|
|
data[:'searchable-value'] = local_assigns.delete(:'searchable-value')
|
|
|
|
|
|
|
|
%div{ **local_assigns, data: { target: 'array.item', value: value, **data } }= yield
|