繁体   English   中英

如何从其他刀片文件打开引导模式? (拉拉维尔)

[英]how to open bootstrap modal from other blade file ? (laravel)

1.this is present in file index.blade.php.In this between html code an button tag is placed in which data target is present in different file.Can it's possible to trigger the modal from remote button

<button class="btn btn-small btn-warning btn-circle" data-toggle="modal" data-target=".ept-modal" onclick="productTestMapModal('<?=base64_encode(base64_encode($product->id));?>')">Available Tests</button>

2.而模态目标文件是

<div class="clear-back">
<div class="modal-header">
    {{ $product->name }} - Available tests
    <button type="button" title="Close" class="close pull-right white" data-dismiss="modal">
        <i class="material-icons">close</i>
    </button>
</div>
<div class="pad-15">
    <span class="text-success"><i class="fa fa-circle user-online"></i> Select tests to be mapped in {{ $product->name }}</span>
    
    <button class="btn btn-primary pull-right btn-circle" onclick="productTestMap(this, '<?=base64_encode(base64_encode($product->id));?>')">Save</button>
    
    <div class="clearfix"></div><br/>
    

    <div style="width:99%;overflow-y:auto;">
        <table class="table">
            <thead>
                <tr class="center">
                    @foreach($product->course->testGroups as $testgroup)
                        <th>{{ $testgroup->name }}   
                            <button class="btn btn-primary btn-circle btn-sm" onclick="selectTestgroups('{{$testgroup->id}}')">Select All</button>
                            <button class="btn btn-primary btn-circle btn-sm" onclick="unselectTestgroups('{{$testgroup->id}}')">UnSelect All</button>
                        </th>
                    @endforeach
                </tr>
            </thead>
            <tbody>
                <tr>
                    @foreach($product->course->testGroups as $testgroup)
                        <td>
                            @foreach($testgroup->subgroups as $subgroup)
                                @foreach($subgroup->tests as $t)
                                    <span class="badge badgetest_{{$testgroup->id}} {{ in_array($t->id,$product_tests) ? 'selected' : '' }}" onclick="toggleSelection(this)"><span class="test-id hidden">{{ $t->id }}</span>{{ $t->name }}</span>
                                @endforeach
                            @endforeach
                        </td>
                    @endforeach
                </tr>
            </tbody>
        </table>
    </div>

    <div class="clearfix"></div><br/>
</div>

为了从另一个刀片文件打开模态,您必须在目标文件 index.blade.php 中包含该文件,按钮,如下所示: @include('rel_path_to_modal_file.modal_file_name')

请按照引导文档使用模态,因为它通过 id 调用,而不是 class。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM