From 153120fdc76cfb829f010cd2883c7df877b551e2 Mon Sep 17 00:00:00 2001 From: Ayumi <57409060+ayumi-cloud@users.noreply.github.com> Date: Mon, 3 Feb 2020 20:09:50 +0000 Subject: [PATCH 01/10] Improve error message for when safe mode is enabled (#4926) --- modules/cms/lang/en/lang.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/cms/lang/en/lang.php b/modules/cms/lang/en/lang.php index d3e28b27e..45c5d7044 100644 --- a/modules/cms/lang/en/lang.php +++ b/modules/cms/lang/en/lang.php @@ -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' => [ From 7d7a99f68894281029a3933ddd9770f2fbbc1bb4 Mon Sep 17 00:00:00 2001 From: Adrien Date: Sat, 8 Feb 2020 11:08:53 +0700 Subject: [PATCH 02/10] Update lang.php (#4931) Corrected dashboard warnings_link from 'Vue' to 'Voir' --- modules/backend/lang/fr/lang.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/backend/lang/fr/lang.php b/modules/backend/lang/fr/lang.php index ffb2bb1ee..a3dced1fe 100644 --- a/modules/backend/lang/fr/lang.php +++ b/modules/backend/lang/fr/lang.php @@ -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', From dc5431f9c419f025a0f0123733573bac5ec7c138 Mon Sep 17 00:00:00 2001 From: Samuel Georges Date: Sun, 9 Feb 2020 17:27:00 +1100 Subject: [PATCH 03/10] Apply z-index change to CSS Refs #3837 --- .../formwidgets/markdowneditor/assets/css/markdowneditor.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/backend/formwidgets/markdowneditor/assets/css/markdowneditor.css b/modules/backend/formwidgets/markdowneditor/assets/css/markdowneditor.css index 6207fb9cd..9b94c924e 100644 --- a/modules/backend/formwidgets/markdowneditor/assets/css/markdowneditor.css +++ b/modules/backend/formwidgets/markdowneditor/assets/css/markdowneditor.css @@ -139,7 +139,7 @@ right: auto; } .field-markdowneditor.is-fullscreen { - z-index: 300; + z-index: 600; position: fixed !important; top: 0; left: 0; From 495b0f085a19a6f73fb2058d01e06bb6fcf53cd7 Mon Sep 17 00:00:00 2001 From: Rike-cz Date: Mon, 10 Feb 2020 07:24:09 +0100 Subject: [PATCH 04/10] Ignore user preferences for lists when setup modal is disabled (#4921) --- modules/backend/widgets/Lists.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/modules/backend/widgets/Lists.php b/modules/backend/widgets/Lists.php index cd2b96723..4389b13ed 100644 --- a/modules/backend/widgets/Lists.php +++ b/modules/backend/widgets/Lists.php @@ -210,7 +210,9 @@ class Lists extends WidgetBase /* * Configure the list widget */ - $this->recordsPerPage = $this->getUserPreference('per_page', $this->recordsPerPage); + if ($this->showSetup) { + $this->recordsPerPage = $this->getUserPreference('per_page', $this->recordsPerPage); + } if ($this->showPagination == 'auto') { $this->showPagination = $this->recordsPerPage && $this->recordsPerPage > 0; @@ -728,7 +730,7 @@ class Lists extends WidgetBase /* * Supplied column list */ - if ($this->columnOverride === null) { + if ($this->showSetup && $this->columnOverride === null) { $this->columnOverride = $this->getUserPreference('visible', null); } From a68f3abf1c53cc702b6e748d927d95d25c59b31a Mon Sep 17 00:00:00 2001 From: Samuell Date: Wed, 12 Feb 2020 16:52:09 +0100 Subject: [PATCH 05/10] Fix pagination reset if search input is filled (#4918) Fixes #4914. --- modules/backend/behaviors/ListController.php | 2 +- modules/backend/widgets/Lists.php | 11 +++++++---- .../widgets/lists/partials/_list_pagination.htm | 3 ++- .../lists/partials/_list_pagination_simple.htm | 3 ++- 4 files changed, 12 insertions(+), 7 deletions(-) diff --git a/modules/backend/behaviors/ListController.php b/modules/backend/behaviors/ListController.php index df01b63ea..06709017d 100644 --- a/modules/backend/behaviors/ListController.php +++ b/modules/backend/behaviors/ListController.php @@ -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(); }); diff --git a/modules/backend/widgets/Lists.php b/modules/backend/widgets/Lists.php index 4389b13ed..70eeff323 100644 --- a/modules/backend/widgets/Lists.php +++ b/modules/backend/widgets/Lists.php @@ -642,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'); } @@ -1410,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; } diff --git a/modules/backend/widgets/lists/partials/_list_pagination.htm b/modules/backend/widgets/lists/partials/_list_pagination.htm index 47f34f3e6..1f81e8894 100644 --- a/modules/backend/widgets/lists/partials/_list_pagination.htm +++ b/modules/backend/widgets/lists/partials/_list_pagination.htm @@ -34,7 +34,8 @@ name="page" class="form-control input-sm custom-select select-no-search" data-request="getEventHandler('onPaginate') ?>" - data-load-indicator=""> + data-load-indicator="" + autocomplete="off"> diff --git a/modules/backend/widgets/lists/partials/_list_pagination_simple.htm b/modules/backend/widgets/lists/partials/_list_pagination_simple.htm index 3ace68ab3..1735143fa 100644 --- a/modules/backend/widgets/lists/partials/_list_pagination_simple.htm +++ b/modules/backend/widgets/lists/partials/_list_pagination_simple.htm @@ -29,7 +29,8 @@ From 136fd53109d29f79cc8cdaff14466cef489b94c3 Mon Sep 17 00:00:00 2001 From: Luke Towers Date: Thu, 13 Feb 2020 16:48:39 -0600 Subject: [PATCH 06/10] Improve error handling on invalid model attributes being used for form fields --- modules/backend/widgets/Form.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/modules/backend/widgets/Form.php b/modules/backend/widgets/Form.php index e7028c501..9238bb25e 100644 --- a/modules/backend/widgets/Form.php +++ b/modules/backend/widgets/Form.php @@ -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', [ From 7048e2c5672cc401670ece8635cd140bd66c71a3 Mon Sep 17 00:00:00 2001 From: Luke Towers Date: Sun, 16 Feb 2020 23:49:01 -0600 Subject: [PATCH 07/10] Improve escaping of option values provided to the dropdown field type. --- modules/system/assets/ui/js/select.js | 19 ++++++++++++------- modules/system/assets/ui/storm-min.js | 13 ++++++------- 2 files changed, 18 insertions(+), 14 deletions(-) diff --git a/modules/system/assets/ui/js/select.js b/modules/system/assets/ui/js/select.js index 346f8944f..f21be2020 100644 --- a/modules/system/assets/ui/js/select.js +++ b/modules/system/assets/ui/js/select.js @@ -13,20 +13,25 @@ */ $(document).render(function(){ var formatSelectOption = function(state) { - if (!state.id) - return state.text; // optgroup + var text = $('').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 ' ' + state.text + if (iconClass) { + return ' ' + text + } - if (imageSrc) - return ' ' + state.text + if (imageSrc) { + return ' ' + text + } - return state.text + return text } var selectOptions = { diff --git a/modules/system/assets/ui/storm-min.js b/modules/system/assets/ui/storm-min.js index 3a7882da2..015b9b631 100644 --- a/modules/system/assets/ui/storm-min.js +++ b/modules/system/assets/ui/storm-min.js @@ -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' '+state.text -if(imageSrc) -return' '+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=$('').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' '+text} +if(imageSrc){return' '+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;} From f8634e07574d4d68eccb0a5fafdac69b9a7270ce Mon Sep 17 00:00:00 2001 From: Ben Thomson Date: Wed, 19 Feb 2020 10:49:15 +0800 Subject: [PATCH 08/10] Immediately load a lazy tab if it is the initial active tab. Fixes #4879 --- modules/backend/widgets/form/assets/js/october.form.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/modules/backend/widgets/form/assets/js/october.form.js b/modules/backend/widgets/form/assets/js/october.form.js index 932b8bebf..6d1e7ded2 100644 --- a/modules/backend/widgets/form/assets/js/october.form.js +++ b/modules/backend/widgets/form/assets/js/october.form.js @@ -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') + } } /* From c27e4d1148c1f62266986c9cd4ac127abe97157e Mon Sep 17 00:00:00 2001 From: danielbidala Date: Thu, 20 Feb 2020 06:26:17 +0100 Subject: [PATCH 09/10] Display '0' in preview mode for type: number fields (#4944) --- modules/backend/widgets/form/partials/_field_number.htm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/backend/widgets/form/partials/_field_number.htm b/modules/backend/widgets/form/partials/_field_number.htm index 5790e9b96..437d94529 100644 --- a/modules/backend/widgets/form/partials/_field_number.htm +++ b/modules/backend/widgets/form/partials/_field_number.htm @@ -1,6 +1,6 @@ previewMode): ?> - value ? e($field->value) : ' ' ?> + value) ? e($field->value) : ' ' ?> config['min']) ? $field->config['min'] : false; From 7b6053768dfc60bdeb5f7d61411370143aa4911b Mon Sep 17 00:00:00 2001 From: Marc Jauvin Date: Thu, 20 Feb 2020 00:42:51 -0500 Subject: [PATCH 10/10] Fix argument name in event handler examples (#4950) --- modules/backend/widgets/Form.php | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/modules/backend/widgets/Form.php b/modules/backend/widgets/Form.php index 9238bb25e..241d8d4ba 100644 --- a/modules/backend/widgets/Form.php +++ b/modules/backend/widgets/Form.php @@ -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'); * }); * */