Module: Koi::Form::GOVUKExtensions
- Defined in:
- lib/koi/form/govuk_extensions.rb
Instance Method Summary collapse
-
#govuk_document_field(attribute_name, label: {}, caption: {}, hint: {}, form_group: {}, mime_types: Koi.config.document_mime_types) ⇒ Object
Generates a
div
element with aninput
with type=file with a label, optional hint. -
#govuk_image_field(attribute_name, label: {}, caption: {}, hint: {}, form_group: {}, mime_types: Koi.config.image_mime_types) ⇒ ActiveSupport::SafeBuffer
Generates a
div
element to preview uploaded images and aninput
with type=file with a label, optional hint.
Instance Method Details
#govuk_document_field(attribute_name, label: {}, caption: {}, hint: {}, form_group: {}, mime_types: Koi.config.document_mime_types) ⇒ Object
Generates a div
element with an input
with type=file with a label, optional hint.
11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/koi/form/govuk_extensions.rb', line 11 def govuk_document_field(attribute_name, label: {}, caption: {}, hint: {}, form_group: {}, mime_types: Koi.config.document_mime_types, **, &) Elements::Document.new( self, object_name, attribute_name, label:, caption:, hint:, form_group:, mime_types:, **, & ).html end |
#govuk_image_field(attribute_name, label: {}, caption: {}, hint: {}, form_group: {}, mime_types: Koi.config.image_mime_types) ⇒ ActiveSupport::SafeBuffer
Generates a div
element to preview uploaded images and an input
with type=file with a label, optional hint
59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/koi/form/govuk_extensions.rb', line 59 def govuk_image_field(attribute_name, label: {}, caption: {}, hint: {}, form_group: {}, mime_types: Koi.config.image_mime_types, **, &) Elements::Image.new( self, object_name, attribute_name, label:, caption:, hint:, form_group:, mime_types:, **, & ).html end |