Comments (5)
You mean like adding at most 5 children. That is a nice idea, but not possible at the moment.
from cocoon.
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();
);
from cocoon.
Ok, I thought you ment possible as in "is it an option from cocoon". Nice work.
from cocoon.
Yes. This was only a workaround. ;D
I will study a way to put as a feature from cocoon.
from cocoon.
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 )))
from cocoon.
Related Issues (20)
- Rails 6 compatibility HOT 2
- Rendering the edit screen for an item with a has_one association deletes the association HOT 5
- undefined method `template' for #<ActiveRecord::Associations::CollectionProxy HOT 1
- Inserted element does not respond to change event HOT 5
- Javascript not included in Rails 7 HOT 3
- event.preventDefault(); is not working. HOT 4
- Headache with "has_many through" associations HOT 5
- Font awesome icon with link_to_add_association HOT 2
- How can i add Rails 7 ?
- Issue with application.html.haml when running rails s HOT 2
- Latest version (1.2.15) not available on NPM HOT 1
- `link_to_remove` does not remove elements from DOM, and thus does not support clearing out enum array
- load more functionality for nested child HOT 6
- Randomly auto send form after pressing on "link_to_add_association" HOT 2
- Not rendering form field in the viewthat is nested 2 step deep in the form. HOT 2
- link_to_remove_association breaks when floated HOT 1
- element.dispatchEvent(new Event(event)) doesn't work HOT 1
- Allow attaching multiple files to a nested field HOT 2
- preventDefault issue HOT 4
- Release new gem version 1.2.16
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cocoon.