Sha256: 77a3ca288ecb5fe8ee6116dad1247c35b8b62e782802b11a2552529be16b9c05

Contents?: true

Size: 840 Bytes

Versions: 5

Compression:

Stored size: 840 Bytes

Contents

ActionView::Base.class_eval do

  # name is ClassName of form you want
  # options are optional
  # options = {
  #   :internal_identifier => 'iid of exact form you want' (a model can have multiple forms)
  #   :width => 'width of form in pixels'
  # }
  def render_dynamic_form(name, options={})
    output = raw '&nbsp<script type="text/javascript">Ext.onReady(function() {'
    output += raw "new OnDemandLoadByAjax().load(['/javascripts/erp_app/shared/dynamic_forms/dynamic_form_fields.js'], function(){"

    output += raw DynamicForm.get_form(name.to_s, options[:internal_identifier]).to_extjs_widget(
                { :url => build_widget_url(:new),
                  :widget_result_id => widget_result_id,
                  :width => options[:width] 
                })

    output += raw '}); });</script>'
    output
  end
  
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
erp_forms-3.1.2 lib/erp_forms/extensions/railties/action_view.rb
erp_forms-3.1.1 lib/erp_forms/extensions/railties/action_view.rb
erp_forms-3.1.0 lib/erp_forms/extensions/railties/action_view.rb
erp_forms-3.0.2 lib/erp_forms/extensions/railties/action_view.rb
erp_forms-3.0.1 lib/erp_forms/extensions/railties/action_view.rb