Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is there any way to define the limit of clone? #59

Closed
jairobjunior opened this issue Apr 21, 2012 · 5 comments
Closed

Is there any way to define the limit of clone? #59

jairobjunior opened this issue Apr 21, 2012 · 5 comments

Comments

@jairobjunior
Copy link

like this: http://www.andresvidal.com/labs/relcopy.html

thanks

@nathanvda
Copy link
Owner

You mean like adding at most 5 children. That is a nice idea, but not possible at the moment.

@jairobjunior
Copy link
Author

Yes, it is. I did quickly, using this piece of code:

#This function should be used at onclick in each remove button. ie: "input.... onclick="show_add_sale_payment_button()" "
@show_add_sale_payment_button = () ->
    $("#add_sale_payment").show();

jQuery ->
  $("#add_sale_payment").click(->        
    if $(".sale_payments").length == 2
      $(this).hide();
  );

@nathanvda
Copy link
Owner

Ok, I thought you ment possible as in "is it an option from cocoon". Nice work.

@jairobjunior jairobjunior reopened this Apr 23, 2012
@jairobjunior
Copy link
Author

Yes. This was only a workaround. ;D
I will study a way to put as a feature from cocoon.

@akirill0v
Copy link

I am currently writing a gem to limit the amount of added elements in the cocoon (+ with possibility to limit through data-attribute). Version will be ready for testing on Monday )))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants