Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds ability to turn on/off autocompletion for 'pagetitle' field #14526

Open
wants to merge 1 commit into
base: 3.x
from
Open
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.

Always

Just for now

@@ -1475,6 +1475,15 @@
'area' => 'system',
'editedon' => null,
), '', true, true);
$settings['resource_pagetitle_autocomplete']= $xpdo->newObject('modSystemSetting');
$settings['resource_pagetitle_autocomplete']->fromArray(array (
'key' => 'resource_pagetitle_autocomplete',
'value' => '1',
'xtype' => 'combo-boolean',
'namespace' => 'core',
'area' => 'manager',
'editedon' => null,
), '', true, true);
$settings['resource_tree_node_name']= $xpdo->newObject('modSystemSetting');
$settings['resource_tree_node_name']->fromArray(array (
'key' => 'resource_tree_node_name',
@@ -625,6 +625,9 @@
$_lang['setting_resource_tree_node_name'] = 'Resource Tree Node Field';
$_lang['setting_resource_tree_node_name_desc'] = 'Specify the Resource field to use when rendering the nodes in the Resource Tree. Defaults to pagetitle, although any Resource field can be used, such as menutitle, alias, longtitle, etc.';
$_lang['setting_resource_pagetitle_autocomplete'] = 'Enables autocomplete for pagetitle field';
$_lang['setting_resource_pagetitle_autocomplete_desc'] = 'Select \'Yes\' if you want to see hints/autocomplete data based on the previous entered values for the pagetitle field of the resource.';

This comment has been minimized.

Copy link
@Alroniks

Alroniks Apr 3, 2019

Collaborator

Could you change quotes to " for "Yes" or rephrase the string to avoid issues with backslashed symbols?

This comment has been minimized.

Copy link
@DettRoxx

DettRoxx Apr 3, 2019

Author

i take example as 'standart' from here, here single quotes with backslash
image

This comment has been minimized.

Copy link
@Alroniks

Alroniks Apr 3, 2019

Collaborator

I understand, but the existing code does not mean automatically that it is correct. Those string also should be fixed in the future.

$_lang['setting_resource_tree_node_name_fallback'] = 'Resource Tree Node Fallback Field';
$_lang['setting_resource_tree_node_name_fallback_desc'] = 'Specify the Resource field to use as fallback when rendering the nodes in the Resource Tree. This will be used if the resource has an empty value for the configured Resource Tree Node Field.';
@@ -634,6 +634,9 @@
$_lang['setting_resource_tree_node_name'] = 'Поле для названия узла в дереве ресурсов';
$_lang['setting_resource_tree_node_name_desc'] = 'Укажите поле ресурса, которое будет использоваться в качестве названия узла в дереве ресурсов. По умолчанию поле «pagetitle», любое поле ресурса может быть использовано: «menutitle», «alias», «longtitle», и т.п.';
$_lang['setting_resource_pagetitle_autocomplete'] = 'Включить автозаполнение для поля заголовка';

This comment has been minimized.

Copy link
@Alroniks

Alroniks Apr 3, 2019

Collaborator

It should be removed from the pull request, all strings will be translated via Crowdin.

$_lang['setting_resource_pagetitle_autocomplete_desc'] = 'Выберите «Да», если хотите видеть подсказки/автозаполнение данных на основе предыдущих введеных значений для поля pagetitle (заголовок) ресурса.';
$_lang['setting_resource_tree_node_name_fallback'] = 'Запасное поле для узла в дереве ресурсов';
$_lang['setting_resource_tree_node_name_fallback_desc'] = 'Укажите поле ресурса для использования в качестве запасного названия узла в дереве ресурсов. Это значение будет использоваться, если ресурс имеет пустое значение для заданного поля ресурса в дереве.';
@@ -36,6 +36,7 @@ Ext.extend(MODx,Ext.Component,{

,startup: function() {
this.initQuickTips();
this.initAutocompletePagetitle();
this.request = this.getURLParameters();
this.Ajax = this.load({ xtype: 'modx-ajax' });
Ext.override(Ext.form.Field,{
@@ -95,6 +96,14 @@ Ext.extend(MODx,Ext.Component,{
});
}

,initAutocompletePagetitle: function() {
Ext.ComponentMgr.onAvailable("modx-resource-pagetitle", function(field) {
var setting_pagetitle_autocomplete = +MODx.config.resource_pagetitle_autocomplete;
var autocomplete = setting_pagetitle_autocomplete ? "on" : "off";
field.defaultAutoCreate = {tag: "input", type: "text", size: "20", autocomplete: autocomplete, msgTarget: 'under' }

This comment has been minimized.

Copy link
@Alroniks

Alroniks Apr 3, 2019

Collaborator

Why the size is 20?

This comment has been minimized.

Copy link
@DettRoxx

DettRoxx Apr 3, 2019

Author

I copied from here (default code of modx.js)
image

and change only logic for autocomplete

This comment has been minimized.

Copy link
@DettRoxx

DettRoxx Apr 3, 2019

Author

i think (if we can write more than 20 characters in pagetitle field - 'size' is only default, but overrides by ExtJS for every field with strict 'size' option)

});
}

,getURLParameters: function() {
var arg = {};
var href = window.location.search;
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.