Merge remote-tracking branch 'origin/develop' into wip/laravel-6

This commit is contained in:
Ben Thomson 2020-02-26 17:40:47 +08:00
commit 0394494fbe
12 changed files with 62 additions and 40 deletions

View File

@ -212,7 +212,7 @@ class ListController extends ControllerBehavior
*/
if ($searchWidget = $toolbarWidget->getSearchWidget()) {
$searchWidget->bindEvent('search.submit', function () use ($widget, $searchWidget) {
$widget->setSearchTerm($searchWidget->getActiveTerm());
$widget->setSearchTerm($searchWidget->getActiveTerm(), true);
return $widget->onRefresh();
});

View File

@ -139,7 +139,7 @@
right: auto;
}
.field-markdowneditor.is-fullscreen {
z-index: 300;
z-index: 600;
position: fixed !important;
top: 0;
left: 0;

View File

@ -89,7 +89,7 @@ return [
'updates_link' => 'Mettre à jour',
'warnings_pending' => 'Certaines anomalies méritent votre attention',
'warnings_nil' => 'Aucun avertissement à afficher',
'warnings_link' => 'Vue',
'warnings_link' => 'Voir',
'core_build' => 'Version du système',
'event_log' => 'Journal des évènements',
'request_log' => 'Journal des requêtes',

View File

@ -506,14 +506,14 @@ class Form extends WidgetBase
*
* Event::listen('backend.form.extendFieldsBefore', function ((\Backend\Widgets\Form) $formWidget) {
* // You should always check to see if you're extending correct model/controller
* if (!$widget->model instanceof \Foo\Example\Models\Bar) {
* if (!$formWidget->model instanceof \Foo\Example\Models\Bar) {
* return;
* }
*
* // Here you can't use addFields() because it will throw you an exception because form is not yet created
* // and it does not have tabs and fields
* // For this example we will pretend that we want to add a new field named example_field
* $widget->fields['example_field'] = [
* $formWidget->fields['example_field'] = [
* 'label' => 'Example field',
* 'comment' => 'Your example field',
* 'type' => 'text',
@ -524,14 +524,14 @@ class Form extends WidgetBase
*
* $formWidget->bindEvent('form.extendFieldsBefore', function () use ((\Backend\Widgets\Form $formWidget)) {
* // You should always check to see if you're extending correct model/controller
* if (!$widget->model instanceof \Foo\Example\Models\Bar) {
* if (!$formWidget->model instanceof \Foo\Example\Models\Bar) {
* return;
* }
*
* // Here you can't use addFields() because it will throw you an exception because form is not yet created
* // and it does not have tabs and fields
* // For this example we will pretend that we want to add a new field named example_field
* $widget->fields['example_field'] = [
* $formWidget->fields['example_field'] = [
* 'label' => 'Example field',
* 'comment' => 'Your example field',
* 'type' => 'text',
@ -579,17 +579,17 @@ class Form extends WidgetBase
*
* Event::listen('backend.form.extendFields', function ((\Backend\Widgets\Form) $formWidget) {
* // Only for the User controller
* if (!$widget->getController() instanceof \RainLab\User\Controllers\Users) {
* if (!$formWidget->getController() instanceof \RainLab\User\Controllers\Users) {
* return;
* }
*
* // Only for the User model
* if (!$widget->model instanceof \RainLab\User\Models\User) {
* if (!$formWidget->model instanceof \RainLab\User\Models\User) {
* return;
* }
*
* // Add an extra birthday field
* $widget->addFields([
* $formWidget->addFields([
* 'birthday' => [
* 'label' => 'Birthday',
* 'comment' => 'Select the users birthday',
@ -598,24 +598,24 @@ class Form extends WidgetBase
* ]);
*
* // Remove a Surname field
* $widget->removeField('surname');
* $formWidget->removeField('surname');
* });
*
* Or
*
* $formWidget->bindEvent('form.extendFields', function () use ((\Backend\Widgets\Form $formWidget)) {
* // Only for the User controller
* if (!$widget->getController() instanceof \RainLab\User\Controllers\Users) {
* if (!$formWidget->getController() instanceof \RainLab\User\Controllers\Users) {
* return;
* }
*
* // Only for the User model
* if (!$widget->model instanceof \RainLab\User\Models\User) {
* if (!$formWidget->model instanceof \RainLab\User\Models\User) {
* return;
* }
*
* // Add an extra birthday field
* $widget->addFields([
* $formWidget->addFields([
* 'birthday' => [
* 'label' => 'Birthday',
* 'comment' => 'Select the users birthday',
@ -624,7 +624,7 @@ class Form extends WidgetBase
* ]);
*
* // Remove a Surname field
* $widget->removeField('surname');
* $formWidget->removeField('surname');
* });
*
*/
@ -1294,6 +1294,9 @@ class Form extends WidgetBase
if (!is_array($fieldOptions) && !$fieldOptions) {
try {
list($model, $attribute) = $field->resolveModelAttribute($this->model, $field->fieldName);
if (!$model) {
throw new Exception();
}
}
catch (Exception $ex) {
throw new ApplicationException(Lang::get('backend::lang.field.options_method_invalid_model', [

View File

@ -210,7 +210,9 @@ class Lists extends WidgetBase
/*
* Configure the list widget
*/
if ($this->showSetup) {
$this->recordsPerPage = $this->getUserPreference('per_page', $this->recordsPerPage);
}
if ($this->showPagination == 'auto') {
$this->showPagination = $this->recordsPerPage && $this->recordsPerPage > 0;
@ -640,9 +642,7 @@ class Lists extends WidgetBase
protected function getCurrentPageNumber($query)
{
$currentPageNumber = $this->currentPageNumber;
if (!$currentPageNumber && empty($this->searchTerm)) {
// Restore the last visited page from the session if available.
if (empty($currentPageNumber)) {
$currentPageNumber = $this->getSession('lastVisitedPage');
}
@ -728,7 +728,7 @@ class Lists extends WidgetBase
/*
* Supplied column list
*/
if ($this->columnOverride === null) {
if ($this->showSetup && $this->columnOverride === null) {
$this->columnOverride = $this->getUserPreference('visible', null);
}
@ -1408,13 +1408,18 @@ class Lists extends WidgetBase
* Applies a search term to the list results, searching will disable tree
* view if a value is supplied.
* @param string $term
* @param boolean $resetPagination
*/
public function setSearchTerm($term)
public function setSearchTerm($term, $resetPagination = false)
{
if (!empty($term)) {
$this->showTree = false;
}
if ($resetPagination) {
$this->currentPageNumber = 1;
}
$this->searchTerm = $term;
}

View File

@ -166,7 +166,10 @@
* Render tab form fields once a lazy tab is selected.
*/
FormWidget.prototype.bindLazyTabs = function() {
this.$el.on('click', '.tab-lazy [data-toggle="tab"]', function() {
var tabControl = $('[data-control=tab]', this.$el),
tabContainer = $('.nav-tabs', tabControl)
tabContainer.on('click', '.tab-lazy [data-toggle="tab"]', function() {
var $el = $(this),
handlerName = $el.data('tab-lazy-handler')
@ -191,6 +194,11 @@
}
})
})
// If initial active tab is lazy loaded, load it immediately
if ($('> li.active.tab-lazy', tabContainer).length) {
$('> li.active.tab-lazy > [data-toggle="tab"]', tabContainer).trigger('click')
}
}
/*

View File

@ -1,6 +1,6 @@
<!-- Number -->
<?php if ($this->previewMode): ?>
<span class="form-control"><?= $field->value ? e($field->value) : '&nbsp;' ?></span>
<span class="form-control"><?= isset($field->value) ? e($field->value) : '&nbsp;' ?></span>
<?php else: ?>
<?php
$min = isset($field->config['min']) ? $field->config['min'] : false;

View File

@ -34,7 +34,8 @@
name="page"
class="form-control input-sm custom-select select-no-search"
data-request="<?= $this->getEventHandler('onPaginate') ?>"
data-load-indicator="<?= e(trans('backend::lang.list.loading')) ?>">
data-load-indicator="<?= e(trans('backend::lang.list.loading')) ?>"
autocomplete="off">
<?php for($i = 1; $i <= $pageLast ; $i++): ?>
<option value="<?= $i ?>" <?= $i === $pageCurrent ? 'selected' : '' ?>><?= $i ?></option>
<?php endfor ?>

View File

@ -29,7 +29,8 @@
<select
disabled
name="page"
class="form-control input-sm custom-select select-no-search">
class="form-control input-sm custom-select select-no-search"
autocomplete="off">
<option value="<?= $pageCurrent ?>" selected><?= $pageCurrent ?></option>
</select>
<?php if ($hasMorePages): ?>

View File

@ -11,7 +11,7 @@ return [
'error_deleting' => "Error deleting the template file ':name'. Please check write permissions.",
'delete_success' => 'Templates deleted: :count.',
'file_name_required' => 'The File Name field is required.',
'safe_mode_enabled' => 'Safe mode is currently enabled. Editing the PHP code of CMS templates is disabled.'
'safe_mode_enabled' => 'Safe mode is currently enabled. Editing the PHP code of CMS templates is disabled. To disable safe mode, set the `cms.enableSafeMode` configuration value to `false`.',
],
'dashboard' => [
'active_theme' => [

View File

@ -13,20 +13,25 @@
*/
$(document).render(function(){
var formatSelectOption = function(state) {
if (!state.id)
return state.text; // optgroup
var text = $('<span>').text(state.text).html()
if (!state.id) {
return text // optgroup
}
var $option = $(state.element),
iconClass = state.icon ? state.icon : $option.data('icon'),
imageSrc = state.image ? state.image : $option.data('image')
if (iconClass)
return '<i class="select-icon '+iconClass+'"></i> ' + state.text
if (iconClass) {
return '<i class="select-icon '+iconClass+'"></i> ' + text
}
if (imageSrc)
return '<img class="select-image" src="'+imageSrc+'" alt="" /> ' + state.text
if (imageSrc) {
return '<img class="select-image" src="'+imageSrc+'" alt="" /> ' + text
}
return state.text
return text
}
var selectOptions = {

View File

@ -3496,13 +3496,12 @@ if(!isReset){var numberinputs=$('.field-number input','#controlFilterPopoverNum'
numberinputs.each(function(index,numberinput){var number=$(numberinput).val()
numbers.push(number)})}
this.updateScopeNumberSetting(this.$activeScope,numbers);this.scopeValues[this.activeScopeName]={numbers:numbers}
this.isActiveScopeDirty=true;this.$activeScope.data('oc.popover').hide()}}(window.jQuery);(function($){$(document).render(function(){var formatSelectOption=function(state){if(!state.id)
return state.text;var $option=$(state.element),iconClass=state.icon?state.icon:$option.data('icon'),imageSrc=state.image?state.image:$option.data('image')
if(iconClass)
return'<i class="select-icon '+iconClass+'"></i> '+state.text
if(imageSrc)
return'<img class="select-image" src="'+imageSrc+'" alt="" /> '+state.text
return state.text}
this.isActiveScopeDirty=true;this.$activeScope.data('oc.popover').hide()}}(window.jQuery);(function($){$(document).render(function(){var formatSelectOption=function(state){var text=$('<span>').text(state.text).html()
if(!state.id){return text}
var $option=$(state.element),iconClass=state.icon?state.icon:$option.data('icon'),imageSrc=state.image?state.image:$option.data('image')
if(iconClass){return'<i class="select-icon '+iconClass+'"></i> '+text}
if(imageSrc){return'<img class="select-image" src="'+imageSrc+'" alt="" /> '+text}
return text}
var selectOptions={templateResult:formatSelectOption,templateSelection:formatSelectOption,escapeMarkup:function(m){return m},width:'style'}
$('select.custom-select').each(function(){var $element=$(this),extraOptions={dropdownCssClass:'',containerCssClass:''}
if($element.data('select2')!=null){return true;}