<% # headmin/forms/url # # ==== Required parameters # * +form+ - Form object # * +attribute+ - Name of the attribute of the form model # # ==== Optional parameters # * +aria+ - Provide a hash to define all aria attributes # * +autocomplete+ - Value to be autofilled by the browser # * +autofocus+ - Set to true to focus on this field when the page renders # * +data+ - Provide a hash to define all data attributes # * +disabled+ - Sets the placeholder of the field # * +id+ - Input identifier # * +maxlength+ - Maximum amount of characters to be used # * +minlength+ - Minimum amount of characters to be used # * +list+ - Add array of options to show in a data list # * +pattern+ -a A regular expression that the input's value must match # * +placeholder+ - Sets the placeholder of the field # * +readonly+ - Sets the placeholder of the field # * +required+ - Set to true to mark as required # * +size+ - How much of the input should be shown # * +value+ - Overrides the value of the form # # ==== Extra parameters # Listed in 'headmin/forms/base' # # ==== References # https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/text # https://apidock.com/rails/ActionView/Helpers/FormHelper/url_field # # ==== Examples # Basic version # <%= render 'headmin/forms/url', form: form, attribute: :website_url %#> placeholder = local_assigns[:float] ? local_assigns[:placeholder] || attribute : local_assigns[:placeholder] option_keys = %i(aria autocomplete autofocus data disabled id list placeholder maxlength minlength pattern readonly required size value) options = local_assigns.slice(*option_keys).merge( aria: { describedby: form_field_validation_id(form, attribute) }, class: ['form-control', form_field_validation_class(form, attribute)].join(' '), placeholder: placeholder ) %> <%= render 'headmin/forms/base', local_assigns do |form| %> <%= form.url_field(attribute, options) %> <% end %>