mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-23 02:06:22 +00:00
fix: poder mandar uuids de relaciones!
This commit is contained in:
parent
9960f12863
commit
d793d4fe54
5 changed files with 7 additions and 4 deletions
|
@ -108,7 +108,7 @@ export default class extends Controller {
|
|||
if (!this.isChecked(itemTarget)) continue;
|
||||
|
||||
this.originalValue.push(itemTarget.dataset.value);
|
||||
this.newArrayValueURL.searchParams.set("value", itemTarget.dataset?.humanValue || itemTarget.dataset?.value);
|
||||
this.newArrayValueURL.searchParams.set("value", itemTarget.dataset?.sendValue || itemTarget.dataset?.value);
|
||||
|
||||
const placeholder = this.placeholderTarget.content.firstElementChild.cloneNode(true);
|
||||
|
||||
|
|
|
@ -58,7 +58,7 @@
|
|||
- content_for :"#{id}_body" do
|
||||
.form-group.mb-0{ id: value_list_id }
|
||||
- metadata.values.each_pair do |value, uuid|
|
||||
= render 'targets/array/item', value: uuid, 'human-value': value, class: 'mb-2' do
|
||||
= render 'targets/array/item', value: uuid, 'send-value': uuid, 'human-value': value, class: 'mb-2' do
|
||||
= render 'bootstrap/custom_checkbox', name: name, id: random_id, value: uuid, checked: metadata.value.include?(uuid), content: value, type: 'radio'
|
||||
|
||||
-#
|
||||
|
|
|
@ -59,7 +59,7 @@
|
|||
- content_for :"#{id}_body" do
|
||||
.form-group.mb-0{ id: value_list_id }
|
||||
- metadata.values.each_pair do |value, uuid|
|
||||
= render 'targets/array/item', value: uuid, 'human-value': value, class: 'mb-2' do
|
||||
= render 'targets/array/item', value: uuid, 'send-value': uuid, 'human-value': value, class: 'mb-2' do
|
||||
= render 'bootstrap/custom_checkbox', name: name, id: random_id, value: uuid, checked: metadata.value.include?(uuid), content: value, data: { action: 'required-checkbox#change', target: 'required-checkbox.checkbox' }
|
||||
|
||||
-#
|
||||
|
|
|
@ -59,7 +59,7 @@
|
|||
- content_for :"#{id}_body" do
|
||||
.form-group.mb-0{ id: value_list_id }
|
||||
- metadata.values.each_pair do |value, uuid|
|
||||
= render 'targets/array/item', value: uuid, 'human-value': value, class: 'mb-2' do
|
||||
= render 'targets/array/item', value: uuid, 'send-value': uuid, 'human-value': value, class: 'mb-2' do
|
||||
= render 'bootstrap/custom_checkbox', name: name, id: random_id, value: uuid, checked: metadata.value.include?(uuid), content: value, data: { action: 'required-checkbox#change', target: 'required-checkbox.checkbox' }
|
||||
|
||||
-#
|
||||
|
|
|
@ -6,16 +6,19 @@
|
|||
|
||||
@param :value [String] El valor (requerido)
|
||||
@param :human-value [String] El valor legible por humanes (opcional)
|
||||
@param :send-value [String] El valor que se envía al controlador (opcional)
|
||||
@param :searchable-value [String] El valor para usar en el filtro (opcional)
|
||||
|
||||
:ruby
|
||||
local_assigns[:'human-value'] ||= value
|
||||
local_assigns[:'send-value'] ||= local_assigns[:'human-value']
|
||||
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')
|
||||
data[:'send-value'] = local_assigns.delete(:'send-value')
|
||||
data[:'searchable-value'] = local_assigns.delete(:'searchable-value')
|
||||
|
||||
%div{ **local_assigns, data: { target: 'array.item', value: value, **data } }= yield
|
||||
|
|
Loading…
Reference in a new issue