avo
avo copied to clipboard
Add field_input_attributes
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.
This issue has been marked as stale because there was no activity for the past 15 days.
We figured out that there aren't that many common attributes so we'll park it for now.