mirror of
https://github.com/fluent/fluentd-ui.git
synced 2026-01-21 23:21:13 +01:00
27 lines
672 B
JavaScript
27 lines
672 B
JavaScript
(function(){
|
|
"use strict";
|
|
|
|
$(function(){
|
|
if($('.nested-column.multiple').length === 0) return;
|
|
|
|
var $setting = $('.nested-column.multiple:first');
|
|
var counter = 0;
|
|
|
|
$('.append', $setting).on('click', function(ev){
|
|
ev.preventDefault();
|
|
var $new = $setting.clone(true);
|
|
var elements = $('.form-control', $new);
|
|
_.each(elements, function(elm){
|
|
elm.name = elm.name.replace("0", ++counter);
|
|
});
|
|
var $close = $(this).clone().text('-');
|
|
$close.on('click', function(){
|
|
$new.remove();
|
|
});
|
|
$(".append", $new).replaceWith($close);
|
|
$new.appendTo($setting.parent());
|
|
});
|
|
});
|
|
})();
|
|
|