Sha256: 9404b3cb56fed92da7d8760f5e4ff703f6be8134013b13e2dc01dfc8c70b541b

Contents?: true

Size: 357 Bytes

Versions: 5

Compression:

Stored size: 357 Bytes

Contents

function add_child(element, child_name, new_child) {
  $(child_name + '_children').insert({
    bottom: new_child.replace(/NEW_RECORD/g, new Date().getTime())
  });
}

function remove_child(element) {
  var hidden_field = $(element).previous("input[type=hidden]");
  if (hidden_field) {
    hidden_field.value = '1';
  }
  $(element).up(".child").hide();
}

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
view_mapper-0.3.4 lib/view_mapper/views/has_many/templates/nested_attributes.js
view_mapper-0.3.3 lib/view_mapper/views/has_many/templates/nested_attributes.js
view_mapper-0.3.2 lib/view_mapper/views/has_many/templates/nested_attributes.js
view_mapper-0.3.1 lib/view_mapper/views/has_many/templates/nested_attributes.js
view_mapper-0.3.0 lib/view_mapper/has_many_templates/nested_attributes.js