Closed pysailor closed 9 years ago
Come to think of this more, if we get the correct number of clones, we can drop #43.
I've updated pat-clone.
It now accepts a clone-element
argument which defaults to .clone
so that the pattern can be made aware of any existing clones at load time.
I've also fixed the remove button for existing clones so that it doesn't remove the entire pat-clone element.
The documentation for pat-clone has been updated and is available here: http://patternslib.syslab.com/clone/
Scenario: An Action Plan page with several measures in place. Currently, we only show the "remove" option on freshly cloned new elements. If I add the same
<a class="icon-trash remove-clone">Remove</a>
to the existing<div class="measure pat-collapsible">
elements, then a click on it will remove all existing measures and also the button for adding a new clone.Reason: in the init function (https://github.com/Patternslib/Patterns/blob/master/src/pat/clone/clone.js#L31), the remove function is bound to the current element, which is the whole pat-clone container.
I think we need the init to scan the clone container for existing clones to 1) set the correct num_clones and to 2) bind the removal trigger to the individual clones. I'm just not sure how to mark such an existing clone the best way, maybe
class="cloned"
?