Sha256: 7ce1a1dca471942496a7d13243c03dcf4a9b25a2c59ca890417e5b9031276931

Contents?: true

Size: 688 Bytes

Versions: 23

Compression:

Stored size: 688 Bytes

Contents

function remove_fields(link) {
  jQuery(link).prev("input[type=hidden]").val("1");
  jQuery(link).closest(".well").hide();
  jQuery(link).closest(".nested_field").hide();
}

function add_fields(link, association, content) {
  var new_id = new Date().getTime();
  var regexp = new RegExp("new_" + association, "g");
  var new_content = content.replace(regexp, new_id);
  jQuery(link).parent().before(new_content);

  $(new_content).find('.nested_ckeditor').each(function(){
    try { CKEDITOR.replace($(this).attr('id')); } catch(e){}  
  });
  renderSingleTokensById('opened_course_class_course_schedules_attributes_' + new_id + '_classroom_tokens', '/classrooms/autocomplete.json');
}


Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
rich_table_component-0.0.4 vendor/assets/javascripts/nested_attribute_action.js
rich_table_component-0.0.3 vendor/assets/javascripts/nested_attribute_action.js
rich_table_component-0.0.2 vendor/assets/javascripts/nested_attribute_action.js