avo icon indicating copy to clipboard operation
avo copied to clipboard

Add field_input_attributes

Open adrianthedev opened this issue 1 year ago • 1 comments

First see if it's pheasable

Let's try to control the field attributes from the field somehow. This would be useful for plugins.

# instead of
<%= field_wrapper **field_wrapper_args do %>
  <%= form.text_field @field.id,
    class: classes("w-full"),
    data: @field.get_html(:data, view: view, element: :input),
    disabled: @field.is_readonly? || @field.is_disabled?,
    placeholder: @field.placeholder,
    style: @field.get_html(:style, view: view, element: :input),
    # value: @field.value,
    multiple: multiple
  %>
<% end %>


# we have
<%= field_wrapper **field_wrapper_args do %>
  <%= form.text_field @field.id, **field_input_args %>
<% end %>

Now, the field_input_args can be intercepted and change the args.

Use case

Before, we had only @field.readonly to mark the field as disabled. Now we're introducing the @field.disabled option. and we have to update all field components to support the new @field.disabled option.

adrianthedev avatar Dec 18 '23 10:12 adrianthedev

This issue has been marked as stale because there was no activity for the past 15 days.

github-actions[bot] avatar Jan 04 '24 01:01 github-actions[bot]

We figured out that there aren't that many common attributes so we'll park it for now.

adrianthedev avatar Jul 03 '24 13:07 adrianthedev