Class: AgileFormFields::Action

Inherits:
AgileFormField show all
Defined in:
app/models/agile_form_fields/action.rb

Overview

Implementation of action AgileRails 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: action
 action_type: popup
 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 AgileFormField

#css, #js

Instance Method Summary collapse

Methods inherited from AgileFormField

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 AgileFormFields::AgileFormField

Instance Method Details

#renderObject

Render link_to field html code



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

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