Class: BugReportsClient::FormSchema::Field
- Inherits:
-
Struct
- Object
- Struct
- BugReportsClient::FormSchema::Field
- Defined in:
- lib/bug_reports_client/form_schema.rb
Overview
A single form field parsed from the YAML definition.
Instance Attribute Summary collapse
-
#help ⇒ Object
Returns the value of attribute help.
-
#key ⇒ Object
Returns the value of attribute key.
-
#label ⇒ Object
Returns the value of attribute label.
-
#options ⇒ Object
Returns the value of attribute options.
-
#placeholder ⇒ Object
Returns the value of attribute placeholder.
-
#required ⇒ Object
Returns the value of attribute required.
-
#rows ⇒ Object
Returns the value of attribute rows.
-
#section ⇒ Object
Returns the value of attribute section.
-
#type ⇒ Object
Returns the value of attribute type.
Instance Method Summary collapse
- #checkbox? ⇒ Boolean
- #help_text ⇒ Object
-
#label_text ⇒ Object
Wording resolution: inline schema values win, then i18n under bug_reports_client.fields.
.*, then a humanised fallback. - #placeholder_text ⇒ Object
- #prompt_text ⇒ Object
- #required? ⇒ Boolean
- #select? ⇒ Boolean
Instance Attribute Details
#help ⇒ Object
Returns the value of attribute help
33 34 35 |
# File 'lib/bug_reports_client/form_schema.rb', line 33 def help @help end |
#key ⇒ Object
Returns the value of attribute key
33 34 35 |
# File 'lib/bug_reports_client/form_schema.rb', line 33 def key @key end |
#label ⇒ Object
Returns the value of attribute label
33 34 35 |
# File 'lib/bug_reports_client/form_schema.rb', line 33 def label @label end |
#options ⇒ Object
Returns the value of attribute options
33 34 35 |
# File 'lib/bug_reports_client/form_schema.rb', line 33 def @options end |
#placeholder ⇒ Object
Returns the value of attribute placeholder
33 34 35 |
# File 'lib/bug_reports_client/form_schema.rb', line 33 def placeholder @placeholder end |
#required ⇒ Object
Returns the value of attribute required
33 34 35 |
# File 'lib/bug_reports_client/form_schema.rb', line 33 def required @required end |
#rows ⇒ Object
Returns the value of attribute rows
33 34 35 |
# File 'lib/bug_reports_client/form_schema.rb', line 33 def rows @rows end |
#section ⇒ Object
Returns the value of attribute section
33 34 35 |
# File 'lib/bug_reports_client/form_schema.rb', line 33 def section @section end |
#type ⇒ Object
Returns the value of attribute type
33 34 35 |
# File 'lib/bug_reports_client/form_schema.rb', line 33 def type @type end |
Instance Method Details
#checkbox? ⇒ Boolean
36 |
# File 'lib/bug_reports_client/form_schema.rb', line 36 def checkbox? = type == "checkbox" |
#help_text ⇒ Object
48 49 50 |
# File 'lib/bug_reports_client/form_schema.rb', line 48 def help_text help || I18n.t("bug_reports_client.fields.#{key}.help", default: nil) end |
#label_text ⇒ Object
Wording resolution: inline schema values win, then i18n under
bug_reports_client.fields.
40 41 42 |
# File 'lib/bug_reports_client/form_schema.rb', line 40 def label_text label || I18n.t("bug_reports_client.fields.#{key}.label", default: key.humanize) end |
#placeholder_text ⇒ Object
44 45 46 |
# File 'lib/bug_reports_client/form_schema.rb', line 44 def placeholder_text placeholder || I18n.t("bug_reports_client.fields.#{key}.placeholder", default: nil) end |
#prompt_text ⇒ Object
52 53 54 55 |
# File 'lib/bug_reports_client/form_schema.rb', line 52 def prompt_text I18n.t("bug_reports_client.fields.#{key}.prompt", default: I18n.t("bug_reports_client.form.select_prompt")) end |
#required? ⇒ Boolean
34 |
# File 'lib/bug_reports_client/form_schema.rb', line 34 def required? = !!required |
#select? ⇒ Boolean
35 |
# File 'lib/bug_reports_client/form_schema.rb', line 35 def select? = type == "select" |