Merge branch 'develop' into wip/laravel-6

This commit is contained in:
Luke Towers 2020-04-04 23:16:56 -06:00
commit 9574e2dba9
9 changed files with 43 additions and 12 deletions

View File

@ -1500,13 +1500,13 @@ class RelationController extends ControllerBehavior
case 'morphedByMany':
case 'belongsToMany':
$buttons = ['create', 'add', 'delete', 'remove'];
break;
break;
case 'hasOne':
case 'morphOne':
case 'belongsTo':
$buttons = ['create', 'update', 'link', 'delete', 'unlink'];
break;
break;
}
}
}

View File

@ -62,6 +62,11 @@ class FormTabs implements IteratorAggregate, ArrayAccess
*/
public $paneCssClass;
/**
* @var bool Each tab gets url fragment to be linkable.
*/
public $linkable = true;
/**
* Constructor.
* Specifies a tabs rendering section. Supported sections are:
@ -112,6 +117,10 @@ class FormTabs implements IteratorAggregate, ArrayAccess
$this->paneCssClass = $config['paneCssClass'];
}
if (array_key_exists('linkable', $config)) {
$this->linkable = (bool) $config['linkable'];
}
if (array_key_exists('lazy', $config)) {
$this->lazy = $config['lazy'];
}

View File

@ -622,6 +622,7 @@ class Filter extends WidgetBase
'maxDate' => '2099-12-31',
'firstDay' => 0,
'yearRange' => 10,
'ignoreTimezone' => false,
];
break;

View File

@ -9,8 +9,9 @@
'maxDate' => $scope->maxDate,
'firstDay' => $scope->firstDay,
'yearRange' => $scope->yearRange,
]))
?>">
])) ?>"
<?php $scope->ignoreTimezone ? 'data-ignore-timezone' : ''; ?>
>
<span class="filter-label"><?= e(trans($scope->label)) ?>:</span>
<span class="filter-setting"><?= isset($dateStr) ? $dateStr : e(trans('backend::lang.filter.date_all')) ?></span>
</a>

View File

@ -9,8 +9,9 @@
'maxDate' => $scope->maxDate,
'firstDay' => $scope->firstDay,
'yearRange' => $scope->yearRange,
]))
?>">
])) ?>"
<?php $scope->ignoreTimezone ? 'data-ignore-timezone' : ''; ?>
>
<span class="filter-label"><?= e(trans($scope->label)) ?>:</span>
<span class="filter-setting"><?= isset($afterStr) && isset($beforeStr) ? ($afterStr . ' → ' . $beforeStr) : e(trans('backend::lang.filter.date_all')) ?></span>
</a>

View File

@ -12,13 +12,13 @@
}
?>
<div class="<?= $navCss ?>">
<ul class="nav nav-tabs">
<ul class="nav nav-tabs" <?= $tabs->linkable ? 'data-linkable' : '' ?>>
<?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 ?>"
href="#<?= $type . 'tab-' . ($tabs->linkable ? str_slug($name) : $index) ?>"
<?php if ($lazy): ?>
data-tab-name="<?= e($name) ?>"
data-tab-section="<?= $type ?>"

View File

@ -29,6 +29,8 @@
FilterWidget.prototype.init = function () {
overloaded_init.apply(this)
this.ignoreTimezone = this.$el.children().get(0).hasAttribute('data-ignore-timezone');
this.initRegion()
this.initFilterDate()
}
@ -396,6 +398,12 @@
if (!this.timezone) {
this.timezone = 'UTC'
}
// Set both timezones to UTC to disable converting between them
if (this.ignoreTimezone) {
this.appTimezone = 'UTC'
this.timezone = 'UTC'
}
}
}(window.jQuery);

View File

@ -38,7 +38,7 @@
var force = (data !== undefined && data.force !== undefined) ? data.force : false;
self.closeTab($(ev.target).closest('ul.nav-tabs > li, div.tab-content > div'), force)
})
this.$el.on('mousedown', "li[data-tab-id]", function (ev) {
if (ev.key === '2') {
$(ev.target).trigger('close.oc.tab');
@ -65,6 +65,9 @@
$(window).trigger('oc.updateUi')
var tabUrl = $('> a', this).data('tabUrl')
if (!tabUrl && $(this).parent('ul').is('[data-linkable]')) {
tabUrl = $('> a', this).attr('href')
}
if (tabUrl) {
window.history.replaceState({}, 'Tab link reference', tabUrl)
}
@ -84,6 +87,10 @@
})
this.updateClasses()
if (location.hash && this.$tabsContainer.is('[data-linkable]')) {
$('li > a[href=' + location.hash + ']', this.$tabsContainer).tab('show')
}
}
Tab.prototype.initTab = function(li) {

View File

@ -3243,7 +3243,7 @@ $.fn.filterWidget.Constructor=FilterWidget
$.fn.filterWidget.noConflict=function(){$.fn.filterWidget=old
return this}
$(document).render(function(){$('[data-control="filterwidget"]').filterWidget();})}(window.jQuery);+function($){"use strict";var FilterWidget=$.fn.filterWidget.Constructor;var overloaded_init=FilterWidget.prototype.init;FilterWidget.prototype.init=function(){overloaded_init.apply(this)
this.initRegion()
this.ignoreTimezone=this.$el.children().get(0).hasAttribute('data-ignore-timezone');this.initRegion()
this.initFilterDate()}
FilterWidget.prototype.initFilterDate=function(){var self=this
this.$el.on('show.oc.popover','a.filter-scope-date',function(event){self.initDatePickers($(this).hasClass('range'))
@ -3378,7 +3378,9 @@ FilterWidget.prototype.initRegion=function(){this.locale=$('meta[name="backend-l
this.timezone=$('meta[name="backend-timezone"]').attr('content')
this.appTimezone=$('meta[name="app-timezone"]').attr('content')
if(!this.appTimezone){this.appTimezone='UTC'}
if(!this.timezone){this.timezone='UTC'}}}(window.jQuery);+function($){"use strict";var FilterWidget=$.fn.filterWidget.Constructor;var overloaded_init=FilterWidget.prototype.init;FilterWidget.prototype.init=function(){overloaded_init.apply(this)
if(!this.timezone){this.timezone='UTC'}
if(this.ignoreTimezone){this.appTimezone='UTC'
this.timezone='UTC'}}}(window.jQuery);+function($){"use strict";var FilterWidget=$.fn.filterWidget.Constructor;var overloaded_init=FilterWidget.prototype.init;FilterWidget.prototype.init=function(){overloaded_init.apply(this)
this.initFilterNumber()}
FilterWidget.prototype.initFilterNumber=function(){var self=this
this.$el.on('show.oc.popover','a.filter-scope-number',function(event){self.initNumberInputs($(this).hasClass('range'))
@ -4579,10 +4581,12 @@ this.$el.on('unmodified.oc.tab',function(ev){ev.preventDefault()
self.unmodifyTab($(ev.target).closest('ul.nav-tabs > li, div.tab-content > div'))})
this.$tabsContainer.on('shown.bs.tab','li',function(){$(window).trigger('oc.updateUi')
var tabUrl=$('> a',this).data('tabUrl')
if(!tabUrl&&$(this).parent('ul').is('[data-linkable]')){tabUrl=$('> a',this).attr('href')}
if(tabUrl){window.history.replaceState({},'Tab link reference',tabUrl)}})
if(this.options.slidable){this.$pagesContainer.touchwipe({wipeRight:function(){self.prev();},wipeLeft:function(){self.next();},preventDefaultEvents:false,min_move_x:60});}
this.$tabsContainer.toolbar({scrollClassContainer:this.$el})
this.updateClasses()}
this.updateClasses()
if(location.hash&&this.$tabsContainer.is('[data-linkable]')){$('li > a[href='+location.hash+']',this.$tabsContainer).tab('show')}}
Tab.prototype.initTab=function(li){var
$tabs=$('>li',this.$tabsContainer),tabIndex=$tabs.index(li),time=new Date().getTime(),targetId=this.tabId+'-tab-'+tabIndex+time,$anchor=$('a',li)
$anchor.data('target','#'+targetId).attr('data-target','#'+targetId).attr('data-toggle','tab')