Class: DrgcmsFormFields::SubmitTag
- Inherits:
-
DrgcmsField
- Object
- DrgcmsField
- DrgcmsFormFields::SubmitTag
- Defined in:
- app/models/drgcms_form_fields/submit_tag.rb
Overview
Create submit_tag form field. submit_tag form field is mostly used by polls but can be also incorporated in the middle of form.
Form options:
-
type:
submit_tag (required) -
caption:
Submit field caption -
icon:
Icon -
html:
html options which apply to link_to (optional)
Form example:
40:
type: submit_tag
caption: translate.this
icon: check
Instance Attribute Summary
Attributes inherited from DrgcmsField
Instance Method Summary collapse
-
#render ⇒ Object
Render submit_tag field html code.
Methods inherited from DrgcmsField
get_data, #hash_to_options, #html, #initialize, #options_to_hash, #record_text_for, #ro_standard, #set_css_code, #set_default_value, #set_initial_value, #set_style, #t
Constructor Details
This class inherits a constructor from DrgcmsFormFields::DrgcmsField
Instance Method Details
#render ⇒ Object
Render submit_tag field html code
46 47 48 49 50 51 52 53 54 55 |
# File 'app/models/drgcms_form_fields/submit_tag.rb', line 46 def render @yaml['html'] ||= {} @yaml['html']['class'] ||= 'dc-submit' @yaml['html'].symbolize_keys! text = @yaml['caption'] || @yaml['text'] text = t(@yaml['text']) if text.match(/\./) @html << @parent.submit_tag(text, @yaml['html']) self end |