Class: DrgcmsFormFields::SubmitTag

Inherits:
DrgcmsField show all
Defined in:
app/models/drgcms_form_fields.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

#html, #js

Instance Method Summary collapse

Methods inherited from DrgcmsField

get_data, #hash_to_options, #initialize, #record_text_for, #ro_standard, #set_initial_value, #set_style, #t

Constructor Details

This class inherits a constructor from DrgcmsFormFields::DrgcmsField

Instance Method Details

#renderObject

Render submit_tag field html code



850
851
852
853
854
855
856
857
858
859
# File 'app/models/drgcms_form_fields.rb', line 850

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