Sha256: 6351ff5391b75e76810ac44ec9640de381e1e0ac5f10db4d05c47fa0beede952

Contents?: true

Size: 1.3 KB

Versions: 3

Compression:

Stored size: 1.3 KB

Contents

try {
<% link_selector = "#{element_form_id(:action => :clone)}"
insert_at ||= :top %>
var action_link = ActiveScaffold.find_action_link('<%= link_selector%>');
action_link.update_flash_messages('<%=escape_javascript(render(:partial => 'messages'))%>');
<% if controller.send :successful? %>
  <% if (active_scaffold_config.clone.refresh_list) %>
    <%= render :partial => 'refresh_list' %>
  <% else %>
    <% new_row = render :partial => 'list_record', :locals => {:record => @record} %>
    ActiveScaffold.create_record_row(action_link.scaffold(),'<%= escape_javascript(new_row) %>', <%= {:insert_at => insert_at}.to_json.html_safe %>);
    <%= render :partial => 'update_calculations', :formats => [:js] %>
  <% end %>

  action_link.close();
  <% if (active_scaffold_config.clone.action_after_clone) %>
    var link = ActiveScaffold.find_action_link('<%= action_link_id active_scaffold_config.clone.action_after_clone, @record.id %>');
    if (link) (function() { link.open() })<%= '.defer' if ActiveScaffold.js_framework == :prototype %>();
  <% end %>
<% else %>
  ActiveScaffold.replace('<%= form_selector %>','<%= escape_javascript(render(:partial => 'create_form', :locals => {:xhr => true})) %>');
  ActiveScaffold.scroll_to('<%= form_selector %>', true);
<% end %>
} catch (e) { alert('RJS error:\n\n' + e.toString());}

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
active_scaffold_duplicate-1.0.2 app/views/active_scaffold_overrides/clone.js.erb~
active_scaffold_duplicate-1.0.1 app/views/active_scaffold_overrides/clone.js.erb~
active_scaffold_duplicate-1.0.0 app/views/active_scaffold_overrides/clone.js.erb~