Sha256: 970f1a31d00652b63c22e5b212422b0be769942c4fd515efb10e1f5305bc11c6

Contents?: true

Size: 1.25 KB

Versions: 5

Compression:

Stored size: 1.25 KB

Contents

form_selector = "#{element_form_id(:action => :create)}"

page << "ActiveScaffold.find_action_link('#{form_selector}').update_flash_messages('#{escape_javascript(render(:partial => 'messages').strip)}');"
if controller.send :successful?
  if @insert_row
    new_row = render :partial => 'list_record', :locals => {:record => @record}
    insert_at ||= :top
    page << "ActiveScaffold.create_record_row('#{active_scaffold_tbody_id}','#{escape_javascript(new_row)}', #{{:insert_at => insert_at}.to_json});"
    page.call 'ActiveScaffold.replace', active_scaffold_calculations_id, render(:partial => 'list_calculations') if active_scaffold_config.list.columns.any? {|c| c.calculation?}
  end

  if (active_scaffold_config.create.persistent)
    page << "ActiveScaffold.find_action_link('#{form_selector}').reload();"
  else
    page << "ActiveScaffold.find_action_link('#{form_selector}').close();"
  end
  if (active_scaffold_config.create.edit_after_create)
    page << "var link = $('#{action_link_id 'edit', @record.id}');"
    page << "if (link) (function() { link.action_link.open() }).defer();"
  end
else
  page.call 'ActiveScaffold.replace', form_selector, render(:partial => 'create_form', :locals => {:xhr => true})
  page.call 'ActiveScaffold.scroll_to', form_selector
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
active_scaffold-3.0.5 frontends/default/views/on_create.js.rjs
active_scaffold-3.0.4 frontends/default/views/on_create.js.rjs
active_scaffold-3.0.2 frontends/default/views/on_create.js.rjs
active_scaffold-3.0.1 frontends/default/views/on_create.js.rjs
active_scaffold-3.0.0 frontends/default/views/on_create.js.rjs