Class: DrgcmsFormFields::Action

Inherits:
DrgcmsField show all
Defined in:
app/models/drgcms_form_fields/action.rb

Overview

Implementation of action DRG CMS form field. Actions can also be inserted on the form like just like on action pane.

Form options:

  • type: action (required)

  • action_type: link, submit or ajax action (default link)

  • caption: Caption for action

  • icon: Action icon

  • url: direct url link

  • controller: controller name

  • action: action name

  • html: html options which apply to link_to (optional)

Form example:

30:
  type: link_to
  caption: Some action
  icon: cogs
  controller: my_controller
  action: my_action
  id: id # will be replaced by record._id

Instance Attribute Summary

Attributes inherited from DrgcmsField

#css, #js

Instance Method Summary collapse

Methods inherited from DrgcmsField

#__css_code, get_data, #hash_to_options, #html, #initialize, #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

#renderObject

Render link_to field html code



53
54
55
56
57
58
# File 'app/models/drgcms_form_fields/action.rb', line 53

def render
  @yaml['type'] = @yaml['action_type'] || 'link'
  #
  @html << '<ul class="action">' + @parent.dc_link_ajax_window_submit_action(@yaml,@record) + '</ul>'
  self
end