Sha256: 7e57dc103e04a2e3100e2044c3bfa7fb3b96fe96641ef9565329057485f76805

Contents?: true

Size: 1.99 KB

Versions: 42

Compression:

Stored size: 1.99 KB

Contents

{:uriI"¾file:///Users/khcr/Projets/Web/adeia/app/assets/javascripts/adeia/nested_form.js?type=application/javascript&pipeline=self&id=4759cec9cb50b43b4fc08617940ca90d5c127c3a8f38c5ed17a56e60a04ebeb0:ET:load_pathI"9/Users/khcr/Projets/Web/adeia/app/assets/javascripts;T:
filenameI"N/Users/khcr/Projets/Web/adeia/app/assets/javascripts/adeia/nested_form.js;T:	nameI"adeia/nested_form;T:logical_pathI"adeia/nested_form.self.js;T:content_typeI"application/javascript;T:sourceI"Ø$(document).on("ready page:load", function() {

  $(".add-fields").click(function(e) {
    e.preventDefault();
    var count = $(this).attr("data-count"), type = $(this).data("type"),
        lastFields = $("." + type + "-fields:last"), newFields = lastFields.clone();
    count++;
    newFields.find("input, select")
      .attr("name", function( i, val ) { if(val) { return val.replace(/\d/, count) } })
      .attr("id", function( i, val ) { if(val) { return val.replace(/\d/, count) } })
      .val([]);
    newFields.find("label").attr("for", function( i, val ) { return val.replace(/\d/, count) });
    newFields.insertAfter(lastFields);
    $(this).attr("data-count", count);
    newFields.show();
  });

  $(".fields-for").on("click", ".remove-fields", function(e) {
    e.preventDefault();
    var type = $(this).attr("data-type"),
        fields = $(this).parents("." + type + "-fields");
    fields.find("input[identifier=destroy]").val("1");
    fields.hide();
  });

});
;T:
metadata{:dependencieso:Set:
@hash{	I"environment-version;TTI"environment-paths;TTI"Zprocessors:type=application/javascript&file_type=application/javascript&pipeline=self;TTI"\file-digest:///Users/khcr/Projets/Web/adeia/app/assets/javascripts/adeia/nested_form.js;TT:
requiredo;;{:stubbedo;;{:
linkso;;{:charsetI"
utf-8;F:digest"%9¨h”ª@Æ•½W¿f„¹M(*lÓF´BÂ^M§:lengthiØ:dependencies_digest"%!Ò…­WÐ6a#Ð;/5l™˜¨†0(í™Ý¦ókݸ:idI"E4759cec9cb50b43b4fc08617940ca90d5c127c3a8f38c5ed17a56e60a04ebeb0;F:
mtimel+´x.V

Version data entries

42 entries across 42 versions & 1 rubygems

Version Path
adeia-0.4.0 spec/test_app/tmp/cache/assets/development/sprockets/v3.0/Nw_E9wVH6uXXL2Yg17XobgQBPfACCPgERs29_iu2Yq4.cache
adeia-0.3.0 spec/test_app/tmp/cache/assets/development/sprockets/v3.0/Nw_E9wVH6uXXL2Yg17XobgQBPfACCPgERs29_iu2Yq4.cache