|
|
@@ -9,8 +9,8 @@
|
|
|
|
|
|
<span name="{{$column}}"></span> {{-- 用于显示错误信息 --}}
|
|
|
|
|
|
- <div class="has-many-{{$column}}" >
|
|
|
- <table class="table table-has-many has-many-{{$column}}">
|
|
|
+ <div class="has-many-{{$columnClass}}" >
|
|
|
+ <table class="table table-has-many has-many-{{$columnClass}}">
|
|
|
<thead>
|
|
|
<tr>
|
|
|
@foreach($headers as $header)
|
|
|
@@ -24,15 +24,15 @@
|
|
|
@endif
|
|
|
</tr>
|
|
|
</thead>
|
|
|
- <tbody class="has-many-{{$column}}-forms">
|
|
|
+ <tbody class="has-many-{{$columnClass}}-forms">
|
|
|
@foreach($forms as $pk => $form)
|
|
|
- <tr class="has-many-{{$column}}-form fields-group">
|
|
|
+ <tr class="has-many-{{$columnClass}}-form fields-group">
|
|
|
|
|
|
<?php $hidden = ''; ?>
|
|
|
|
|
|
@foreach($form->fields() as $field)
|
|
|
|
|
|
- @if (is_a($field, \Dcat\Admin\Form\Field\Hidden::class))
|
|
|
+ @if (is_a($field, Dcat\Admin\Form\Field\Hidden::class))
|
|
|
<?php $hidden .= $field->render(); ?>
|
|
|
@continue
|
|
|
@endif
|
|
|
@@ -54,8 +54,8 @@
|
|
|
</tbody>
|
|
|
</table>
|
|
|
|
|
|
- <template class="{{$column}}-tpl">
|
|
|
- <tr class="has-many-{{$column}}-form fields-group">
|
|
|
+ <template class="{{$columnClass}}-tpl">
|
|
|
+ <tr class="has-many-{{$columnClass}}-form fields-group">
|
|
|
|
|
|
{!! $template !!}
|
|
|
|
|
|
@@ -82,25 +82,25 @@
|
|
|
|
|
|
<script>
|
|
|
var nestedIndex = {!! $count !!},
|
|
|
- container = '.has-many-{{ $column }}';
|
|
|
+ container = '.has-many-{{ $columnClass }}';
|
|
|
|
|
|
function replaceNestedFormIndex(value) {
|
|
|
return String(value).replace(/{{ Dcat\Admin\Form\NestedForm::DEFAULT_KEY_NAME }}/g, nestedIndex);
|
|
|
}
|
|
|
|
|
|
$(container).on('click', '.add', function () {
|
|
|
- var tpl = $('template.{{ $column }}-tpl');
|
|
|
+ var tpl = $('template.{{ $columnClass }}-tpl');
|
|
|
|
|
|
nestedIndex++;
|
|
|
|
|
|
var template = replaceNestedFormIndex(tpl.html());
|
|
|
- $('.has-many-{{ $column }}-forms').append(template);
|
|
|
+ $('.has-many-{{ $columnClass }}-forms').append(template);
|
|
|
{!! $templateScript !!}
|
|
|
});
|
|
|
|
|
|
$(container).on('click', '.remove', function () {
|
|
|
- $(this).closest('.has-many-{{ $column }}-form').hide();
|
|
|
- $(this).closest('.has-many-{{ $column }}-form').find('.{{ Dcat\Admin\Form\NestedForm::REMOVE_FLAG_CLASS }}').val(1);
|
|
|
+ $(this).closest('.has-many-{{ $columnClass }}-form').hide();
|
|
|
+ $(this).closest('.has-many-{{ $columnClass }}-form').find('.{{ Dcat\Admin\Form\NestedForm::REMOVE_FLAG_CLASS }}').val(1);
|
|
|
});
|
|
|
</script>
|
|
|
|