mirror of
https://github.com/wintercms/winter.git
synced 2024-06-28 05:33:29 +02:00
Remove hard coded widget name for lazy tabs (#4839)
- The widget alias may not always be form, so pass the handler name - No need to spam non-lazy tabs with useless data tags
This commit is contained in:
parent
3a49b5fa7a
commit
953061797d
@ -167,8 +167,10 @@
|
||||
*/
|
||||
FormWidget.prototype.bindLazyTabs = function() {
|
||||
this.$el.on('click', '.tab-lazy [data-toggle="tab"]', function() {
|
||||
var $el = $(this)
|
||||
$.request('form::onLazyLoadTab', {
|
||||
var $el = $(this),
|
||||
handlerName = $el.data('tab-lazy-handler')
|
||||
|
||||
$.request(handlerName, {
|
||||
data: {
|
||||
target: $el.data('target'),
|
||||
name: $el.data('tab-name'),
|
||||
|
@ -13,12 +13,18 @@
|
||||
?>
|
||||
<div class="<?= $navCss ?>">
|
||||
<ul class="nav nav-tabs">
|
||||
<?php $index = 0; foreach ($tabs as $name => $fields): ?>
|
||||
<?php
|
||||
$lazy = in_array($name, $tabs->lazy);
|
||||
?>
|
||||
<?php $index = 0; foreach ($tabs as $name => $fields):
|
||||
$lazy = in_array($name, $tabs->lazy);
|
||||
?>
|
||||
<li class="<?= ($index++ === 0) ? 'active' : '' ?> <?= $lazy ? 'tab-lazy' : '' ?>">
|
||||
<a href="#<?= $type . 'tab-' . $index ?>" data-tab-name="<?= e($name) ?>" data-tab-section="<?= $type ?>">
|
||||
<a
|
||||
href="#<?= $type . 'tab-' . $index ?>"
|
||||
<?php if ($lazy): ?>
|
||||
data-tab-name="<?= e($name) ?>"
|
||||
data-tab-section="<?= $type ?>"
|
||||
data-tab-lazy-handler="<?= $this->getEventHandler('onLazyLoadTab') ?>"
|
||||
<?php endif ?>
|
||||
>
|
||||
<span class="title">
|
||||
<span>
|
||||
<?php if ($tabs->getIcon($name)): ?><span class="<?= $tabs->getIcon($name) ?>"></span><?php endif; ?>
|
||||
|
Loading…
x
Reference in New Issue
Block a user