Add support for placeholder attribute to component
	
		
			
	
		
	
	
		
	
		
			All checks were successful
		
		
	
	
		
			
				
	
				continuous-integration/drone/push Build is passing
				
			
		
		
	
	
				
					
				
			
		
			All checks were successful
		
		
	
	continuous-integration/drone/push Build is passing
				
			This commit is contained in:
		
							parent
							
								
									40b34d0935
								
							
						
					
					
						commit
						fff6dea100
					
				@ -6,6 +6,7 @@
 | 
				
			|||||||
    ) do %>
 | 
					    ) do %>
 | 
				
			||||||
  <%= method("#{@type}_field").call :setting, @key,
 | 
					  <%= method("#{@type}_field").call :setting, @key,
 | 
				
			||||||
    value: Setting.public_send(@key),
 | 
					    value: Setting.public_send(@key),
 | 
				
			||||||
 | 
					    placeholder: @placeholder,
 | 
				
			||||||
    data: {
 | 
					    data: {
 | 
				
			||||||
      :'default-value' => Setting.get_field(@key)[:default]
 | 
					      :'default-value' => Setting.get_field(@key)[:default]
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
 | 
				
			|||||||
@ -2,7 +2,7 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
module FormElements
 | 
					module FormElements
 | 
				
			||||||
  class FieldsetResettableSettingComponent < ViewComponent::Base
 | 
					  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
 | 
					      @tag         = tag
 | 
				
			||||||
      @positioning = :vertical
 | 
					      @positioning = :vertical
 | 
				
			||||||
      @title       = title
 | 
					      @title       = title
 | 
				
			||||||
@ -10,6 +10,7 @@ module FormElements
 | 
				
			|||||||
      @key         = key.to_sym
 | 
					      @key         = key.to_sym
 | 
				
			||||||
      @type        = type
 | 
					      @type        = type
 | 
				
			||||||
      @resettable  = is_resettable?(@key)
 | 
					      @resettable  = is_resettable?(@key)
 | 
				
			||||||
 | 
					      @placeholder = placeholder
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def is_resettable?(key)
 | 
					    def is_resettable?(key)
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user