Add support for placeholder attribute to component
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Râu Cao 2024-06-20 13:54:59 +02:00
parent 40b34d0935
commit fff6dea100
Signed by: raucao
GPG Key ID: 37036C356E56CC51
2 changed files with 3 additions and 1 deletions

View File

@ -6,6 +6,7 @@
) do %>
<%= method("#{@type}_field").call :setting, @key,
value: Setting.public_send(@key),
placeholder: @placeholder,
data: {
:'default-value' => Setting.get_field(@key)[:default]
},

View File

@ -2,7 +2,7 @@
module FormElements
class FieldsetResettableSettingComponent < ViewComponent::Base
def initialize(tag: "li", key:, type: :text, title:, description: nil)
def initialize(tag: "li", key:, type: :text, title:, description: nil, placeholder: nil)
@tag = tag
@positioning = :vertical
@title = title
@ -10,6 +10,7 @@ module FormElements
@key = key.to_sym
@type = type
@resettable = is_resettable?(@key)
@placeholder = placeholder
end
def is_resettable?(key)