394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
|
# File 'lib/bull/ui_core.rb', line 394
def render
span do
input(placeholder: 'key', value: state.key).on(:change){|event| state.key! event.target.value}
input(placeholder: 'value',value: state.value).on(:change){|event| state.value! event.target.value}
button{'add'}.on(:click) do
hsh = params.value.dup
hsh[state.key] = state.value
params.on_change.call hsh
state.key! ''
state.value! ''
end
table do
tr do
th{'key'}
th{'value'}
th{' '}
end
params.value.each_pair do |k, v|
tr do
td{k}
td{v}
td{i(class: 'fa fa-times')}.on(:click) do
hsh = params.value.dup
hsh.delete k
params.on_change.call hsh
end
end
end
end
end
end
|