Class: KirguduBase::AuthenticationFormBuilder
- Inherits:
-
ActionView::Helpers::FormBuilder
- Object
- ActionView::Helpers::FormBuilder
- KirguduBase::AuthenticationFormBuilder
- Includes:
- ActionView::Helpers::AssetTagHelper, ActionView::Helpers::TagHelper
- Defined in:
- app/helpers/kirgudu_base/authentication_form_builder.rb
Instance Method Summary collapse
- #error_label(label, html_options = {}) ⇒ Object
- #label(label, html_options = {}) ⇒ Object
- #password_field(label, value, html_options = {}) ⇒ Object
- #text_field(label, value, html_options = {}) ⇒ Object
Instance Method Details
#error_label(label, html_options = {}) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'app/helpers/kirgudu_base/authentication_form_builder.rb', line 12 def error_label(label, = {}) .merge!(generated: "true", style: "display: block") (, "error") if @object.errors[label].present? errors_in_html = [] @object.errors[label].each do || errors_in_html << @template.content_tag("label", .capitalize.html_safe, ) end if @object.errors[label].present? errors_in_html.join("").html_safe end |
#label(label, html_options = {}) ⇒ Object
27 28 29 30 31 |
# File 'app/helpers/kirgudu_base/authentication_form_builder.rb', line 27 def label(label, = {}) @template.content_tag("label", ) do @object.class.human_attribute_name(label) end end |
#password_field(label, value, html_options = {}) ⇒ Object
48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'app/helpers/kirgudu_base/authentication_form_builder.rb', line 48 def password_field(label, value, = {}) ||= {} .merge!( { id: "#{@object.class.for_form_params}_#{label}", name: "#{@object.class.for_form_params}[#{label}]", type: "password", value: value || @object[label] } ) (, "error") if @object.errors[label].present? @template.content_tag("input", "", ) end |
#text_field(label, value, html_options = {}) ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'app/helpers/kirgudu_base/authentication_form_builder.rb', line 34 def text_field(label, value, = {}) ||= {} .merge!( { id: "#{@object.class.for_form_params}_#{label}", name: "#{@object.class.for_form_params}[#{label}]", type: "text", value: value || @object[label] } ) (, "error") if @object.errors[label].present? @template.content_tag("input", "", ) end |